/* Личность, друзья, инвайты, админка (Фаза 4). Токены и вокабуляр — как у
   остальной системы (см. DESIGN.md/tokens.css): поверхности, --accent один,
   карточки 14px, кнопки-пилюли. Подключается ДО responsive.css. */

/* ---------- аватар с фото Telegram ---------- */
/* Инициал остаётся фоллбэком; фото приходит <img>, кладётся поверх и клипается
   по кругу. paintIdentity (features/profile.js) вставляет img либо инициал. */
.avatar { position: relative; overflow: hidden; }
.avatar__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---------- вход через Telegram (гость на сайте) ---------- */
.tglogin {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: calc(100% - var(--gutter) * 2); margin: 4px var(--gutter) 18px;
  padding: 15px; border-radius: var(--r-card);
  background: linear-gradient(135deg, var(--accent-hi), var(--accent-deep));
  color: var(--on-accent); font-size: 15px; font-weight: 800;
  box-shadow: var(--shadow-1); transition: transform var(--dur) var(--ease);
}
.tglogin:active { transform: scale(0.98); }

/* ---------- карточка приглашения ---------- */
.invite {
  margin: 4px var(--gutter) 18px; padding: var(--card-pad); border-radius: var(--r-card);
  background: linear-gradient(135deg, rgba(61, 123, 255, 0.26) 0%, var(--surface-1) 72%);
  box-shadow: var(--shadow-1);
}
.invite__title { font-size: 17px; font-weight: 800; letter-spacing: -0.01em; }
.invite__sub { margin-top: 4px; font-size: 12.5px; font-weight: 500; line-height: 1.5; color: var(--t2); }
.invite__row { display: flex; gap: 8px; margin-top: 14px; }
.invite__link {
  flex: 1; min-width: 0; display: flex; align-items: center; padding: 0 14px; height: 44px;
  border-radius: var(--pill); background: var(--surface-2); color: var(--t2);
  font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.invite__btn {
  flex: none; display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 18px;
  border-radius: var(--pill); background: var(--accent); color: var(--on-accent);
  font-size: 14px; font-weight: 800; transition: transform var(--dur) var(--ease);
}
.invite__btn:active { transform: scale(0.96); }
.invitedby { padding: 0 var(--gutter) 14px; font-size: 12.5px; font-weight: 600; color: var(--t3); }
.invitedby b { color: var(--t2); }

/* ---------- список друзей ---------- */
.friendlist { display: flex; flex-direction: column; gap: 2px; padding: 0 calc(var(--gutter) - 8px); }
.friend {
  display: flex; align-items: center; gap: var(--gap-el); width: 100%;
  padding: 10px 8px; border-radius: var(--r-card); text-align: left;
  transition: background var(--dur) var(--ease);
}
.friend:active { background: var(--wash); }
.friend__name { flex: 1; min-width: 0; font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.friend__sub { font-size: 12px; font-weight: 600; color: var(--t3); }
/* Строка друга — кликабельная кнопка (открывает его медиатеку). */
.friend { width: 100%; text-align: left; cursor: pointer; }
.friend__chev { margin-left: auto; flex: none; }

/* ---------- админка ---------- */
.adminwrap { padding: 0 var(--gutter) 8px; }
.adminstat { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.adminstat .stat {
  background: var(--surface-1); border-radius: var(--r-card); padding: 16px 14px;
  box-shadow: var(--shadow-1); display: flex; flex-direction: column; gap: 4px;
}
.adminstat .stat b { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
.adminstat .stat i { font-size: 12px; font-weight: 600; color: var(--t3); font-style: normal; }

.adminsec { font-size: 12px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; color: var(--t3); padding: 8px 4px; }

.goalbox { display: flex; gap: 8px; margin-bottom: 10px; }
.goalbox input {
  flex: 1; min-width: 0; height: 44px; padding: 0 14px; border-radius: var(--pill);
  background: var(--surface-2); color: var(--t1); font-size: 14px; font-weight: 700;
  border: none; outline: none;
}
.goalbox button {
  flex: none; height: 44px; padding: 0 18px; border-radius: var(--pill);
  background: var(--accent); color: var(--on-accent); font-size: 14px; font-weight: 800;
}
.goalbox button:active { transform: scale(0.96); }

.userrow {
  display: flex; align-items: center; gap: 10px; padding: 10px 8px; border-radius: var(--r-card);
}
.userrow + .userrow { box-shadow: inset 0 1px 0 var(--line-soft); }
.userrow__text { flex: 1; min-width: 0; }
.userrow__name { font-size: 14.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.userrow__meta { font-size: 11.5px; font-weight: 600; color: var(--t3); margin-top: 2px; }
.userrow__meta b { color: var(--accent-soft); font-weight: 700; }
.userrow__del {
  flex: none; width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-sm); background: var(--surface-2); color: var(--t3);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.userrow__del--armed { background: rgba(255, 69, 58, 0.16); color: #ff6961; }
/* Тап по телу строки открывает карточку — feedback как у строки друга. */
.userrow { cursor: pointer; transition: background var(--dur) var(--ease); }
.userrow:active { background: var(--wash); }

/* ---- контролы списка пользователей: поиск / фильтр / сортировка ---- */
.userctl { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.userctl__search {
  display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 14px;
  border-radius: var(--pill); background: var(--surface-2); color: var(--t3);
}
.userctl__search input {
  flex: 1; min-width: 0; border: none; outline: none; background: none;
  color: var(--t1); font-size: 16px; font-weight: 600;   /* 16px — iOS не зумит при фокусе */
}
.userctl__search input::placeholder { color: var(--t3); font-weight: 500; }
.userctl__filter { display: flex; gap: 8px; flex-wrap: wrap; }
.userctl__sort {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  height: 44px; padding: 0 6px 0 14px; border-radius: var(--pill); background: var(--surface-2);
}
.userctl__sort > span { font-size: 12.5px; font-weight: 700; color: var(--t3); }
.userctl__sort select {
  flex: none; height: 36px; padding: 0 12px; border: none; border-radius: var(--r-sm);
  background: var(--surface-3); color: var(--t1); font-size: 13.5px; font-weight: 700;
  -webkit-appearance: none; appearance: none;
}
.admin-more {
  display: block; width: 100%; height: 44px; margin: 12px 0 4px; border-radius: var(--pill);
  background: var(--surface-2); color: var(--t2); font-size: 13.5px; font-weight: 800;
  transition: transform var(--dur-press) var(--ease), background var(--dur) var(--ease);
}
.admin-more:active { transform: scale(0.98); background: var(--surface-3); }

/* ---- админ-карточка пользователя (экран admin-user) ---- */
.au-card { padding: 0 var(--gutter) 24px; }
.au-load { padding: 24px 4px; color: var(--t3); font-size: 13px; font-weight: 600; }

.au-hero { display: flex; align-items: center; gap: 14px; padding: 8px 0 16px; }
.au-ava {
  flex: none; position: relative; width: 64px; height: 64px; border-radius: var(--pill);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  background: linear-gradient(135deg, var(--accent-hi), var(--accent-deep));
  color: var(--on-accent); font-size: 26px; font-weight: 800;
}
.au-ava__ini { position: absolute; }
.au-ava__img { position: relative; width: 100%; height: 100%; object-fit: cover; }
.au-hero__id { min-width: 0; }
.au-name { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.au-uname { margin-top: 2px; font-size: 13.5px; font-weight: 600; color: var(--t2); }
.au-badges { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.au-badge {
  display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 9px;
  border-radius: var(--pill); font-size: 11px; font-weight: 800;
}
.au-badge--prem { background: var(--accent); color: var(--on-accent); }
.au-badge--amb { background: rgba(255, 214, 10, 0.16); color: #ffd60a; }
.au-badge--free { background: var(--surface-2); color: var(--t3); }

.au-cta { display: flex; gap: 8px; margin-bottom: 10px; }
.au-tg {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 46px; border-radius: var(--pill); background: var(--accent); color: var(--on-accent);
  font-size: 14px; font-weight: 800; text-decoration: none;
  transition: transform var(--dur-press) var(--ease);
}
.au-tg:active { transform: scale(0.97); }
.au-copy {
  flex: none; display: inline-flex; align-items: center; gap: 6px; height: 46px; padding: 0 14px;
  border-radius: var(--pill); background: var(--surface-2); color: var(--t2);
  font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums;
  transition: transform var(--dur-press) var(--ease);
}
.au-copy:active { transform: scale(0.97); }
.au-note { font-size: 12px; font-weight: 600; color: var(--t3); line-height: 1.5; margin: 6px 2px 2px; }
.au-muted { color: var(--t3); font-style: normal; }

.au-sec { font-size: 12px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; color: var(--t3); padding: 18px 2px 8px; }
.au-sec--danger { color: #ff6961; }

.au-grid { background: var(--surface-1); border-radius: var(--r-card); box-shadow: var(--shadow-1); overflow: hidden; }
.au-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; }
.au-row + .au-row { box-shadow: inset 0 1px 0 var(--line-soft); }
.au-row__k { font-size: 13px; font-weight: 600; color: var(--t3); }
.au-row__v { font-size: 13.5px; font-weight: 700; color: var(--t1); text-align: right; }
.au-row__v b { color: var(--accent-soft); }

.au-pays { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.au-pay { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border-radius: var(--r-card); background: var(--surface-1); }
.au-pay b { font-size: 14px; font-weight: 800; }
.au-pay span { font-size: 12px; font-weight: 600; color: var(--t3); }
.au-pay--paid b { color: var(--accent-soft); }
.au-pay--rejected { opacity: 0.6; }

.au-likes {
  display: flex; align-items: center; justify-content: space-between; width: 100%;
  margin-top: 18px; height: 52px; padding: 0 16px; border-radius: var(--r-card);
  background: var(--surface-1); box-shadow: var(--shadow-1); color: var(--t1);
  font-size: 14.5px; font-weight: 700;
  transition: transform var(--dur-press) var(--ease), background var(--dur) var(--ease);
}
.au-likes:active { transform: scale(0.98); background: var(--surface-2); }
.au-likes span { display: inline-flex; align-items: center; gap: 10px; }
.au-likes__n { color: var(--accent-soft); font-weight: 800; font-variant-numeric: tabular-nums; }

.au-actions { display: flex; flex-direction: column; gap: 10px; }
.au-toggle {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; border-radius: var(--r-card); background: var(--surface-1); box-shadow: var(--shadow-1);
  font-size: 14px; font-weight: 700;
}
.au-adjust { display: flex; gap: 8px; }
.au-adjust__in {
  flex: 1; min-width: 0; height: 46px; padding: 0 14px; border: none; outline: none;
  border-radius: var(--pill); background: var(--surface-2); color: var(--t1); font-size: 16px; font-weight: 700;
}
.au-adjust__btn {
  flex: none; height: 46px; padding: 0 18px; border-radius: var(--pill);
  background: var(--surface-3); color: var(--t1); font-size: 13.5px; font-weight: 800;
  transition: transform var(--dur-press) var(--ease);
}
.au-adjust__btn:active { transform: scale(0.97); }
.au-del {
  height: 48px; border-radius: var(--pill); background: rgba(255, 69, 58, 0.14); color: #ff6961;
  font-size: 14px; font-weight: 800;
  transition: transform var(--dur-press) var(--ease), background var(--dur) var(--ease);
}
.au-del:active { transform: scale(0.98); background: rgba(255, 69, 58, 0.22); }

/* ---------- сheet входа через бота (ожидание подтверждения) ---------- */
.authwait { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 8px 6px 4px; }
.authwait__mark {
  display: flex; align-items: center; justify-content: center; width: 62px; height: 62px;
  border-radius: var(--pill); color: var(--on-accent); box-shadow: var(--shadow-1);
  background: linear-gradient(135deg, var(--accent-hi), var(--accent-deep));
}
.authwait__title { margin-top: 16px; font-size: 18px; font-weight: 800; }
.authwait__sub { margin-top: 6px; font-size: 13px; font-weight: 500; color: var(--t2); line-height: 1.5; }
/* Пока ждём подтверждения в чате — крутится тонкое кольцо. */
.authwait__spin {
  width: 30px; height: 30px; margin-top: 18px; border-radius: var(--pill);
  border: 2.5px solid var(--surface-3); border-top-color: var(--accent);
  animation: authwait-spin 0.8s linear infinite;
}
@keyframes authwait-spin { to { transform: rotate(1turn); } }
@media (prefers-reduced-motion: reduce) { .authwait__spin { animation: none; border-top-color: var(--surface-3); } }
.authwait .linkbtn { margin-top: 16px; }
/* Шторка ожидания открывается и поверх экрана первого входа (гейт, z-index 82) —
   поднимаем её выше, иначе пользователь не увидит «Подтверди вход». */
#sheet-authwait { z-index: 84; }

/* ---------- Соц-слой (Фича 1): @ник, поиск людей, заявки, ЧС ---------- */
.myhandle {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin: 4px var(--gutter) 12px; padding: 12px 16px; border-radius: var(--r-card);
  background: var(--surface-1); box-shadow: var(--shadow-1);
}
.myhandle__id { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.myhandle__label { font-size: 11px; font-weight: 600; color: var(--t3); }
.myhandle__val { font-size: 16px; font-weight: 800; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.searchbar--people { margin: 0 var(--gutter) 12px; }
.searchbar--people input { font-size: 16px; }   /* 16px — iOS не зумит при фокусе */

/* Строка человека (поиск/заявка/ЧС): аватар + имя/@ник + кнопка(и) состояния. */
.person { display: flex; align-items: center; gap: var(--gap-el); width: 100%; padding: 8px; border-radius: var(--r-card); }
.person__meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.person__meta b { font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person__meta i { font-style: normal; font-size: 12px; font-weight: 600; color: var(--t3); }
.person__acts { display: flex; gap: 6px; flex: none; }
.person__btn {
  flex: none; height: 36px; padding: 0 14px; border-radius: var(--pill);
  background: var(--accent); color: var(--on-accent); font-size: 13px; font-weight: 700;
  white-space: nowrap; transition: transform var(--dur-press) var(--ease), background var(--dur) var(--ease);
}
.person__btn:active { transform: scale(0.95); }
.person__btn:disabled { opacity: 0.5; }
.person__btn--ghost { background: var(--surface-2); color: var(--t2); }
.person__ban { flex: none; height: 36px; padding: 0 12px; border-radius: var(--pill); background: var(--surface-2); color: var(--t3); font-size: 12px; font-weight: 700; }
.person__tag { flex: none; font-size: 12px; font-weight: 700; color: var(--t3); padding: 0 6px; }
.person__tag--ok { color: var(--accent-soft); }

#invite-refresh { display: block; margin: 12px 0 0; font-size: 12.5px; }

/* Бейдж входящих заявок на строке «Друзья» в профиле. */
.reqbadge {
  flex: none; min-width: 18px; height: 18px; padding: 0 5px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--pill); background: var(--accent); color: var(--on-accent);
  font-size: 11px; font-weight: 800; font-variant-numeric: tabular-nums;
}
