/* Стили страниц авторизации (register/login/pending/lk_index).
   Все цвета и шрифты — только через переменные из tokens.css. */

.auth-card {
  max-width: 460px;
  margin: 24px auto;
  padding: 22px 24px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(10, 14, 26, 0.04);
}

.auth-card--wide {
  max-width: 880px;
}

.auth-title {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.2px;
}

.auth-lead {
  margin: 0 0 14px;
  font-size: 12.5px;
  color: var(--mute);
  line-height: 1.4;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.auth-field label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-soft);
  letter-spacing: 0.1px;
}

.auth-req {
  color: var(--bad);
}

.auth-field input,
.auth-field textarea {
  height: 34px;
  padding: 0 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--ink);
  font: inherit;
  font-size: 13.5px;
}

.auth-field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(67, 56, 202, 0.15);
}

.auth-help {
  font-size: 11.5px;
  color: var(--mute);
}

.auth-error {
  font-size: 12.5px;
  color: var(--bad);
}

.auth-error--block {
  padding: 8px 10px;
  background: var(--bad-soft);
  border-radius: 6px;
  margin-bottom: 4px;
}

.auth-submit {
  height: 40px;
  margin-top: 6px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s;
}

.auth-submit:hover {
  background: var(--accent-hover);
}

.auth-submit--secondary {
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--border);
}

.auth-submit--secondary:hover {
  background: var(--bg-alt);
}

.auth-logout-form {
  margin-top: 24px;
}

.auth-footer {
  margin: 18px 0 0;
  font-size: 13px;
  color: var(--mute);
}

.auth-footer a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.auth-footer a:hover {
  text-decoration: underline;
}

.auth-summary {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 8px 14px;
  margin: 0 0 10px;
}

.auth-summary dt {
  font-size: 12.5px;
  color: var(--mute);
  font-weight: 500;
}

.auth-summary dd {
  margin: 0;
  font-size: 14px;
  color: var(--ink);
}

.auth-summary .mono {
  font-family: var(--font-mono);
}

/* ───── Блочная вёрстка формы (стиль checkout) ───── */
.auth-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}
.auth-block:first-of-type { margin-top: 4px; }

.auth-block-title {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.2px;
}

.auth-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 12px;
  align-items: start;
}
.auth-grid--cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.auth-field--full  { grid-column: 1 / -1; }

/* ───── Компактные табы Физлицо | Юрлицо/ИП (стиль checkout) ───── */
.entity-tabs {
  display: inline-flex;
  gap: 6px;
  padding: 4px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  width: fit-content;
}
.entity-tab {
  position: relative;
  padding: 6px 16px;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}
.entity-tab input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.entity-tab-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--mute);
}
.entity-tab.is-active {
  background: var(--bg-card);
  box-shadow: 0 1px 2px rgba(10,14,26,0.05);
}
.entity-tab.is-active .entity-tab-label { color: var(--accent); font-weight: 600; }

/* ───── Карточка ИНН с кнопкой и ссылкой ───── */
.inn-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
/* ИНН + кнопка + ссылка: flex, кнопка и ссылка центрируются по высоте
   ИНН-инпута (а не label'а). Ссылка лежит «как чек-лейбл» рядом с кнопкой. */
.inn-card-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 12px;
  align-items: flex-end;
}
.inn-card-row .auth-field {
  flex: 1 1 220px;
  min-width: 200px;
  gap: 4px;
}
.inn-card-row input { font-family: var(--font-mono); }

