/* =====================================================================
   account.css — страница кабинета /me (ЛК Э4, эпик SC).
   Палитра и шрифт — из tokens.css; размеры сняты с макетов Figma:
   Auth 415:2260 · Main page 100:635 · Main page + History 415:335.
   Изолирована от styles.css (там живёт интервью-SPA) сознательно:
   у страниц разный жизненный цикл.
   ===================================================================== */

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

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--font-family);
  letter-spacing: var(--tracking);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; }

/* ---- Шапка (menu-app) ---- Стили — общий frontend/header.css (тот же файл
   грузит тренажёр). Кабинет держит панель в потоке, своего .hdr тут нет. */

/* ---- Каркас ---- */
.page { display: flex; justify-content: center; padding: 0 20px 96px; }
.view { width: 100%; display: flex; justify-content: center; }
.view[hidden] { display: none; }
.stack { width: 460px; max-width: 100%; padding-top: 0; }
.stack--cabinet { padding-top: 44px; display: flex; flex-direction: column; gap: 48px; }

.view--status { padding-top: 200px; }
.status-text { color: var(--c-text-muted-3); font-size: 16px; text-align: center; }
.status-text a { color: var(--c-link); }
/* Спиннер экрана загрузки. Свой @keyframes: account.css изолирован от styles.css,
   где тем же паттерном крутится кнопка «Подключиться» в тренажёре. */
@keyframes spin { to { transform: rotate(360deg); } }
.status-spin { width: 28px; height: 28px; color: var(--c-text-muted-3); animation: spin 0.9s linear infinite; }
@media (prefers-reduced-motion: reduce) { .status-spin { animation: none; } }

/* ---- Вид «Вход» ---- */
.proof {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--c-surface);
  border-radius: 24px;
  padding: 20px 40px;
  margin-bottom: 8px;
}
.proof__faces { display: flex; }
.proof__face {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 2px solid var(--c-surface);
  background: #C9C2B6 center/cover;
}
.proof__face + .proof__face { margin-left: -8px; }
/* Фото — те же, что в хиро-блоке лендинга (assets/landing/avatar-hero-*.png);
   серый #C9C2B6 из .proof__face остаётся фолбэком, если файл не подгрузился. */
.proof__face:nth-child(1) { background: url(/assets/landing/avatar-hero-01.png) center/cover no-repeat; }
.proof__face:nth-child(2) { background: url(/assets/landing/avatar-hero-02.png) center/cover no-repeat; }
.proof__face:nth-child(3) { background: url(/assets/landing/avatar-hero-03.png) center/cover no-repeat; }
.proof__text { margin: 0; font-size: 14px; line-height: 20px; color: var(--c-text-muted); }
.proof__text b { color: var(--c-text); font-weight: 600; }

