/* ============ Qarz — авторизация (современный минимализм) ============ */

.auth { background: var(--paper); min-height: 100dvh; }

.auth-wrap {
  min-height: 100dvh;
  max-width: 440px; margin: 0 auto;
  padding: calc(14px + var(--safe-t)) 22px calc(28px + var(--safe-b));
  display: flex; flex-direction: column;
}

/* ---------- верхняя панель ---------- */
.auth-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }

/* переключатель темы */
.theme-switch { display: flex; gap: 2px; padding: 3px; background: var(--paper-2); border-radius: 13px; }
.theme-switch button {
  width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center; color: var(--ink-3);
  transition: background .15s, color .15s;
}
.theme-switch button svg { width: 18px; height: 18px; }
.theme-switch button.on { background: var(--paper); color: var(--green); box-shadow: var(--sh-1); }
.theme-switch button:active { transform: scale(.92); }

/* переключатель языка */
.lang-pick { position: relative; }
.lang-pick > summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; gap: 7px;
  height: 42px; padding: 0 13px; border-radius: 13px;
  background: var(--paper-2); font-size: .875rem; font-weight: 600;
}
.lang-pick > summary::-webkit-details-marker { display: none; }
.lang-pick > summary svg { width: 15px; height: 15px; color: var(--ink-3); }
.lang-pick > summary span { max-width: 96px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lang-pick[open] > summary { background: var(--paper-3); }
.lang-pick__menu {
  position: absolute; right: 0; top: 50px; z-index: 30;
  width: 218px; max-height: 62dvh; overflow-y: auto;
  background: var(--paper); border-radius: 16px;
  box-shadow: var(--sh-pop); padding: 6px;
}
[dir="rtl"] .lang-pick__menu { right: auto; left: 0; }
.lang-pick__menu a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 11px; border-radius: 11px; font-size: .9375rem; font-weight: 550;
}
.lang-pick__menu a:active { background: var(--paper-2); }
.lang-pick__menu a.on { background: var(--green-t); color: var(--green-ink); font-weight: 700; }

/* ---------- контент ---------- */
/* верхняя панель — у верха экрана; карточка центрируется в остатке места */
.auth-card { display: flex; flex-direction: column; margin: auto 0; }
.auth-brand { display: flex; justify-content: center; margin: 4px 0 26px; }
.auth-brand svg { width: 56px; height: 56px; border-radius: 16px; box-shadow: var(--sh-2); }

.auth-h { font-size: 1.6rem; font-weight: 820; letter-spacing: -.03em; line-height: 1.15; text-align: center; }
.auth-sub { font-size: .95rem; color: var(--ink-2); margin: 9px 0 24px; line-height: 1.5; text-align: center; }
.auth-sub b { color: var(--ink); font-weight: 700; }

.field__label { display: block; font-size: .8rem; font-weight: 600; color: var(--ink-2); margin-bottom: 8px; }

/* ---------- поле телефона ---------- */
.phone-box {
  display: flex; align-items: center;
  background: var(--paper-2); border: 1.6px solid transparent;
  border-radius: 14px; overflow: hidden; transition: border-color .15s, background .15s;
}
.phone-box:focus-within { border-color: var(--green); background: var(--paper); }
.phone-box__inp {
  flex: 1; min-width: 0; border: 0; background: none;
  height: 58px; padding: 0 16px; font-size: 1.0625rem; letter-spacing: .02em;
}
.phone-box__inp:focus { outline: none; }

/* ---------- селектор с флагом ---------- */
.fsel { position: relative; }
.fsel__flag {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 26px; height: 19px; border-radius: 4px; object-fit: cover;
  pointer-events: none; z-index: 1; box-shadow: 0 0 0 1px rgba(0,0,0,.07) inset;
}
[dir="rtl"] .fsel__flag { left: auto; right: 14px; }
.fsel__sel {
  appearance: none; -webkit-appearance: none;
  width: 100%; height: 58px; padding: 0 38px 0 50px;
  background: var(--paper-2); border: 1.6px solid transparent; border-radius: 14px;
  font-size: 1rem; font-weight: 600; transition: border-color .15s, background .15s;
}
[dir="rtl"] .fsel__sel { padding: 0 50px 0 38px; }
.fsel__sel:focus { outline: none; border-color: var(--green); background: var(--paper); }
.fsel__chev {
  position: absolute; right: 13px; top: 50%; transform: translateY(-50%);
  pointer-events: none; color: var(--ink-3); display: flex;
}
[dir="rtl"] .fsel__chev { right: auto; left: 13px; }
.fsel__chev svg { width: 17px; height: 17px; }

/* код страны внутри поля телефона */
.fsel--cc { flex: none; width: 120px; }
.fsel--cc .fsel__sel {
  background: none; border: 0; border-radius: 0; height: 58px;
  border-right: 1.5px solid var(--line); padding: 0 28px 0 47px; font-weight: 650;
}
[dir="rtl"] .fsel--cc .fsel__sel { border-right: 0; border-left: 1.5px solid var(--line); padding: 0 47px 0 28px; }
.fsel--cc .fsel__chev { right: 8px; }
[dir="rtl"] .fsel--cc .fsel__chev { right: auto; left: 8px; }

/* ---------- код из SMS ---------- */
.code-inp {
  width: 100%; text-align: center; font-size: 1.9rem; font-weight: 800;
  letter-spacing: .4em; height: 66px; padding-inline: 10px;
  background: var(--paper-2); border: 1.6px solid transparent; border-radius: 14px;
}
.code-inp::placeholder { letter-spacing: .3em; color: var(--ink-3); }
.code-inp:focus { outline: none; border-color: var(--green); background: var(--paper); }

/* ---------- сообщения, ссылки ---------- */
.auth-err {
  margin-top: 12px; padding: 11px 14px;
  background: var(--debt-t); color: var(--debt-ink);
  border-radius: 12px; font-size: .85rem; font-weight: 600; text-align: center;
}
.auth-link {
  display: block; width: 100%; text-align: center;
  margin-top: 16px; padding: 8px; font-size: .9rem; font-weight: 650; color: var(--green);
}
.auth-link[disabled] { color: var(--ink-3); pointer-events: none; }
.auth-link--inline { display: inline; width: auto; margin: 0; padding: 0; font-size: inherit; }

.auth-fine { margin-top: 18px; font-size: .78rem; color: var(--ink-3); text-align: center; line-height: 1.55; }
.auth-fine--tight { margin-top: 7px; }

.dev-hint {
  margin-top: 12px; padding: 11px 14px;
  background: var(--warn-t); border: 1.5px dashed var(--warn);
  border-radius: 12px; font-size: .8rem; text-align: center; color: var(--ink);
}
.dev-hint b { font-weight: 800; font-size: 1.05rem; letter-spacing: .08em; }

.auth-card .btn { margin-top: 20px; }
.field { margin-bottom: 14px; }

/* индикатор «режим сотрудника» */
.auth-card.is-staff .auth-h { color: var(--ink); }

/* загрузка кнопки */
.btn { position: relative; }
.btn.is-loading { pointer-events: none; }
.btn.is-loading span { opacity: .35; }
.btn.is-loading::after {
  content: ""; position: absolute;
  width: 20px; height: 20px; border-radius: 50%;
  border: 2.5px solid rgba(255,255,255,.4); border-top-color: #fff;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.step { animation: fade .25s var(--ease); }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } }
