/*
 * Безопасность аккаунта: вход через VK ID и блоки ЛК «Контактные данные»,
 * «Связанные аккаунты», «Сессии», «Авторизации».
 * Оформление перенесено из tutkontrol (apps/web/src/assets/cabinet/cabinet.css
 * и assets/admin/admin-auth.css): карточки .cabinet-card, «таблетки» статусов
 * .tpill, строки сессий и история авторизаций. Токены — значения tutkontrol.
 */

.pd-sec-card,
.pd-sec-page-head,
.pd-auth {
  --pd-sec-surface: #ffffff;
  --pd-sec-surface-low: #fafaf7;
  --pd-sec-text: #1c1f2e;
  --pd-sec-text-secondary: #5f6473;
  --pd-sec-text-muted: #8b8f9c;
  --pd-sec-border: #e3e4de;
  --pd-sec-border-muted: #eceee7;
  --pd-sec-border-strong: #8b8f9c;
  --pd-sec-radius-md: 8px;
  --pd-sec-radius-lg: 10px;
  --pd-sec-shadow-1: 0 1px 2px rgba(36, 48, 94, 0.08), 0 2px 4px rgba(36, 48, 94, 0.06);
  --pd-sec-free-bg: #e8f7d6;
  --pd-sec-free-text: #335a00;
  --pd-sec-trust-bg: #e6edf8;
  --pd-sec-trust-text: #24305e;
  --pd-sec-warn-bg: #fff8be;
  --pd-sec-warn-text: #6f5600;
  --pd-sec-accent: #8da6d6;
  --pd-sec-mono: "Roboto Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

/* ---------- карточки ---------- */

/* Отступ и сверху, и снизу: соседние блоки ЛК (форма «Изменить данные»,
   «Принятые документы») своего отступа не имеют. Между карточками — один. */
.pd-sec-card {
  position: relative;
  margin: 20px 0;
  background: var(--pd-sec-surface);
  border: 1px solid var(--pd-sec-border);
  border-radius: var(--pd-sec-radius-lg);
  box-shadow: var(--pd-sec-shadow-1);
  color: var(--pd-sec-text);
}

.pd-sec-card + .pd-sec-card {
  margin-top: 0;
}

.pd-sec-card__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--pd-sec-border-muted);
}

.pd-sec-card__title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
}

.pd-sec-card__row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
}

.pd-sec-card__row + .pd-sec-card__row {
  border-top: 1px solid var(--pd-sec-border-muted);
}

.pd-sec-card__row--stack {
  flex-direction: column;
  align-items: stretch;
  gap: 16px;
}

.pd-sec-card__row--start {
  align-items: flex-start;
}

.pd-sec-card__label {
  flex: 1;
  min-width: 0;
}

/* Адрес переносится по любому знаку: на 390 px он длиннее строки. */
.pd-sec-card__value {
  margin-top: 2px;
  font-size: 14px;
  overflow-wrap: anywhere;
}

.pd-sec-card__name {
  font-size: 14px;
}

.pd-sec-card__sub {
  margin-top: 2px;
}

.pd-sec-hint {
  margin: 0;
  font-size: 12px;
  color: var(--pd-sec-text-secondary);
}

.pd-sec-mono {
  font-family: var(--pd-sec-mono);
}

/* ---------- статусы ---------- */

/* Цвет никогда не единственный носитель смысла: текст + точка обязательны. */
.pd-sec-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 28px;
  padding: 0 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
}

.pd-sec-pill__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.pd-sec-pill--free {
  background: var(--pd-sec-free-bg);
  color: var(--pd-sec-free-text);
}

.pd-sec-pill--free .pd-sec-pill__dot {
  background: #5a9b1e;
}

.pd-sec-pill--trust {
  background: var(--pd-sec-trust-bg);
  color: var(--pd-sec-trust-text);
}

.pd-sec-pill--trust .pd-sec-pill__dot {
  background: #24305e;
}

.pd-sec-pill--warn {
  background: var(--pd-sec-warn-bg);
  color: var(--pd-sec-warn-text);
}

.pd-sec-pill--warn .pd-sec-pill__dot {
  background: #b08900;
}

/* ---------- кнопки ---------- */

.pd-sec-form {
  margin: 0;
  flex-shrink: 0;
}

.pd-sec-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: var(--pd-sec-radius-md);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s, border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}

.pd-sec-btn--outline {
  background: #fff;
  color: var(--pd-sec-text);
  border-color: var(--pd-sec-border);
}

