/* ============================================================
   Стили экранов входа (телефон/код) и подписки (paywall)
   ============================================================ */
.auth-screen {
  display: none;
  align-items: center;
  justify-content: flex-start;   /* контент от верха вниз — длинные формы не уезжают за экран */
  min-height: 100vh;
  /* Длинные формы (регистрация/подписка) должны прокручиваться, а не обрезаться */
  max-height: 100vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 24px 18px calc(32px + var(--safe-bottom, 0px));
  padding-top: calc(24px + var(--safe-top, 0px));
  background: linear-gradient(160deg, #f2f5f9 0%, #e8edf3 100%);
}
/* active — flex-колонка: карточка сверху, доступен полный скролл до низа */
.auth-screen.active { display: flex; flex-direction: column; }
@supports (height: 100dvh) {
  .auth-screen { min-height: 100dvh; max-height: 100dvh; }
}

.auth-card {
  width: 100%;
  max-width: 400px;
  /* Прижимаем к верху и центрируем по горизонтали.
     margin-top:auto/bottom:auto убрано — длинный контент (подписка) больше
     не обрезается сверху и не уезжает за кнопки Telegram в fullscreen. */
  margin: 0 auto;
  flex-shrink: 0;
  background: #fff;
  border-radius: 22px;
  padding: 32px 24px 26px;
  box-shadow: 0 12px 40px rgba(33, 45, 64, .12);
  text-align: center;
}
.auth-card .app-logo-img { width: 78px; height: 78px; border-radius: 20px; object-fit: cover; margin-bottom: 12px; }
.auth-card .app-title { font-size: 26px; font-weight: 800; color: #212d40; margin: 0 0 4px; }
.auth-card .app-subtitle { font-size: 14px; color: #7a8798; margin: 0 0 22px; }

.auth-label {
  display: block; text-align: left; font-size: 13px; font-weight: 600;
  color: #55637a; margin: 14px 4px 6px;
}
.auth-input {
  width: 100%; box-sizing: border-box; height: 52px;
  border: 1.5px solid #dde3ec; border-radius: 14px;
  padding: 0 16px; font-size: 17px; color: #212d40; outline: none;
  transition: border-color .15s; background: #fff;
}
.auth-input:focus { border-color: #3b82f6; }
.auth-code-input { text-align: center; letter-spacing: 8px; font-size: 24px; font-weight: 700; }

.btn-auth {
  width: 100%; height: 52px; margin-top: 18px;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff; border: none; border-radius: 14px;
  font-size: 16px; font-weight: 700; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .1s, opacity .15s;
}
.btn-auth:active { transform: scale(.98); }
.btn-auth:disabled { opacity: .6; cursor: default; }
.btn-auth.loading { opacity: .7; }

.btn-auth-ghost {
  width: 100%; height: 44px; margin-top: 10px;
  background: transparent; color: #7a8798; border: none;
  font-size: 14px; cursor: pointer;
}
.auth-hint { font-size: 13px; color: #8a96a6; margin-top: 16px; }
.auth-hint .fa-telegram { color: #29a9eb; }

/* -------- Экран согласия на обработку ПД (152-ФЗ), единый для TG и веба -------- */
.consent-intro {
  display: flex; align-items: flex-start; gap: 12px;
  margin: 18px 2px 20px; padding: 14px 16px;
  background: #f4f8ff; border: 1px solid #dbeafe; border-radius: 14px;
  text-align: left;
}
.consent-intro-ico { color: #3b82f6; font-size: 20px; margin-top: 2px; flex: 0 0 auto; }
.consent-intro p { margin: 0; font-size: 14px; line-height: 1.45; color: #55637a; }
.consent-legal {
  margin: 14px 4px 0; font-size: 12px; line-height: 1.5; color: #8a96a6; text-align: center;
}
.consent-legal a { color: #3b82f6; text-decoration: none; font-weight: 600; }
.consent-legal a:hover { text-decoration: underline; }

.auth-dev-hint {
  margin-top: 12px; padding: 10px 12px; border-radius: 12px;
  background: #fff7e6; border: 1px dashed #f0b429;
  color: #8a6d00; font-size: 14px;
}
.auth-dev-hint b { font-size: 18px; letter-spacing: 2px; }

/* Повторная отправка кода */
.auth-resend { margin-top: 14px; text-align: center; min-height: 22px; }
.auth-resend-timer { font-size: 13px; color: #8a96a6; }
.auth-resend-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent; border: none; cursor: pointer;
  color: #3b82f6; font-size: 14px; font-weight: 600; padding: 4px 8px;
}
.auth-resend-btn:hover { text-decoration: underline; }
.auth-resend-btn.loading { opacity: .6; pointer-events: none; }

/* -------- Paywall -------- */
.paywall-card { max-width: 440px; text-align: center; }
.paywall-status { margin-bottom: 14px; }

/* Блок «Я оплатил — проверить доступ» (появляется после ухода на оплату) */
.paywall-after-pay {
  margin: 18px 0 8px; padding: 16px; border-radius: 14px;
  background: #eef6ff; border: 1px solid #cbe4ff; text-align: left;
}
.paywall-after-pay[hidden] { display: none; }
.paywall-after-pay-hint {
  margin: 0 0 12px; font-size: 14px; line-height: 1.5; color: #2b5e8f;
}
.paywall-after-pay-hint i { margin-right: 6px; color: #2f80ed; }
.paywall-after-pay .btn-auth { margin: 0; width: 100%; }
.paywall-warn {
  background: #fff3e6; border: 1px solid #ffcf99; color: #b25b00;
  padding: 12px; border-radius: 12px; font-size: 14px; font-weight: 600;
}
.paywall-locked {
  background: #f4f6f9; border: 1px solid #e2e8f0; color: #55637a;
  padding: 18px; border-radius: 14px; font-size: 15px; line-height: 1.5;
}
.paywall-locked .fa-lock { font-size: 22px; color: #94a3b8; display: block; margin-bottom: 8px; }

.paywall-plans { display: flex; flex-direction: column; gap: 14px; margin-top: 6px; }
.plan-card {
  border: 1.5px solid #e2e8f0; border-radius: 18px; padding: 18px 16px;
  text-align: left; position: relative; background: #fff;
}
.plan-promo { border-color: #f0b429; background: linear-gradient(180deg, #fffdf5, #fff8e6); }
.plan-badge {
  position: absolute; top: -10px; right: 16px;
  background: #f0b429; color: #fff; font-size: 11px; font-weight: 700;
  padding: 3px 10px; border-radius: 20px; text-transform: uppercase;
}
.plan-title { font-size: 17px; font-weight: 800; color: #212d40; }
.plan-sub { font-size: 13px; color: #7a8798; margin-top: 2px; }
.plan-price { font-size: 24px; font-weight: 800; color: #2563eb; margin: 10px 0; }
.plan-price span { font-size: 13px; font-weight: 500; color: #7a8798; }

.plan-periods { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.btn-period {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 10px 6px; border: 1.5px solid #dde3ec; border-radius: 12px;
  background: #f8fafc; cursor: pointer; transition: border-color .15s, background .15s;
}
.btn-period:hover { border-color: #3b82f6; background: #eff6ff; }
.pp-price { font-size: 16px; font-weight: 800; color: #212d40; }
.pp-label { font-size: 11px; color: #7a8798; }

.btn-pay {
  width: 100%; margin-top: 12px; height: 46px;
  background: linear-gradient(135deg, #f0b429, #e0961a); color: #fff;
  border: none; border-radius: 12px; font-size: 15px; font-weight: 700; cursor: pointer;
}
.btn-pay:active { transform: scale(.98); }

.plan-custom {
  margin-top: 16px; padding: 12px; border-radius: 12px;
  background: #f4f6f9; color: #55637a; font-size: 13px; line-height: 1.5;
}
.plan-custom .fa-briefcase { color: #64748b; margin-right: 4px; }
.plan-custom-clickable {
  display: flex; align-items: center; gap: 10px; text-align: left;
  cursor: pointer; transition: background .15s; -webkit-tap-highlight-color: transparent;
}
.plan-custom-clickable:active { background: #e9edf3; }
.plan-custom-clickable .fa-briefcase { font-size: 18px; margin-right: 0; flex-shrink: 0; }
.plan-custom-text { display: flex; flex-direction: column; gap: 2px; }
.plan-custom-text b { color: #334155; font-size: 13px; }
.plan-custom-text span { color: #64748b; font-size: 12px; }
.plan-custom-text .fa-telegram { color: #229ed9; }

/* Ссылка «Вход для администратора» */
.auth-admin-link { margin-top: 18px; text-align: center; }
.auth-admin-link a {
  font-size: 13px; color: #94a3b8; text-decoration: none;
  border-bottom: 1px dashed #cbd5e1; padding-bottom: 1px;
}
.auth-admin-link a:hover { color: #64748b; }

/* Ссылка «Уже пользуетесь? Войти» под кнопками выбора роли */
.auth-login-link {
  margin-top: 22px; padding-top: 18px;
  border-top: 1px solid #eef2f7;
  text-align: center; font-size: 14px; color: #8a96a6;
}
.auth-login-link a {
  margin-left: 6px; font-weight: 700; color: #1f9bf0;
  text-decoration: none;
}
.auth-login-link a:hover { color: #0a6fcf; text-decoration: underline; }

/* ===== Панель тестировщика (dev-switcher) ===== */
#dev-switcher {
  position: fixed; left: 8px; bottom: 8px; z-index: 99999;
  background: rgba(17,24,39,.92); color: #fff; border-radius: 12px;
  padding: 8px 10px; box-shadow: 0 6px 24px rgba(0,0,0,.35);
  font-size: 12px; backdrop-filter: blur(6px); max-width: calc(100vw - 16px);
}
#dev-switcher .ds-title { font-weight: 700; margin-bottom: 6px; opacity: .9;
  display: flex; align-items: center; justify-content: space-between; white-space: nowrap; }
#dev-switcher .ds-title-text { white-space: nowrap; }
#dev-switcher .ds-row { display: flex; gap: 6px; flex-wrap: wrap; }
#dev-switcher .ds-btn {
  border: 1px solid rgba(255,255,255,.25); background: rgba(255,255,255,.08);
  color: #fff; border-radius: 8px; padding: 6px 9px; font-size: 12px; cursor: pointer;
  transition: background .15s, border-color .15s;
}
#dev-switcher .ds-btn:hover:not(:disabled) { background: rgba(255,255,255,.18); }
#dev-switcher .ds-btn.ds-active { background: #2563eb; border-color: #2563eb; font-weight: 700; }
#dev-switcher .ds-btn:disabled { opacity: .35; cursor: not-allowed; }
#dev-switcher .ds-hint { margin-top: 6px; opacity: .6; font-size: 10px; line-height: 1.3; max-width: 220px; }

/* ===== Поле телефона с фиксированным префиксом +7 ===== */
.phone-field {
  display: flex; align-items: stretch; gap: 0;
  border: 1.5px solid #dde3ec; border-radius: 12px; overflow: hidden;
  background: #fff; transition: border-color .15s;
}
.phone-field:focus-within { border-color: #3b82f6; }
.phone-prefix {
  display: flex; align-items: center; justify-content: center;
  padding: 0 12px; font-size: 16px; font-weight: 700; color: #212d40;
  background: #f4f6f9; border-right: 1.5px solid #dde3ec; user-select: none;
}
.phone-field .phone-input {
  flex: 1; border: none !important; border-radius: 0 !important;
  margin: 0 !important; background: transparent !important; box-shadow: none !important;
  font-size: 16px; letter-spacing: .5px;
}
.phone-field .phone-input:focus { outline: none; }

/* -------- Выбор роли (владелец / сотрудник) -------- */
.role-choose { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.role-btn {
  display: flex; align-items: center; gap: 14px; width: 100%;
  padding: 16px; background: #fff; border: 1.5px solid #dde3ec;
  border-radius: 16px; cursor: pointer; text-align: left;
  transition: border-color .15s, transform .1s, box-shadow .15s;
}
.role-btn:hover { border-color: #3b82f6; box-shadow: 0 4px 16px rgba(59,130,246,.12); }
.role-btn:active { transform: scale(.99); }
.role-ico {
  flex: 0 0 48px; width: 48px; height: 48px; border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #3b82f6, #2563eb); color: #fff; font-size: 20px;
}
.role-ico-2 { background: linear-gradient(135deg, #7b59e0, #6039c9); }
.role-txt { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.role-txt b { font-size: 16px; color: #212d40; font-weight: 700; }
.role-txt small { font-size: 12.5px; color: #7a8798; line-height: 1.35; }
.role-arrow { color: #c3cddb; font-size: 14px; }

/* Регистрация: карточка чуть шире и с прокруткой на маленьких экранах */
#screen-register .auth-card { max-width: 440px; text-align: center; }
#screen-register .auth-input { height: 48px; font-size: 16px; }
