/*
 * Окна входа ARM366 v2: тёмно-синий фон с медленными светящимися лентами фирменных
 * цветов, матовое стекло со срезанным углом, синяя кнопка со свечением. Смена шага —
 * как в образце: карточка складывается в стеклянную фигуру с логотипом и раскрывается
 * новой формой. Один файл для сайта, панели и страниц восстановления доступа.
 */
@property --a2-cut { syntax: "<length>"; inherits: true; initial-value: 46px; }
body.auth2 {
  --a2-accent: #4b9bff; --a2-accent-2: #63e2ea; --a2-blue: #146fe8; --a2-mint: #40d2a1;
  --a2-ink: #eef4fb; --a2-muted: #9fb3c9; --a2-faint: #6f86a0;
  --a2-glass: rgba(8, 22, 42, .55); --a2-line: rgba(160, 200, 255, .14); --a2-field: rgba(255, 255, 255, .045); --a2-field-line: rgba(160, 200, 255, .14);
  --a2-red: #ff8a7f; --a2-cut: 46px;
  margin: 0; min-height: 100vh; background: #030a15; color: var(--a2-ink); overflow-x: hidden;
  font-family: "Manrope", "Segoe UI", system-ui, -apple-system, sans-serif; -webkit-font-smoothing: antialiased;
}
body.auth2 * { box-sizing: border-box; }
.auth2-silk { position: fixed; inset: 0; width: 100%; height: 100%; display: block; z-index: 0; filter: blur(2px) saturate(115%); transform: scale(1.02); }
.auth2-vignette { position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background: radial-gradient(ellipse 62% 58% at 50% 50%, rgba(3, 10, 21, .05), rgba(3, 10, 21, .8) 100%); }
.auth2-stage { position: relative; z-index: 2; min-height: 100vh; display: grid; place-items: center; padding: 40px 16px; }
.auth2-brand { position: fixed; top: 22px; left: 26px; z-index: 3; display: flex; align-items: center; gap: 10px; color: var(--a2-ink); text-decoration: none; font-weight: 700; letter-spacing: -.01em; }
.auth2-brand img { width: 34px; height: 34px; border-radius: 10px; }
.auth2-brand small { display: block; font-weight: 500; font-size: 11.5px; color: var(--a2-muted); }

/* ---------- Карточка ---------- */
.auth2-wrap { position: relative; width: min(440px, 100%); }
.auth2-card { position: relative; padding: 38px 34px 26px; background: var(--a2-glass); color: var(--a2-ink);
  -webkit-backdrop-filter: blur(24px) saturate(150%); backdrop-filter: blur(24px) saturate(150%);
  clip-path: polygon(var(--a2-cut) 0, 100% 0, 100% calc(100% - 34px), calc(100% - 34px) 100%, 0 100%, 0 var(--a2-cut));
  box-shadow: 0 40px 90px rgba(0, 0, 0, .45);
  transition: height .7s cubic-bezier(.22, .9, .25, 1), --a2-cut .7s cubic-bezier(.22, .9, .25, 1), transform .7s cubic-bezier(.22, .9, .25, 1); overflow: hidden; }
.auth2-card::before { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(160deg, rgba(160, 200, 255, .09), rgba(160, 200, 255, 0) 40%, rgba(99, 226, 234, .04) 100%); }
/* Сложенная карточка: большой срез углов, как стеклянная плитка в образце */
.auth2-card.is-folded { --a2-cut: 110px; transform: scale(.965); }
.auth2-frame { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; overflow: visible; }
.auth2-frame path { fill: none; stroke: rgba(160, 200, 255, .2); stroke-width: 1; vector-effect: non-scaling-stroke; }
.auth2-corner { position: absolute; top: -10px; left: -12px; width: 52px; height: 52px; z-index: 2; pointer-events: none;
  background: rgba(14, 34, 62, .7); border: 1px solid rgba(160, 200, 255, .2); border-radius: 10px;
  clip-path: polygon(0 0, 100% 0, 0 100%); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  transition: transform .7s cubic-bezier(.22, .9, .25, 1), opacity .5s; }
.auth2-corner.br { top: auto; left: auto; right: -10px; bottom: -10px; width: 38px; height: 38px; clip-path: polygon(100% 0, 100% 100%, 0 100%); }
.auth2-wrap.is-folded .auth2-corner { transform: translate(18px, 18px); opacity: .35; }
.auth2-wrap.is-folded .auth2-corner.br { transform: translate(-14px, -14px); }

