/* Админка — редизайн в разделы (Обзор·Люди·Деньги·Чат·Система). Поверх токенов
   системы (tokens.css) и базовых admin-классов в social.css; подключается ПОСЛЕ
   social.css и ДО responsive.css. Один акцент (--accent), иерархия масштабом и
   воздухом, моушен только transform/opacity (emil). Вау на обоих вьюпортах:
   мобайл — вертикальные плитки, десктоп — шире сетка и крупнее числа. */

:root { --ae-out: cubic-bezier(0.23, 1, 0.32, 1); }

/* ---------- сегмент-разделы ---------- */
.aseg {
  display: flex; gap: 4px; padding: 4px; margin: 2px 0 16px;
  background: var(--surface-2); border-radius: var(--pill);
  overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.aseg::-webkit-scrollbar { display: none; }
.aseg__btn {
  flex: 1 0 auto; min-width: max-content; height: 38px; padding: 0 16px;
  border-radius: var(--pill); background: transparent; color: var(--t3);
  font-size: 13.5px; font-weight: 700; white-space: nowrap;
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease), transform var(--dur-press) var(--ae-out);
}
.aseg__btn:active { transform: scale(0.96); }
.aseg__btn--on { background: var(--surface-1); color: var(--t1); box-shadow: var(--shadow-1); }

/* ---------- панель раздела: мягкий вход (fade + подъём), не keyframes ---------- */
.apanel { animation: apanel-in 260ms var(--ae-out) both; }
@keyframes apanel-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .apanel { animation: none; } }

/* Заголовок секции внутри панели. */
.asec-h {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--t3); padding: 14px 4px 8px;
}
.asec-h span { color: var(--accent-soft); font-variant-numeric: tabular-nums; }

/* ---------- обзорные метрики: плитки ---------- */
#admin-overview { grid-template-columns: repeat(2, 1fr); }
.mtile {
  position: relative; background: var(--surface-1); border-radius: var(--r-card);
  padding: 16px 15px; box-shadow: var(--shadow-1);
  display: flex; flex-direction: column; gap: 4px; overflow: hidden;
  animation: mtile-in 320ms var(--ae-out) both;
}
@keyframes mtile-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .mtile { animation: none; } }
.mtile:nth-child(2) { animation-delay: 40ms; }
.mtile:nth-child(3) { animation-delay: 80ms; }
.mtile:nth-child(4) { animation-delay: 120ms; }
.mtile:nth-child(5) { animation-delay: 160ms; }
.mtile:nth-child(6) { animation-delay: 200ms; }
.mtile__v { font-size: 27px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.mtile__k { font-size: 12px; font-weight: 600; color: var(--t3); }
.mtile__sub { font-size: 11px; font-weight: 600; color: var(--t3); margin-top: 2px; }
/* Одна акцентная плитка-герой (активные Premium) — не заливка ради заливки, а фокус. */
.mtile--hero { grid-column: 1 / -1; background: var(--surface-1); }
.mtile--hero .mtile__v { font-size: 34px; color: var(--accent-soft); }
.mtile--hero::after {
  content: ''; position: absolute; right: -30px; top: -30px; width: 120px; height: 120px;
  border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%);
  pointer-events: none;
}

/* ---------- деньги: фильтр статусов + строки выплат ---------- */
.paychips { margin-bottom: 12px; }
.paychips .chip { font-variant-numeric: tabular-nums; }

