/* ─── Вход и Профиль · вёрстка один в один по макетам Stitch ───────────────
   tb-10-vhod.html и tb-04-profil.html. Числа взяты из макета:
   display-lg 32/40 -0.02em 700 · headline-md 20/28 -0.01em 600 ·
   headline-sm 16/24 600 · body-md 14/20 400 · body-sm 13/18 400 ·
   label-md 12/16 500 · label-caps 11/16 +0.05em 600.
   Радиусы: lg 8px, xl 12px, default 4px. Файл грузится после app.css. */

/* ─── Иконки, добавленные под эти два экрана ─── */
.ico-user      { --u: url('/static/icons/user.svg'); }
.ico-lock      { --u: url('/static/icons/lock-simple.svg'); }
.ico-briefcase { --u: url('/static/icons/briefcase.svg'); }
.ico-star      { --u: url('/static/icons/star-fill.svg'); }
.ico-trend     { --u: url('/static/icons/trend-up.svg'); }
.ico-checkc    { --u: url('/static/icons/check-circle.svg'); }
.ico-clipboard { --u: url('/static/icons/clipboard-text.svg'); }
.ico-copy      { --u: url('/static/icons/copy.svg'); }
.ico-tg        { --u: url('/static/icons/paper-plane-tilt.svg'); }