.pd-sec-btn--outline:hover:not(:disabled) {
  border-color: var(--pd-sec-border-strong);
  background: var(--pd-sec-surface-low);
  color: var(--pd-sec-text);
}

.pd-sec-btn:disabled {
  cursor: default;
  opacity: 0.55;
}

/* Подтверждённые почта и телефон в форме «Изменить данные» — только для чтения:
   без наведения и фокуса (поле вне Tab-порядка, клики до него не доходят). */
.pd-account-form .pd-account-locked {
  pointer-events: none;
}

.pd-account-form input[readonly] {
  color: #5f6473;
}

/* Серый фон и серая рамка (темнее фона) — сразу видно, что поле не изменяется.
   Рисует поле сам input (у обёртки .pd-account-input нет скругления — её не красим).
   Фон и рамку поля в ЛК задаёт более специфичное правило account.css, поэтому
   состояние переопределяем явно. */
.pd-account-form .pd-account-locked input[readonly] {
  background-color: #eeeeec !important;
  border-color: #d5d5d1 !important;
}

/* ---------- шапка разделов «Сессии» и «Авторизации» ---------- */

.pd-sec-page-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  text-align: left;
}

.pd-sec-page-head > div {
  flex: 1 1 260px;
  min-width: 0;
}

/* ---------- сессии ---------- */

.pd-sec-session {
  align-items: flex-start;
  flex-wrap: wrap;
}

.pd-sec-session__details {
  display: grid;
  flex: 1;
  gap: 4px;
  min-width: 240px;
  overflow-wrap: anywhere;
}

/* Устройство отделено от служебных строк отступом чуть большим, чем они друг от друга. */
.pd-sec-session__details .pd-sec-mono {
  margin-top: 3px;
}

/* ---------- история авторизаций ---------- */

.pd-sec-auth {
  overflow: hidden;
}

.pd-sec-auth__head {
  justify-content: space-between;
  align-items: flex-start;
}

.pd-sec-auth__method .pd-sec-hint {
  margin-top: 2px;
}

.pd-sec-auth__grid,
.pd-sec-auth__documents {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  width: 100%;
}

.pd-sec-auth__grid strong {
  display: block;
  margin-top: 2px;
  font-weight: 600;
}

.pd-sec-auth__document {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--pd-sec-border-muted);
  border-radius: var(--pd-sec-radius-md);
  background: var(--pd-sec-surface-low);
}

.pd-sec-auth__document a {
  color: inherit;
}


/* ---------- телефон ---------- */

@media (max-width: 980px) {
  .pd-sec-card__row {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding-right: 14px;
    padding-left: 14px;
  }

  .pd-sec-card__row .pd-sec-form,
  .pd-sec-card__row .pd-sec-btn {
    width: 100%;
  }

  .pd-sec-card__row .pd-sec-btn {
    min-height: 44px;
  }

  .pd-sec-card__row > .pd-sec-pill {
    align-self: flex-start;
  }

  .pd-sec-card__row--start {
    align-items: flex-start;
  }

  /* Строка провайдера остаётся горизонтальной и на телефоне. */
  .pd-sec-card__row.pd-sec-card__row--inline {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    min-height: 52px;
  }

  .pd-sec-card__row.pd-sec-card__row--inline > .pd-sec-pill {
    align-self: center;
  }

  .pd-sec-card__row.pd-sec-card__row--inline .pd-sec-form {
    flex-basis: 100%;
  }

  .pd-sec-page-head .pd-sec-form,
  .pd-sec-page-head .pd-sec-btn {
    width: 100%;
    min-height: 44px;
  }

  /* Сессии: строки становятся отдельными карточками, общая рамка и заголовок гаснут. */
  .pd-sec-card--sessions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .pd-sec-card--sessions .pd-sec-card__head {
    display: none;
  }

  .pd-sec-card--sessions .pd-sec-session {
    padding: 13px;
    background: var(--pd-sec-surface);
    border: 1px solid var(--pd-sec-border);
    border-radius: var(--pd-sec-radius-lg);
  }

  .pd-sec-card--sessions .pd-sec-card__row + .pd-sec-card__row {
    border-top: 1px solid var(--pd-sec-border);
  }

  .pd-sec-card--sessions .pd-sec-session--current {
    border-left: 3px solid var(--pd-sec-accent);
  }

  .pd-sec-card--sessions .pd-sec-session__details {
    gap: 3px;
    min-width: 0;
  }

  /* Авторизации */
  .pd-sec-auth {
    padding: 13px;
    box-shadow: none;
  }

  .pd-sec-auth .pd-sec-card__head {
    gap: 10px;
    padding: 0;
    border-bottom: 0;
  }

  .pd-sec-auth .pd-sec-card__row {
    margin-top: 11px;
    padding: 11px 0 0;
    border-top: 1px solid var(--pd-sec-border-muted);
  }

  .pd-sec-auth__method {
    flex: 1;
    min-width: 0;
  }

  .pd-sec-auth .pd-sec-card__title {
    font-size: 14px;
  }

  .pd-sec-auth__grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 9px;
  }

  .pd-sec-auth__grid .pd-sec-hint {
    font-size: 11px;
  }

  .pd-sec-auth__grid strong {
    font-size: 13px;
    font-weight: 500;
  }

  .pd-sec-auth__machine {
    font-family: var(--pd-sec-mono);
    word-break: break-all;
  }

  .pd-sec-auth .pd-sec-card__row--stack {
    gap: 7px;
  }

  .pd-sec-auth .pd-sec-card__row > .pd-sec-hint {
    font-size: 11px;
  }

  .pd-sec-auth__documents {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  .pd-sec-auth__document {
    gap: 0;
    padding: 10px 11px;
    border: 0;
  }

  .pd-sec-auth__document > strong {
    font-size: 13px;
    font-weight: 500;
  }

  .pd-sec-auth__document > span,
  .pd-sec-auth__document > a {
    margin-top: 2px;
    font-size: 12px;
    line-height: 1.45;
  }

  .pd-sec-auth__document > .pd-sec-hint {
    margin-top: 4px;
    font-size: 11px;
  }


  .pd-sec-auth--collapsed .pd-sec-auth__documents-row {
    display: none;
  }

  .pd-sec-auth--collapsed .pd-sec-auth__count {
    display: block;
    margin: 11px 0 0;
    font-size: 12px;
    font-weight: 500;
    color: #24305e;
  }
}