.lookup-btn {
  height: 34px;
  padding: 0 12px;
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 7px;
  font: inherit;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.lookup-btn:hover:not(:disabled) { background: var(--accent-hover); }
.lookup-btn:disabled { opacity: 0.6; cursor: wait; }

.manual-link {
  font-size: 12.5px;
  color: var(--mute);
  text-decoration: none;
  border-bottom: 1px dashed var(--border-strong);
  padding-bottom: 1px;
  white-space: nowrap;
  cursor: pointer;
  flex-shrink: 0;
  /* высота как у кнопки/инпута, текст центрирован вертикально */
  height: 34px;
  display: inline-flex;
  align-items: center;
}
.manual-link:hover { color: var(--ink-soft); border-color: var(--mute); }

/* Состояния подсказки под ИНН */
.auth-help.is-error { color: var(--bad); }
.auth-help.is-ok    { color: var(--ok); }
.auth-help--muted   { color: var(--mute); font-size: 12px; }

/* dev-only: маленький инструмент для очистки тестового ИНН */
.dev-tools {
  margin: -6px 0 12px;
  padding: 6px 10px;
  background: var(--warn-soft);
  border: 1px dashed var(--warn);
  border-radius: 6px;
  font-size: 12px;
  color: var(--warn);
}
.dev-tools a { color: var(--warn); text-decoration: underline; }
.dev-tools-ok { color: var(--ok); margin-left: 6px; }

/* ───── Глазок «показать/скрыть пароль» ───── */
.password-wrap {
  position: relative;
  display: block;
}
.password-wrap input {
  /* Освобождаем место справа под кнопку. */
  padding-right: 36px;
  width: 100%;
}
.password-toggle {
  position: absolute;
  top: 50%;
  right: 4px;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  padding: 0;
  display: grid;
  place-items: center;
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: var(--mute);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.password-toggle:hover {
  background: var(--bg-alt);
  color: var(--accent);
}
.password-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* ───── Карточка-сводка после успешного DaData lookup ───── */
.party-card {
  background: var(--accent-soft);
  border: 1.5px solid var(--accent);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.party-card[hidden] { display: none; }

.party-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.party-icon {
  width: 32px; height: 32px;
  border-radius: 7px;
  background: var(--accent);
  color: #fff;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.party-meta { flex: 1; min-width: 0; }
.party-name {
  font-size: 14.5px; font-weight: 700;
  color: var(--ink); line-height: 1.25;
}
.party-source {
  margin-top: 2px;
  font-size: 11px;
  color: var(--mute);
  font-family: var(--font-mono);
}
.party-edit {
  flex-shrink: 0;
  align-self: flex-start;
  height: 28px; padding: 0 12px;
  border: 1px solid var(--border-strong);
  background: var(--bg-card);
  color: var(--ink-soft);
  border-radius: 6px;
  font: inherit; font-size: 12px; font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.party-edit:hover {
  background: var(--bg-alt);
  border-color: var(--accent);
  color: var(--accent);
}

.party-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px 14px;
  font-size: 12.5px;
}
.party-grid .pair {
  display: flex; flex-direction: column; gap: 1px;
  min-width: 0;
}
.party-grid .pair[hidden] { display: none; }
.party-grid .pair .k {
  font-size: 10.5px;
  color: var(--mute);
  font-family: var(--font-mono);
}
.party-grid .pair .v {
  color: var(--ink);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.party-grid .pair.full { grid-column: 1 / -1; }
.party-grid .pair.full .v { white-space: normal; }

/* Скрытый блок реквизитов; раскрывается по lookup или клику «вручную» */
.legal-extra {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 12px;
}
.legal-extra[hidden] { display: none; }

/* Контактные поля юрлица. Внутри два .auth-grid (ФИО/Должность/Телефон
   и E-mail+Канал) — даём те же gap и padding-top что у .legal-extra,
   чтобы расстояния между строками были одинаковые независимо от того,
   какой блок их обрамляет. */
.legal-contacts {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 12px;
}
.legal-contacts[hidden] { display: none; }

/* Переключение веток entity_type — JS снимает hidden с нужной */
.entity-pane[hidden] { display: none; }
.entity-pane {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

/* Точки монтирования блока «Канал уведомлений». Сам блок один на форму
   и переносится JS-ом сюда в зависимости от entity_type. */
.notif-mount { display: contents; }
.notif-mount > *:only-child { display: flex; flex-direction: column; }

/* ───── Канал уведомлений (radio + поле контакта) ───── */
/* gap=4px как у соседних .auth-field — лейбл и контрол на той же
   горизонтали что у E-mail для документов рядом по grid'у. */
.notif-channel-field { gap: 4px; }
.notif-channel-row {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 2px 3px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 7px;
  width: fit-content;
  /* Высота как у соседнего input в grid (34px) — чтобы radio-row не
     «прыгал» относительно текстового поля E-mail. */
  height: 34px;
  align-items: center;
  box-sizing: border-box;
}
.notif-channel-opt {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 12.5px;
  color: var(--mute);
  transition: background 0.15s, color 0.15s;
  height: 26px;
  box-sizing: border-box;
}
.notif-channel-opt input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.notif-channel-opt:has(input:checked) {
  background: var(--bg-card);
  color: var(--accent);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(10,14,26,0.05);
}
.notif-contact-field { margin-top: 4px; }
.notif-contact-field input { font-family: var(--font-mono); }
.notif-contact-field[hidden] { display: none; }

/* ───── Статус-бейдж в шапке ЛК ───── */
.auth-status {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-mono);
  letter-spacing: 0.3px;
}
.auth-status--pending  { background: var(--warn-soft); color: var(--warn); }
.auth-status--approved { background: var(--ok-soft);   color: var(--ok); }
.auth-status--blocked  { background: var(--bad-soft);  color: var(--bad); }

/* ── F-3g (v2): seller-CTA в конце формы. Buyer-блоки видны всегда;
   чекбокс лишь раскрывает доп-поля питомника (имя/slug/consent). ── */
.auth-block--seller-cta {
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: 10px;
  padding: 12px 16px;
}
.auth-seller-toggle {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1.45;
}
.auth-seller-toggle input[type="checkbox"] {
  margin-top: 3px;
  flex: 0 0 auto;
}
.auth-seller-toggle strong {
  color: var(--accent);
  display: block;
  margin-bottom: 2px;
}
/* Доп-поля питомника развёрнуты только когда чекбокс включён. */
.auth-seller-fields { margin-top: 14px; }
.auth-form:not(.is-seller-mode) .auth-seller-fields { display: none; }
.auth-slug-row {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding-left: 10px;
}
.auth-slug-row .auth-slug-prefix {
  color: var(--mute);
  font-family: var(--font-mono);
  font-size: 13px;
}
.auth-slug-row input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 8px 10px 8px 4px;
}
.auth-slug-row input:focus { outline: none; }