/* ══════════════════════════ ВХОД ══════════════════════════════════════ */
/* макет: слева форма на половину экрана, справа полотно-картинка (lg+) */
.login-body {
  display: flex; align-items: stretch;
  min-height: 100vh; min-height: 100dvh;
  font-family: 'Inter', system-ui, sans-serif;
  background: #FFFFFF;                 /* surface-container-lowest */
  color: var(--ink);
  font-size: 14px;
}
.login-pane {
  width: 100%; display: flex; flex-direction: column;
  padding: 32px 24px;                  /* py-8 px-container-margin */
}
.login-top { padding-top: 16px; margin-bottom: auto; }
.login-brand {
  font-size: 20px; line-height: 28px; letter-spacing: -0.01em;
  font-weight: 700; color: var(--violet);
}
.login-brand::before { content: none; }   /* точку из app.css макет не рисует */
.login-main {
  width: 100%; max-width: 448px;       /* max-w-md */
  margin: auto; display: flex; flex-direction: column; gap: 12px;
}
.login-head { margin-bottom: 24px; }
.login-head h1 {
  font-size: 32px; line-height: 40px; letter-spacing: -0.02em;
  font-weight: 700; color: var(--ink); margin-bottom: 8px;
}
.login-head p { font-size: 14px; line-height: 20px; color: var(--body); }
.login-form { display: flex; flex-direction: column; gap: 16px; width: 100%; }
/* поле: заливка #F1F5F9, рамка прозрачная, на фокусе фиолет + кольцо 1px */
.login-field {
  position: relative; width: 100%; border-radius: 8px;
  background: var(--field); border: 1px solid transparent;
  display: flex; align-items: center; padding: 12px 16px;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.login-field:focus-within { border-color: #7C3AED; box-shadow: 0 0 0 1px #7C3AED; }
.login-field .ico { width: 20px; height: 20px; margin-right: 12px; color: var(--faint); }
.login-field input {
  width: 100%; background: transparent; border: 0; outline: none; padding: 0;
  font: inherit; font-size: 14px; line-height: 20px; color: var(--ink);
}
.login-field input::placeholder { color: var(--line); }
.login-form button[type="submit"] {
  margin-top: 8px; width: 100%; border: 0; cursor: pointer;
  background: #7C3AED; color: #fff;
  font: inherit; font-size: 16px; line-height: 24px; font-weight: 600;
  padding: 12px 0; border-radius: 8px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  box-shadow: 0 4px 6px -1px rgba(0,0,0,.05);
  transition: background .2s var(--ease);
}
.login-form button[type="submit"]:hover { background: var(--violet); }
.login-form button[type="submit"]:active { opacity: .8; }
.login-error {
  font-size: 13px; line-height: 18px; font-weight: 600; color: var(--red);
  text-align: center;
}
.login-error:empty { display: none; }
.login-alt { margin-top: 16px; text-align: center; }
.login-alt span, .login-hint {
  font-size: 13px; line-height: 18px; color: var(--faint);
}
.login-foot {
  margin-top: auto; padding-bottom: 16px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.login-foot p {
  font-size: 13px; line-height: 18px; color: #565E74; text-align: center;
}
.login-links { display: flex; gap: 16px; }
.login-links a {
  font-size: 11px; line-height: 16px; letter-spacing: .05em; font-weight: 600;
  color: var(--body); text-decoration: none;
  transition: color .2s var(--ease);
}
.login-links a:hover { color: var(--violet); }
/* правое полотно вместо картинки из макета: свой градиент, внешних файлов нет */
.login-art { display: none; }

@media (min-width: 640px) { .login-pane { padding-left: 48px; padding-right: 48px; } }
@media (min-width: 768px) { .login-pane { padding-left: 96px; padding-right: 96px; } }
@media (min-width: 1024px) {
  .login-pane { width: 50%; }
  .login-art {
    display: block; width: 50%; position: relative; overflow: hidden;
    background:
      radial-gradient(120% 90% at 12% 8%, rgba(124,58,237,.85) 0%, rgba(124,58,237,0) 55%),
      radial-gradient(90% 80% at 88% 88%, rgba(78,11,169,.9) 0%, rgba(78,11,169,0) 60%),
      linear-gradient(160deg, #25005A 0%, #630ED4 55%, #7C3AED 100%);
  }
  /* мягкая сетка поверх заливки, гаснет к краям */
  .login-art::before {
    content: ''; position: absolute; inset: 0;
    background:
      repeating-linear-gradient(0deg, rgba(255,255,255,.06) 0 1px, transparent 1px 48px),
      repeating-linear-gradient(90deg, rgba(255,255,255,.06) 0 1px, transparent 1px 48px);
    -webkit-mask: radial-gradient(70% 60% at 50% 45%, #000 0%, transparent 100%);
    mask: radial-gradient(70% 60% at 50% 45%, #000 0%, transparent 100%);
  }
  /* блик — тот же приём, что и в карточке профиля */
  .login-art::after {
    content: ''; position: absolute; width: 420px; height: 420px;
    left: 55%; top: 18%; border-radius: 50%;
    background: rgba(210,187,255,.28); filter: blur(64px);
  }
}

/* ══════════════════════════ ПРОФИЛЬ ═══════════════════════════════════ */
.pf { max-width: 1024px; margin: 0 auto; width: 100%; }
.pf-head { margin-bottom: 24px; display: flex; align-items: center; justify-content: space-between; }
.pf-head h2 {
  font-size: 32px; line-height: 40px; letter-spacing: -0.02em;
  font-weight: 700; color: var(--ink);
}
.pf-grid { display: grid; grid-template-columns: 1fr; gap: 20px; }
.pf-left, .pf-right { display: flex; flex-direction: column; gap: 20px; min-width: 0; }

/* общая карточка макета: белая, r12, p16, тень xs, рамка surface-variant */
.pf-card {
  background: var(--panel); border: 1px solid var(--surface-variant);
  border-radius: 12px; padding: 16px; box-shadow: var(--shadow-xs);
}

/* ─── Шапка профиля ─── */
.pf-hero { position: relative; overflow: hidden; }
.pf-glow {
  position: absolute; top: 0; right: 0; width: 256px; height: 256px;
  border-radius: 50%; background: rgba(124,58,237,.10); filter: blur(64px);
  transform: translate(25%, -50%); pointer-events: none;
}
.pf-hero-in {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: flex-start; gap: 24px;
}
.pf-ava-col { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.pf-ava {
  position: relative; width: 128px; height: 128px; flex-shrink: 0; cursor: pointer;
}
.pf-ava-shot {
  width: 100%; height: 100%; border-radius: 50%; overflow: hidden;
  border: 4px solid var(--panel); background: var(--surface-variant);
  box-shadow: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -2px rgba(0,0,0,.1);
  position: relative;
}
.pf-ava .ava-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pf-ava .ava-fallback {
  width: 100%; height: 100%; font-size: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.pf-ava .ava-overlay {
  position: absolute; inset: 0; display: flex; align-items: center;
  justify-content: center; text-align: center;
  background: rgba(17,24,39,.55); color: #fff;
  font-size: 11px; font-weight: 700; line-height: 1.3;
  opacity: 0; transition: opacity .2s var(--ease);
}
.pf-ava:hover .ava-overlay, .pf-ava.busy .ava-overlay { opacity: 1; }
/* кружок-карандаш и бейдж уровня живут вне обрезанного круга */
.pf-ava-edit {
  position: absolute; bottom: 4px; right: 4px; width: 32px; height: 32px;
  background: var(--panel); border: 1px solid var(--surface-variant);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  color: var(--violet); box-shadow: 0 1px 2px 0 rgba(0,0,0,.05);
  transition: background .2s var(--ease);
}
.pf-ava-edit .ico { width: 16px; height: 16px; transition: transform .2s var(--ease); }
.pf-ava:hover .pf-ava-edit { background: var(--surface-low); }
.pf-ava:hover .pf-ava-edit .ico { transform: scale(1.1); }
.pf-level {
  position: absolute; top: -8px; right: -8px; width: 40px; height: 40px;
  border-radius: 50%; background: #7C3AED; color: #EDE0FF;
  font-size: 16px; line-height: 24px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--panel); box-shadow: 0 1px 2px 0 rgba(0,0,0,.05); z-index: 2;
}
.ava-clear {
  border: 0; background: none; color: var(--faint); font: inherit; font-size: 12px;
  line-height: 16px; font-weight: 500; cursor: pointer; padding: 4px 8px;
  border-radius: 7px; align-self: center; margin: 0;
}
.ava-clear:hover { color: var(--red); background: var(--red-soft); }
.pf-info { flex: 1; width: 100%; min-width: 0; }
.pf-info h3 {
  font-size: 32px; line-height: 40px; letter-spacing: -0.02em; font-weight: 700;
  color: var(--ink); margin-bottom: 4px; overflow-wrap: anywhere;
}
.pf-role {
  font-size: 16px; line-height: 24px; font-weight: 600; color: var(--body);
  margin-bottom: 24px; display: flex; align-items: center; gap: 8px;
}
.pf-role .ico { width: 18px; height: 18px; }
.pf-prog-head {
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: 12px; margin-bottom: 8px;
}
.pf-prog-head span { font-size: 12px; line-height: 16px; font-weight: 500; color: var(--body); }
.pf-prog-num { color: var(--violet); font-weight: 700 !important; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pf-track { width: 100%; height: 8px; background: var(--track); border-radius: 999px; overflow: hidden; }
.pf-fill { height: 100%; border-radius: 999px; background: var(--violet); transition: width 1s var(--ease); }

/* ─── Плитки статистики ─── */
.pf-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.pf-stat {
  display: flex; flex-direction: column; justify-content: space-between;
  align-items: flex-start; gap: 16px;
  transition: box-shadow .3s var(--ease);
}
.pf-stat:hover { box-shadow: var(--shadow-md); }
.pf-stat-ico {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s var(--ease), color .2s var(--ease);
}
.pf-stat-ico .ico { width: 20px; height: 20px; }
.pf-stat-label { font-size: 12px; line-height: 16px; font-weight: 500; color: var(--body); margin-bottom: 4px; }
.pf-stat-val {
  font-size: 20px; line-height: 28px; letter-spacing: -0.01em; font-weight: 700;
  color: var(--ink); font-variant-numeric: tabular-nums;
}
.si-violet { background: rgba(124,58,237,.20); color: var(--violet); }
.pf-stat:hover .si-violet { background: #7C3AED; color: #EDE0FF; }
.si-green { background: #DCFCE7; color: #15803D; }
.pf-stat:hover .si-green { background: #BBF7D0; }
.si-grey { background: var(--surface-variant); color: var(--body); }
.pf-stat:hover .si-grey { background: #D8DADC; }
.si-orange { background: #FFEDD5; color: #C2410C; }
.pf-stat:hover .si-orange { background: #FED7AA; }
.pf-stat-val.val-green { color: #15803D; }

/* ─── Правая колонка: Telegram и пароль ─── */
.pf-side-card { display: flex; flex-direction: column; gap: 16px; }
.pf-card-head { display: flex; align-items: center; gap: 12px; }
.pf-card-head h4 { font-size: 16px; line-height: 24px; font-weight: 600; color: var(--ink); }
.pf-head-ico {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.pf-head-ico .ico { width: 18px; height: 18px; }
.hi-tg { background: #0088CC; color: #fff; }
.hi-grey { background: var(--surface-variant); color: var(--body); }
.pf-note { font-size: 14px; line-height: 20px; color: var(--body); }
.pf-note b, .pf-note .accent { color: var(--violet); font-weight: 500; }
.pf-note.ok { color: #15803D; font-weight: 600; }
.pf-codebox {
  background: var(--field); border: 1px solid var(--surface-variant);
  border-radius: 8px; padding: 16px; margin-top: 8px;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.pf-codebox .bind-code {
  font-size: 20px; line-height: 28px; font-weight: 700; letter-spacing: .1em;
  color: var(--ink);
}
.pf-outline {
  width: 100%; background: transparent; color: var(--violet);
  font: inherit; font-size: 16px; line-height: 24px; font-weight: 600;
  padding: 8px 16px; border-radius: 4px; border: 1px solid var(--violet);
  cursor: pointer; text-decoration: none;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: background .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease);
}
.pf-outline:hover { background: var(--surface-variant); }
.pf-outline .ico { width: 18px; height: 18px; }
.pf-outline.done { background: #F0FDF4; color: #15803D; border-color: #15803D; }
.pf-hint { font-size: 13px; line-height: 18px; color: var(--faint); text-align: center; }
.pf-form { display: flex; flex-direction: column; gap: 16px; }
.pf-field { display: flex; flex-direction: column; gap: 4px; }
.pf-field label { font-size: 12px; line-height: 16px; font-weight: 500; color: var(--body); }
.pf-field input {
  background: var(--field); border: 0; border-radius: 8px; padding: 8px 16px;
  font: inherit; font-size: 14px; line-height: 20px; color: var(--ink);
  transition: box-shadow .2s var(--ease);
}
.pf-field input:focus { outline: none; box-shadow: 0 0 0 2px var(--violet); }
.pf-field small { font-size: 12px; line-height: 16px; color: var(--faint); }
.pf-form .pf-save {
  margin-top: 8px; align-self: stretch; border: 0; cursor: pointer;
  background: var(--violet); color: #fff;
  font: inherit; font-size: 16px; line-height: 24px; font-weight: 600;
  padding: 8px 16px; border-radius: 8px;
  box-shadow: 0 1px 2px 0 rgba(0,0,0,.05);
  transition: background .2s var(--ease);
}
.pf-form .pf-save:hover { background: #6B21A8; }
.pf-form .form-msg { font-size: 13px; line-height: 18px; font-weight: 600; }
.pf-form .form-msg:empty { display: none; }

@media (min-width: 640px) {
  .pf-hero-in { flex-direction: row; align-items: center; }
  .pf-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
  .pf-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .pf-left { grid-column: span 2; }
}
/* телефон: заголовок и имя не должны съедать экран */
@media (max-width: 520px) {
  .pf-head h2 { font-size: 26px; line-height: 34px; }
  .pf-info h3 { font-size: 26px; line-height: 34px; }
}

/* подписи плиток внутри значения: их структуру читают тесты профиля */
.pf-stat-val b { display: block; font-size: 20px; line-height: 28px; font-weight: 700; color: var(--ink); }
.pf-stat-val span { font-size: 12px; line-height: 16px; font-weight: 500; color: var(--body); }
.pf-stat-val.val-green b { color: #15803D; }
.pf-code-cap {
  display: block; font-size: 11px; font-weight: 600; letter-spacing: .05em;
  text-transform: uppercase; color: var(--body); margin-bottom: 6px;
}