/* =================================================================
 * Вход: плитка VK ID, разделитель «или», шаг с виджетом OneTap
 * (tutkontrol admin-auth.css)
 * ================================================================= */

.pd-auth-services {
  margin-top: 4px;
}

.pd-auth-services__title {
  margin: 0;
  color: var(--pd-sec-text-secondary);
  font-size: 12px;
  line-height: 1.4;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.pd-auth-providers {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.pd-auth-provider {
  flex: 1 1 0;
  min-width: 64px;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--pd-sec-border);
  border-radius: 12px;
  background: var(--pd-sec-surface);
  font: inherit;
  cursor: pointer;
  transition: background-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}

/* Фирменный синий VK: плитка ведёт на шаг согласий, где вход выполняет уже их собственный виджет. */
.pd-auth-provider--vk {
  border-color: transparent;
  background: #0077ff;
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
}

.pd-auth-provider--vk:hover:not(:disabled) {
  background: #3d9bff;
  box-shadow: 0 4px 12px rgba(0, 119, 255, 0.35);
  transform: translateY(-1px);
}

/* Фирменный красный Яндекса: плитка узнаётся без загрузки чужого скрипта. */
.pd-auth-provider--yandex {
  border-color: transparent;
  background: #fc3f1d;
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
}

.pd-auth-provider--yandex:hover:not(:disabled) {
  background: #ff6a4d;
  box-shadow: 0 4px 12px rgba(252, 63, 29, 0.35);
  transform: translateY(-1px);
}

.pd-auth-provider:active:not(:disabled) {
  box-shadow: none;
  transform: translateY(1px);
}

.pd-auth-provider:focus-visible {
  outline: 2px solid #0077ff;
  outline-offset: 2px;
}

/* Разделитель между сервисами и почтой: линия по бокам, слово посередине. */
.pd-auth-or {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 16px 0 4px;
  color: var(--pd-sec-text-secondary);
  font-size: 12px;
  text-transform: lowercase;
}

.pd-auth-or::before,
.pd-auth-or::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--pd-sec-border);
}

.pd-auth-vk-widget {
  min-height: 44px;
}

.pd-auth-vk-widget[hidden],
.pd-auth-vk-loading[hidden],
[data-vk-continue][hidden] {
  display: none !important;
}

.pd-auth-vk-loading {
  margin: 0;
  font-size: 13px;
  color: var(--pd-sec-text-secondary);
}

/* Кнопка остаётся кликабельной и в неактивном виде: нажатие подсказывает, чего не хватает. */
.pd-auth-btn.is-inactive {
  opacity: 0.55;
}