.card {
  background: var(--c-surface);
  border-radius: 24px;
  padding: 40px;
}
.card__title { margin: 0 0 8px; font-size: 28px; line-height: 32px; font-weight: 500; color: #141414; }
.card__sub { margin: 0; font-size: 16px; line-height: 24px; color: var(--c-text-muted-3); }

.auth-actions { margin-top: 24px; }
.auth-row { display: flex; gap: 8px; }
.btn-back {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px; height: 52px;
  background: #141414;
  color: #fff;
  border-radius: 8px;
  text-decoration: none;
}
.btn-back svg { width: 20px; height: 20px; }
.btn-tg {
  flex: 1 1 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 52px;
  padding: 0 14px;
  background: #00A3F6;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: var(--tracking);
  cursor: pointer;
}
.btn-tg:hover { background: #0092DD; }
.btn-tg:disabled { background: #B5DFF7; cursor: default; }
.btn-tg__icon { width: 18px; height: 18px; }

/* Запасной вход (SC-9): контейнер под iframe-виджет Telegram, появляется под
   основной кнопкой только когда попап вернул null (достаёт account.js).
   [hidden]-гейт обязателен: display:flex иначе перебьёт атрибут (гочa .hdr__auth). */
.tg-widget { display: flex; justify-content: center; margin-top: 12px; min-height: 44px; }
.tg-widget[hidden] { display: none; }
.tg-widget iframe { max-width: 100%; }

/* Экран входа при заблокированном telegram.org (SC-10, макет Auth 645:934).
   Полноэкранная замена стандартной карточки; переиспользует .card/.card__title/
   .card__sub. Гейт [hidden] обязателен — display:flex иначе перебьёт атрибут. */
.auth-blocked { display: flex; flex-direction: column; gap: 24px; }
.auth-blocked[hidden] { display: none; }
.auth-blocked__head { display: flex; flex-direction: column; gap: 8px; }
.auth-blocked__head .card__title { margin: 0; }

.qr-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.qr-step {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: #F3F3F3;
  border-radius: 8px;
}
.qr-step__num {
  flex: none;
  width: 24px; height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #141414;
  color: #fff;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 500;
}
.qr-step__text { font-size: 16px; line-height: 24px; color: #0A0A0A; }

/* Ровный вертикальный ритм: расстояния между блоками карточки задаёт flex-gap
   (24), лишний margin у юр-строки убираем, чтобы не копился двойной отступ. */
.auth-blocked .auth-legal { margin: 0; }

/* QR — доля ширины карточки, а не фикс-px: на любой ширине ровные поля вокруг,
   как в макете. Квадрат держит aspect-ratio, потолок — чтобы не разъезжался на
   десктопе. */
.qr-box { display: flex; justify-content: center; padding: 8px 0; }
.qr-box__img { width: 78%; max-width: 300px; aspect-ratio: 1 / 1; }
.qr-box__img svg { display: block; width: 100%; height: auto; }

/* Мобильная раскладка экрана входа (макет 655:8731 + требование «один экран»):
   ужимаем вертикаль, чтобы блок входа влезал в экран телефона без скролла —
   меньше поля, компактнее шаги (14px в строку), QR поменьше. */
@media (max-width: 520px) {
  .page { padding: 0 16px 12px; }
  .auth-blocked { gap: 16px; }
  .card__title { font-size: 22px; line-height: 28px; }
  .qr-steps { gap: 6px; }
  .qr-step { padding: 12px; }
  .qr-step__text { font-size: 14px; line-height: 20px; }
  .qr-box { padding: 0; }
  .qr-box__img { width: 62%; }
}

.auth-legal {
  margin: 16px 0 0;
  font-size: 14px;
  line-height: 20px;
  color: var(--c-text-muted-3);
}
.auth-legal a { color: #00A3F6; text-decoration: none; }
.auth-legal a:hover { text-decoration: underline; }
.auth-note { margin: 12px 0 0; font-size: 13px; color: var(--c-text-muted-3); }

/* ---- Вид «Кабинет» ---- */
.block__title { margin: 0 0 24px; font-size: 28px; line-height: 32px; font-weight: 500; color: #050505; }

/* Каталог: карточка r24, pad 24 (Frame 44/45) */
.catalog { display: flex; flex-direction: column; gap: 8px; }
.cat-card {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--c-surface);
  border: none;
  border-radius: 24px;
  padding: 24px;
  font-family: inherit;
  letter-spacing: var(--tracking);
  transition: transform .12s ease, box-shadow .12s ease;
}
/* Все карточки кликабельны: клик по карточке = клик по кнопке внутри
   (старт собеса или покупка доступа — см. catalogAction в account.js). */
.cat-card--link { cursor: pointer; }
.cat-card--link:hover { transform: translateY(-1px); box-shadow: var(--shadow-card, 0 8px 24px rgba(0,0,0,.06)); }
.cat-card__title { margin: 0 0 8px; font-size: 20px; line-height: 24px; font-weight: 500; color: var(--c-ink); }
.cat-card__desc { margin: 0 0 16px; font-size: 14px; line-height: 20px; color: #666666; }
.cat-card__chips { display: flex; align-items: center; gap: 4px; }
/* Чипсы (слева) + кнопка справа по верхней границе тегов (align-items:flex-start);
   на мобилке кнопка переносится под чипсы во всю ширину (100:635 / 451:1831). */
.cat-card__actions { display: flex; align-items: flex-start; gap: 16px; margin-top: 16px; }
.cat-card__actions .cat-btn { margin-left: auto; flex: none; }

/* Кнопка карточки — намеренно компактная: h40 r12 pad 8/20, текст 14 SemiBold
   (Frame 100/99). Дефолт — серая «Начать»; --buy — жёлтая «Купить доступ». */
.cat-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 8px 20px;
  background: #F3F3F3;
  color: #000;
  border: none;
  border-radius: 12px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 24px;
  letter-spacing: var(--tracking);
  white-space: nowrap;
  cursor: pointer;
  transition: background-color .12s ease, filter .12s ease;
}
.cat-btn--buy { background: var(--c-yellow-strong); color: #050505; }
.cat-btn:disabled { cursor: default; filter: none; opacity: .7; }
/* Ховер по карточке поднимает и ховер кнопки (клик по карточке = клик по кнопке). */
.cat-btn:hover,
.cat-card--link:hover .cat-btn { background: #E9E9E9; }
.cat-btn--buy:hover,
.cat-card--link:hover .cat-btn--buy { background: var(--c-yellow-strong); filter: brightness(.97); }

.chip {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 8px;
  border-radius: 20px;
  font-size: 12px;
  line-height: 1;
  background: var(--c-pill);
  color: #050505;
  white-space: nowrap;
}
.chip--dark { background: #000; color: #fff; }
.chip--soft { background: transparent; border: 1px dashed #C9C9C9; color: var(--c-text-muted-2); }
/* Бейдж «Доступно: N» — жёлтая пилюля (Frame 21, #FFE266) инлайн рядом с ценой.
   После .chip — тот же вес селектора, побеждает порядком (иначе .chip серый). */
.chip--credit { background: var(--c-yellow-strong); color: #050505; font-weight: 500; }

/* История: грид 2×, карточка 226×148 r16 pad16 (Frame 42/43) */
.history {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
/* [hidden] должен перебить display выше (класс перебивает UA-дефолт) */
.history[hidden] { display: none; }
.hist-card {
  display: flex;
  flex-direction: column;
  min-height: 148px;
  background: var(--c-surface);
  border-radius: 16px;
  padding: 16px;
  text-decoration: none;
  transition: transform .12s ease, box-shadow .12s ease;
}
a.hist-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-card, 0 8px 24px rgba(0,0,0,.06)); }
.hist-card--plain { cursor: default; }
.hist-card__title { margin: 0 0 4px; font-size: 16px; line-height: 20px; font-weight: 500; color: #050505; }
.hist-card__date { margin: 0; font-size: 14px; line-height: 20px; color: var(--c-text-muted-2); }
.hist-card__chips { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-top: auto; }

/* «Поделиться» — нейтральная пилюля в подвале карточки, у правого края.
   span (не button): карточка сама по себе <a>, вложенная кнопка невалидна;
   клик гасим в JS, чтобы не открылся сам разбор. */
.hist-card__share {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  line-height: 20px;
  color: var(--c-text-muted-2);
  padding: 2px 10px;
  border-radius: 20px;
  border: 1px solid #E3E3E3;
  background: var(--c-surface);
  cursor: pointer;
  transition: border-color .12s ease, color .12s ease;
}
.hist-card__share:hover { border-color: #C4C4C4; color: var(--c-text); }
.hist-card__share svg { width: 13px; height: 13px; }
/* Активное состояние: ссылка уже включена */
.hist-card__share--on { border-color: #010101; color: #010101; }

/* Модалка «Поделиться» */
.share-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.share-modal[hidden] { display: none; }
.share-modal__backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.32); }
.share-modal__card {
  position: relative;
  width: 100%;
  max-width: 440px;
  background: var(--c-surface);
  border-radius: 20px;
  padding: 28px 24px 24px;
}
.share-modal__x {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--c-text-muted-2);
  cursor: pointer;
}
.share-modal__x svg { width: 18px; height: 18px; }
.share-modal__title { margin: 0 0 8px; font-size: 20px; line-height: 24px; font-weight: 500; color: var(--c-ink); }
.share-modal__hint { margin: 0 0 16px; font-size: 14px; line-height: 20px; color: var(--c-text-muted-3); }
.share-modal__row { display: flex; gap: 8px; }
.share-modal__input {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 14px;
  padding: 10px 12px;
  border: 1px solid #E3E3E3;
  border-radius: 8px;
  background: var(--c-bg);
  color: var(--c-text);
}
.share-modal__copy {
  flex: none;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  color: #fff;
  background: #010101;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  cursor: pointer;
}
.share-modal__copy:hover { opacity: .88; }
.share-modal__views { margin: 12px 0 0; font-size: 13px; color: var(--c-text-muted-2); min-height: 18px; }
.share-modal__revoke {
  margin: 16px 0 0;
  font: inherit;
  font-size: 14px;
  color: #C0392B;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
}
.share-modal__revoke:hover { text-decoration: underline; }

/* Модалка «Купить доступ»: собираем email для чека до перехода на шлюз (PAY-6).
   Форма банка email под чек не соберёт — мы кладём его в Init. Шелл — как у
   share-modal. */
.pay-modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 20px; }
.pay-modal[hidden] { display: none; }
.pay-modal__backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.32); }
.pay-modal__card { position: relative; width: 100%; max-width: 440px; background: var(--c-surface); border-radius: 20px; padding: 28px 24px 24px; }
.pay-modal__x { position: absolute; top: 16px; right: 16px; width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; border: none; background: transparent; color: var(--c-text-muted-2); cursor: pointer; }
.pay-modal__x svg { width: 18px; height: 18px; }
.pay-modal__title { margin: 0 0 8px; font-size: 20px; line-height: 24px; font-weight: 500; color: var(--c-ink); }
.pay-modal__hint { margin: 0 0 16px; font-size: 14px; line-height: 20px; color: var(--c-text-muted-3); }
.pay-modal__form { display: flex; gap: 8px; }
.pay-modal__input { flex: 1; min-width: 0; font: inherit; font-size: 14px; padding: 10px 12px; border: 1px solid #E3E3E3; border-radius: 8px; background: var(--c-bg); color: var(--c-text); }
.pay-modal__submit { flex: none; font: inherit; font-size: 14px; font-weight: 600; color: #050505; background: var(--c-yellow-strong); border: none; border-radius: 8px; padding: 10px 18px; cursor: pointer; }
.pay-modal__submit:hover { filter: brightness(.97); }
.pay-modal__submit:disabled { cursor: default; opacity: .7; }
.pay-modal__note { margin: 12px 0 0; font-size: 13px; color: #C0392B; min-height: 16px; }

/* Тостер «Доступ куплен» (PAY-6, alert 460×100, фон #050505 r24) */
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 200;
  width: min(460px, calc(100% - 40px));
  background: var(--c-text);
  color: #fff;
  border-radius: 24px;
  padding: 20px 24px;
  box-shadow: 0 12px 40px rgba(0,0,0,.24);
  display: flex;
  flex-direction: column;
  gap: 4px;
  animation: toast-in .24s ease;
}
.toast--out { opacity: 0; transition: opacity .3s ease; }
.toast--closable { padding-right: 48px; }
.toast__head { display: flex; align-items: center; gap: 8px; }
.toast__icon { flex: none; display: inline-flex; }
.toast__icon svg { width: 24px; height: 24px; display: block; }
.toast__title { font-size: 20px; font-weight: 500; line-height: 24px; }
.toast__sub { font-size: 14px; line-height: 20px; color: rgba(255,255,255,.82); }
.toast__x {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: rgba(255,255,255,.6);
  cursor: pointer;
}
.toast__x:hover { color: #fff; }
.toast__x svg { width: 16px; height: 16px; }

/* Пустая история: дашед-рамка r16, 4/4 (Frame 239) */
.history-empty[hidden] { display: none; }
.history-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 150px;
  border: 1px dashed #A1A1A1;
  border-radius: 16px;
}
.history-empty__illus { width: 100px; height: 70px; color: #A1A1A1; }
.history-empty__text { margin: 0; font-size: 14px; color: var(--c-text-muted-2); }

/* ---- Мобильная ширина: колонка и так 460 — только поля ---- */
@media (max-width: 520px) {
  /* .hdr padding и мобильная раскладка шапки — в общем header.css */
  .stack { padding-top: 8px; }
  /* кабинет: от шапки до «Выбери тип собеседования» — 32px (макет 415:335) */
  .stack--cabinet { padding-top: 32px; }
  .card { padding: 18px; }
  /* «50+ дизайнеров» на мобилке — в столбик: аватары сверху, текст снизу (макет 451:2076) */
  .proof { padding: 10px 20px; flex-direction: column; align-items: flex-start; gap: 8px; }
  .history { grid-template-columns: 1fr; }
  .hist-card { min-height: 0; }
  .hist-card__chips { margin-top: 16px; }
  /* Кнопка — во всю ширину под чипсами (макет 451:1831) */
  .cat-card__actions { flex-wrap: wrap; }
  .cat-card__actions .cat-btn { width: 100%; margin-left: 0; }
}