.auth2-content { position: relative; z-index: 2; display: grid; gap: 16px; transition: opacity .45s ease, filter .45s ease, transform .45s ease; }
.auth2-content.is-out { opacity: 0; filter: blur(12px); transform: scale(.98); }
.auth2-eyebrow { margin: 0 0 6px; font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--a2-faint); }
.auth2-title { margin: 0; font-size: 30px; line-height: 1.08; font-weight: 800; letter-spacing: -.03em; color: #fff; text-wrap: balance; }
.auth2-title em { font-style: normal; background: linear-gradient(100deg, #8cc2ff, var(--a2-accent) 40%, var(--a2-accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth2-sub { margin: -8px 0 2px; color: var(--a2-muted); font-size: 13.5px; line-height: 1.5; }

/* ---------- Поля ---------- */
.auth2-field { display: grid; gap: 7px; font-size: 12.5px; font-weight: 600; color: #c9d8ea; }
.auth2-input { position: relative; display: flex; align-items: center; }
.auth2-input > svg { position: absolute; left: 13px; width: 16px; height: 16px; color: var(--a2-faint); pointer-events: none; transition: color .3s; }
.auth2-field input { width: 100%; height: 46px; padding: 0 44px 0 40px; border-radius: 11px; border: 1px solid var(--a2-field-line); background: var(--a2-field);
  color: #fff; font: 500 14.5px/1 sans-serif; font-family: inherit; outline: none; transition: border-color .3s, box-shadow .3s, background .3s; }
.auth2-field input::placeholder { color: #587089; }
.auth2-field input:focus { border-color: rgba(75, 155, 255, .6); background: rgba(255, 255, 255, .06); box-shadow: 0 0 0 4px rgba(75, 155, 255, .13); }
.auth2-input:focus-within > svg { color: var(--a2-accent); }
.auth2-field input:-webkit-autofill { -webkit-text-fill-color: #fff; transition: background-color 9999s; box-shadow: inset 0 0 0 40px #0c1c31; }
.auth2-eye { position: absolute; right: 8px; width: 32px; height: 32px; border: 0; border-radius: 8px; background: none; color: var(--a2-faint); cursor: pointer; display: grid; place-items: center; }
.auth2-eye:hover { color: #fff; background: rgba(255, 255, 255, .06); }
.auth2-eye svg { width: 17px; height: 17px; }
.auth2-field.invalid input { border-color: rgba(255, 138, 127, .7); box-shadow: 0 0 0 4px rgba(255, 138, 127, .1); }
.auth2-hint { font-size: 12px; font-weight: 500; color: var(--a2-red); }
.auth2-hint:empty { display: none; }
.auth2-code input { text-align: center; letter-spacing: .5em; font-size: 22px; font-weight: 700; padding: 0 12px; }
.auth2-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--a2-muted); }
.auth2-link { background: none; border: 0; padding: 0; color: #c9d8ea; font: 600 13px/1.2 sans-serif; font-family: inherit; cursor: pointer; text-decoration: none; transition: color .25s; }
.auth2-link:hover, .auth2-link:focus-visible { color: var(--a2-accent-2); outline: none; }
.auth2-link.gold, .auth2-link.accent { color: var(--a2-accent); }

/* ---------- Кнопки ---------- */
.auth2-primary { position: relative; height: 48px; border: 0; border-radius: 11px; cursor: pointer; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: linear-gradient(180deg, #3d8bff, #146fe8 60%, #0f5fcc); color: #fff; font: 800 15px/1 sans-serif; font-family: inherit; letter-spacing: -.005em;
  box-shadow: 0 12px 34px rgba(20, 111, 232, .35), inset 0 1px 0 rgba(255, 255, 255, .3); transition: transform .2s, box-shadow .4s, filter .3s; }
.auth2-primary::after { content: ""; position: absolute; top: 0; bottom: 0; width: 45%; left: -70%; background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .28), transparent); transform: skewX(-20deg); }
.auth2-primary:hover { box-shadow: 0 16px 44px rgba(20, 111, 232, .5), 0 0 0 1px rgba(99, 226, 234, .25), inset 0 1px 0 rgba(255, 255, 255, .3); }
.auth2-primary:hover::after { animation: a2-shine 1.6s ease; }
.auth2-primary:active { transform: translateY(1px) scale(.995); }
.auth2-primary:disabled { filter: saturate(.5) brightness(.8); cursor: default; }
.auth2-primary .arrow { transition: transform .3s; }
.auth2-primary:hover .arrow { transform: translateX(3px); }
.auth2-primary.is-loading .label::after { content: ""; display: inline-block; width: 14px; height: 14px; margin-left: 8px; vertical-align: -2px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .35); border-top-color: #fff; animation: a2-spin .9s linear infinite; }
.auth2-secondary { height: 44px; border-radius: 11px; border: 1px solid var(--a2-field-line); background: var(--a2-field); color: #dce8f5; font: 600 14px/1 sans-serif; font-family: inherit; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: border-color .3s, background .3s; }
.auth2-secondary:hover { border-color: rgba(160, 200, 255, .3); background: rgba(255, 255, 255, .07); }
.auth2-divider { display: flex; align-items: center; gap: 12px; color: var(--a2-faint); font-size: 10.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.auth2-divider::before, .auth2-divider::after { content: ""; flex: 1; height: 1px; background: var(--a2-line); }
.auth2-foot { margin: 0; text-align: center; font-size: 12.5px; color: var(--a2-faint); line-height: 1.5; }

/* ---------- Сообщения ---------- */
.auth2-error { display: none; grid-template-columns: 26px 1fr; gap: 10px; padding: 12px; border-radius: 12px; background: rgba(255, 138, 127, .08); border: 1px solid rgba(255, 138, 127, .28); color: #ffdcd7; font-size: 13px; }
.auth2-error.show { display: grid; animation: a2-in .5s ease; }
.auth2-error .icon { width: 26px; height: 26px; border-radius: 50%; background: rgba(255, 138, 127, .2); color: var(--a2-red); display: grid; place-items: center; font-weight: 800; }
.auth2-error strong { display: block; color: #fff; }
.auth2-error p, .auth2-error small { margin: 2px 0 0; display: block; color: #ecc8c2; }
.auth2-error code { display: block; margin-top: 4px; font-size: 11px; color: #b99791; }
.auth2-ok { padding: 12px; border-radius: 12px; background: rgba(75, 155, 255, .08); border: 1px solid rgba(75, 155, 255, .25); color: #d6e6f8; font-size: 13px; line-height: 1.55; }

/* ---------- Логотип в сложенной карточке ---------- */
.auth2-morph { position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; pointer-events: none; opacity: 0; transition: opacity .5s ease; }
.auth2-morph.is-on { opacity: 1; }
.auth2-tile { width: 84px; height: 84px; border-radius: 22px; display: grid; place-items: center; position: relative;
  background: linear-gradient(145deg, rgba(160, 200, 255, .16), rgba(160, 200, 255, .03)); border: 1px solid rgba(160, 200, 255, .28);
  box-shadow: 0 20px 50px rgba(0, 0, 0, .45), 0 0 40px rgba(75, 155, 255, .18), inset 0 1px 0 rgba(255, 255, 255, .2);
  transform: scale(.8) rotate(-6deg); transition: transform .8s cubic-bezier(.22, 1.2, .3, 1); }
.auth2-morph.is-on .auth2-tile { transform: scale(1) rotate(0); }
.auth2-tile::after { content: ""; position: absolute; left: 14px; right: 14px; top: 50%; height: 1.5px; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .55), transparent); transform: rotate(-45deg); }
.auth2-tile img { width: 44px; height: 44px; border-radius: 12px; opacity: .95; }

.auth2-steps { display: flex; gap: 6px; justify-content: center; }
.auth2-steps i { width: 6px; height: 6px; border-radius: 99px; background: rgba(160, 200, 255, .2); transition: width .5s, background .5s; }
.auth2-steps i.on { width: 20px; background: var(--a2-accent); }
[data-auth2-step][hidden] { display: none !important; }

@keyframes a2-shine { to { left: 140%; } }
@keyframes a2-spin { to { transform: rotate(360deg); } }
@keyframes a2-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

@media (max-width: 520px) {
  .auth2-card { padding: 32px 22px 22px; --a2-cut: 34px; }
  .auth2-card.is-folded { --a2-cut: 80px; }
  .auth2-title { font-size: 26px; }
  .auth2-brand { top: 14px; left: 16px; }
  .auth2-stage { padding-top: 76px; }
}
@media (prefers-reduced-motion: reduce) {
  .auth2-content, .auth2-morph, .auth2-tile, .auth2-card, .auth2-corner { transition: none; }
  .auth2-silk { filter: blur(2px); }
}
/* v141: на телефоне декоративные уголки не прижимаются к краю экрана */
@media (max-width: 520px) {
  .auth2-stage { padding-left: 22px; padding-right: 22px; }
  .auth2-corner { left: -8px; top: -8px; width: 40px; height: 40px; }
  .auth2-corner.br { right: -8px; bottom: -8px; width: 30px; height: 30px; }
}
.auth2-eyebrow { font-size: 12px; }