/* Список людей: мету в одну строку (аватар + 2 тумблера + корзина отъедают ширину). */
.userrow__meta { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.u-amb-lbl { flex: none; font-size: 10px; font-weight: 800; color: var(--t3); text-transform: uppercase; }
.payoutrow__t { white-space: nowrap; }

.payoutrow__st { flex: none; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.03em; color: var(--t3); }
.payoutrow__st--paid { color: var(--accent-soft); }
.payoutrow__st--rejected { color: #ff6961; }
.payoutbtn--proc { background: var(--surface-3); color: var(--t1); }

/* ---------- система: здоровье ---------- */
#admin-health { display: flex; flex-direction: column; gap: 8px; }
.hrow {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px;
  background: var(--surface-1); border-radius: var(--r-card); box-shadow: var(--shadow-1);
}
.hrow__dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--t3); }
.hrow__dot--ok { background: #34c759; box-shadow: 0 0 0 4px color-mix(in srgb, #34c759 20%, transparent); }
.hrow__dot--bad { background: #ff453a; box-shadow: 0 0 0 4px color-mix(in srgb, #ff453a 20%, transparent); }
.hrow__name { flex: 1; font-size: 14.5px; font-weight: 700; }
.hrow__meta { font-size: 12px; font-weight: 600; color: var(--t3); }

/* ---------- система: журнал действий (аудит) ---------- */
#admin-audit { display: flex; flex-direction: column; gap: 2px; }
.arow { display: flex; gap: 12px; padding: 11px 6px; }
.arow + .arow { box-shadow: inset 0 1px 0 var(--line-soft); }
.arow__b { flex: 1; min-width: 0; }
.arow__act { font-size: 13.5px; font-weight: 700; color: var(--t1); }
.arow__sum { font-size: 12.5px; font-weight: 600; color: var(--t2); margin-top: 1px; line-height: 1.4; }
.arow__t { flex: none; font-size: 11.5px; font-weight: 600; color: var(--t3); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- чат: строка треда со статусом + быстрый «решить» ---------- */
.threadrow { display: flex; align-items: center; gap: 8px; padding: 4px; }
.threadrow__open {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; text-align: left;
  padding: 8px; border-radius: var(--r-card); transition: background var(--dur) var(--ease);
}
.threadrow__open:active { background: var(--wash); }
.threadrow__text { flex: 1; min-width: 0; }
.threadrow__name { font-size: 14.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.threadrow__last { font-size: 12px; font-weight: 600; color: var(--t3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.threadrow--resolved .threadrow__name { color: var(--t3); }
.threadrow__resolve {
  flex: none; width: 38px; height: 38px; display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-sm); background: var(--surface-2); color: var(--t3);
  transition: transform var(--dur-press) var(--ae-out), background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.threadrow__resolve:active { transform: scale(0.92); }
.threadrow--resolved .threadrow__resolve { background: color-mix(in srgb, #34c759 16%, transparent); color: #34c759; }

/* ---------- карточка пользователя: 3 честных статуса + управление премиумом ---------- */
/* Эффективный статус премиума (Оплачен/Амбассадор/Ручной/Базовый) — вместо вранья тумблера. */
.au-status {
  display: flex; align-items: center; gap: 10px; margin-bottom: 10px; padding: 14px 16px;
  background: var(--surface-1); border-radius: var(--r-card); box-shadow: var(--shadow-1);
}
.au-status__dot { flex: none; width: 12px; height: 12px; border-radius: 50%; background: var(--t3); }
.au-status__dot--paid { background: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 20%, transparent); }
.au-status__dot--amb { background: #ffd60a; box-shadow: 0 0 0 4px rgba(255, 214, 10, 0.2); }
.au-status__b { flex: 1; min-width: 0; }
.au-status__t { font-size: 15px; font-weight: 800; letter-spacing: -0.01em; }
.au-status__s { font-size: 12px; font-weight: 600; color: var(--t3); margin-top: 2px; }

/* Выдача премиума на дни: пресеты-пилюли + «выдать». */
.au-grant { margin-top: 2px; }
.au-days { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.au-day {
  flex: 1 0 auto; min-width: 56px; height: 40px; padding: 0 12px; border-radius: var(--pill);
  background: var(--surface-2); color: var(--t2); font-size: 13px; font-weight: 700;
  transition: transform var(--dur-press) var(--ae-out), background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.au-day:active { transform: scale(0.95); }
.au-day--on { background: var(--accent); color: var(--on-accent); }
.au-grant__btn {
  width: 100%; height: 46px; border-radius: var(--pill); background: var(--accent); color: var(--on-accent);
  font-size: 14px; font-weight: 800; transition: transform var(--dur-press) var(--ae-out), opacity var(--dur) var(--ease);
}
.au-grant__btn:active { transform: scale(0.98); }
.au-grant__btn:disabled { opacity: 0.5; }

/* Ряд управляющих действий (сброс сессий / @handle / отмена автосписания). */
.au-ops { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.au-op {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%;
  height: 48px; padding: 0 16px; border-radius: var(--r-card); background: var(--surface-1);
  box-shadow: var(--shadow-1); color: var(--t1); font-size: 14px; font-weight: 700; text-align: left;
  transition: transform var(--dur-press) var(--ae-out), background var(--dur) var(--ease);
}
.au-op:active { transform: scale(0.98); background: var(--surface-2); }
.au-op__hint { font-size: 12px; font-weight: 600; color: var(--t3); }
.au-op--clear { color: #ff9f0a; }

/* Заметка админа. */
.au-noteedit { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.au-noteedit textarea {
  width: 100%; min-height: 72px; padding: 12px 14px; border: none; outline: none; resize: vertical;
  border-radius: var(--r-card); background: var(--surface-2); color: var(--t1);
  font: inherit; font-size: 15px; font-weight: 600; line-height: 1.5;
}
.au-noteedit textarea::placeholder { color: var(--t3); font-weight: 500; }
.au-noteedit__btn {
  align-self: flex-end; height: 40px; 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(--ae-out);
}
.au-noteedit__btn:active { transform: scale(0.97); }

/* Активная подписка (для «отменить автосписание»). */
.au-sub { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; }
.au-sub__b { font-size: 13.5px; font-weight: 700; }
.au-sub__s { font-size: 12px; font-weight: 600; color: var(--t3); margin-top: 1px; }

/* ---------- десктоп: шире сетка, крупнее числа, воздух ---------- */
@media (min-width: 1024px) {
  .adminwrap { max-width: 920px; margin: 0 auto; }
  #admin-overview { grid-template-columns: repeat(3, 1fr); }
  .mtile__v { font-size: 30px; }
  .mtile--hero .mtile__v { font-size: 40px; }
  .aseg { max-width: 560px; }
}