.auth-body { background: #fff; }
.auth { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); min-height: 100vh; }

/* ---------- Form side ---------- */
.auth-side {
  position: relative; display: flex; flex-direction: column; gap: 32px; padding: 24px 40px;
  background:
    radial-gradient(60% 45% at 50% 0%, rgba(11, 107, 255, .07), transparent 70%),
    #f7f8fb;
}
.auth-side::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(rgba(16, 24, 48, .07) 1px, transparent 1.4px); background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(55% 50% at 50% 45%, #000, transparent);
  mask-image: radial-gradient(55% 50% at 50% 45%, #000, transparent);
}
.auth-top, .auth-card, .auth-foot { position: relative; }
.auth-top { display: flex; align-items: center; justify-content: space-between; }
.auth-back {
  display: inline-flex; align-items: center; gap: 4px; padding: 7px 12px 7px 8px; border-radius: 100px;
  font-size: 13.5px; font-weight: 600; color: #4a4e5c; transition: background .15s, color .15s;
}
.auth-back:hover { background: #eceef3; color: var(--ink); }
.auth-back svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

.auth-card {
  width: 100%; max-width: 400px; margin: auto;
}
.auth-card h1 { font-size: 28px; font-weight: 800; letter-spacing: -.03em; line-height: 1.15; }
.auth-panel > h1,
.auth-panel > .auth-sub { text-align: center; }
.auth-sub { color: var(--muted); font-size: 15px; line-height: 1.5; margin-top: 6px; }

.auth-tabs {
  position: relative; display: grid; grid-template-columns: 1fr 1fr; padding: 4px; margin-bottom: 26px;
  background: #e9ebf1; border-radius: 100px;
}
.auth-tabs a {
  position: relative; z-index: 1; text-align: center; padding: 9px 0; border-radius: 100px;
  font-size: 14px; font-weight: 700; color: #6b6f7e; transition: color .2s;
}
.auth-tabs a:hover { color: var(--ink); }
.auth-tabs a.active { color: var(--ink); }
.auth-tabs-pill {
  position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px); border-radius: 100px;
  background: #fff; box-shadow: 0 1px 2px rgba(16, 24, 48, .08), 0 4px 10px -4px rgba(16, 24, 48, .15);
  transition: transform .42s cubic-bezier(.34, 1.15, .64, 1);
}
.auth-tabs.is-signup .auth-tabs-pill { transform: translateX(100%); }

.auth-panel-wrap { position: relative; }
.auth-panel { transform-origin: center top; will-change: transform, opacity, filter; }
.auth-panel.is-switching-out {
  animation: authPanelOut .32s cubic-bezier(.4, 0, 1, 1) forwards;
}
.auth-panel.is-switching-in {
  animation: authPanelIn .48s cubic-bezier(.2, .85, .25, 1) forwards;
}
@keyframes authPanelOut {
  to { opacity: 0; transform: translateX(calc(var(--auth-dir, 1) * -20px)) scale(.985); filter: blur(3px); }
}
@keyframes authPanelIn {
  from { opacity: 0; transform: translateX(calc(var(--auth-dir, 1) * 22px)) scale(.985); filter: blur(3px); }
  to { opacity: 1; transform: none; filter: none; }
}
.auth-panel.is-switching-in > * {
  animation: authItemIn .55s cubic-bezier(.2, .85, .25, 1) backwards;
}
.auth-panel.is-switching-in > h1 { animation-delay: .04s; }
.auth-panel.is-switching-in > .auth-sub { animation-delay: .07s; }
.auth-panel.is-switching-in > .auth-google { animation-delay: .1s; }
.auth-panel.is-switching-in > .auth-divider { animation-delay: .13s; }
.auth-panel.is-switching-in > .auth-form { animation-delay: .16s; }
.auth-panel.is-switching-in > .auth-legal { animation-delay: .2s; }
@keyframes authItemIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.auth-art-inner { transition: opacity .28s ease, transform .28s ease; }
.auth-art-inner.is-switching-out { opacity: 0; transform: translateY(6px); }
.auth-art-inner.is-switching-in { animation: authArtIn .5s cubic-bezier(.2, .85, .25, 1) .06s backwards; }
@keyframes authArtIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.auth-google,
.auth-submit {
  transition: transform .22s cubic-bezier(.2, .8, .2, 1), box-shadow .22s ease, background-color .18s ease, border-color .18s ease;
}
.auth-google {
  position: relative;
  width: 100%; margin-top: 24px; display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 12px; border: 1.5px solid var(--line); border-radius: 100px; background: #fff;
  font-size: 15px; font-weight: 700; color: #1b1d26;
}
.auth-google:hover:not(:disabled) { border-color: #cfd3dd; background: #fafbfc; box-shadow: 0 6px 16px -10px rgba(16, 24, 48, .3); }
@media (hover: hover) and (pointer: fine) {
  .auth-google:hover:not(:disabled):not(.is-loading),
  .auth-submit:hover:not(:disabled):not(.loading) {
    transform: translateY(-3px);
    box-shadow: 0 10px 24px -10px rgba(16, 24, 48, .35);
  }
}
.auth-google:active:not(:disabled):not(.is-loading),
.auth-submit:active:not(:disabled):not(.loading) {
  transform: translateY(0) scale(.97);
  box-shadow: none;
  transition-duration: .1s;
}
.auth-google:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
.auth-google svg { width: 19px; height: 19px; }
.auth-google.is-loading { cursor: progress; animation: authButtonPress .22s ease-out; }
.auth-google-spinner { display: none; }
.auth-google.is-loading .auth-google-spinner {
  display: block; position: absolute; right: 18px; width: 16px; height: 16px;
  border: 2px solid color-mix(in srgb, currentColor 20%, transparent);
  border-top-color: currentColor; border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes authButtonPress {
  from { transform: scale(.97); }
  to { transform: scale(1); }
}

.auth-divider { display: flex; align-items: center; gap: 14px; margin: 22px 0; color: #9a9eae; font-size: 12.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.auth-form { display: flex; flex-direction: column; gap: 16px; }
.field label { display: block; font-size: 13.5px; font-weight: 700; color: #1b1d26; margin-bottom: 7px; }
.field-row { display: flex; justify-content: space-between; align-items: baseline; }
.field-link { font-size: 13px; font-weight: 600; color: var(--blue); }
.field-link:hover { text-decoration: underline; }

.input { position: relative; }
.input > svg {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; pointer-events: none;
  fill: none; stroke: #9a9eae; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: stroke .15s;
}
.input input {
  width: 100%; font: inherit; font-size: 15px; color: var(--ink);
  padding: 12px 14px 12px 42px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff;
  outline: none; transition: border-color .15s, box-shadow .15s, background .15s;
}
.input input::placeholder { color: #a6aab8; }
.input input:hover { border-color: #d6d9e2; }
.input input:focus { border-color: var(--blue); background: #fff; box-shadow: 0 0 0 4px rgba(11, 107, 255, .12); }
.input:focus-within > svg { stroke: var(--blue); }
.input input.invalid { border-color: #e5484d; background: #fff; box-shadow: 0 0 0 4px rgba(229, 72, 77, .1); }

.pw input { padding-right: 46px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; color: #8a8fa3; }
.pw-toggle:hover { background: #f1f2f6; color: #1b1d26; }
.pw-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.pw-toggle .eye-off, .pw.shown .pw-toggle .eye { display: none; }
.pw.shown .pw-toggle .eye-off { display: block; }

.pw-meter { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; margin-top: 8px; }
.pw-meter i { height: 4px; border-radius: 2px; background: #eceef3; transition: background .2s; }
.pw-meter[data-score="1"] i:nth-child(-n+1) { background: #e5484d; }
.pw-meter[data-score="2"] i:nth-child(-n+2) { background: #f59e0b; }
.pw-meter[data-score="3"] i:nth-child(-n+3) { background: #22c55e; }
.pw-meter[data-score="4"] i { background: #16a34a; }

.auth-error { display: none; font-size: 13.5px; font-weight: 600; color: #c4262c; background: #fff1f1; border: 1px solid #ffd7d8; padding: 10px 12px; border-radius: 10px; }
.auth-error.show { display: block; }

.auth-submit { margin-top: 4px; position: relative; gap: 8px; }
.auth-submit:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
.auth-submit svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s; }
.auth-submit:hover:not(:disabled) svg { transform: translateX(3px); }
.auth-submit:disabled { opacity: .85; cursor: progress; transform: none; }
.auth-submit.loading { padding-inline: 42px; animation: authButtonPress .22s ease-out; }
.auth-submit.loading svg { display: none; }
.auth-submit.loading::after {
  content: ""; position: absolute; right: 18px; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid color-mix(in srgb, currentColor 20%, transparent);
  border-top-color: currentColor; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.auth-success { display: none; text-align: center; padding: 12px 0; }
.auth-card.done .auth-main { display: none; }
.auth-card.done .auth-success { display: block; animation: successIn .5s cubic-bezier(.2,.7,.2,1); }
.auth-success-ico { width: 64px; height: 64px; margin: 0 auto 22px; border-radius: 50%; display: grid; place-items: center; background: #eafaf0; box-shadow: 0 0 0 8px #f4fcf7; }
.auth-success-ico svg { width: 30px; height: 30px; fill: none; stroke: #16a34a; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.auth-success .btn { margin-top: 28px; }
@keyframes successIn { from { opacity: 0; transform: translateY(12px); } }

.auth-legal { margin-top: 16px; font-size: 12.5px; color: #8a8fa3; text-align: center; line-height: 1.5; }
.auth-legal a { color: #1b1d26; text-decoration: underline; }

.auth-foot { display: flex; justify-content: space-between; font-size: 13px; color: #9a9eae; }
.auth-foot span:last-child { display: flex; gap: 16px; }
.auth-foot a:hover { color: var(--ink); }

/* ---------- Password recovery ---------- */
.auth-recovery-icon {
  display: grid; place-items: center; width: 56px; height: 56px; margin: 0 auto 24px;
  border: 1px solid var(--line); border-radius: 16px;
  background: color-mix(in srgb, var(--blue) 8%, transparent); color: var(--blue);
}
.auth-recovery-icon svg { width: 26px; height: 26px; }
.auth-recovery-form { margin-top: 28px; }
.auth-recovery-form[hidden], .auth-recovery-notice[hidden] { display: none; }
.auth-recovery-notice {
  margin-top: 22px; padding: 14px 16px; border: 1px solid #b9dfcc; border-radius: 10px;
  background: #edf9f2; color: #176b48; font-size: 14px; line-height: 1.6;
}
.auth-recovery-hint { margin-top: 20px; color: var(--muted); font-size: 13px; line-height: 1.6; text-align: center; }
.auth-recovery-hint a { color: var(--blue); font-weight: 600; }
.auth-recovery-back { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 24px; color: var(--muted); font-size: 14px; font-weight: 600; }
.auth-recovery-back:hover { color: var(--ink); }
.auth-recovery-back svg { width: 16px; height: 16px; }
html[data-theme="dark"] .auth-recovery-notice { background: rgba(16, 185, 129, .1); border-color: rgba(16, 185, 129, .3); color: #6ee7b7; }

/* ---------- Brand side ---------- */
.auth-art { position: relative; overflow: hidden; margin: 12px; border-radius: var(--radius-xl); display: flex; align-items: center; justify-content: center; padding: 48px; color: #fff; }
.auth-art::before {
  content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,.2) 1px, transparent 1.4px); background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(70% 70% at 50% 40%, #000, transparent);
  mask-image: radial-gradient(70% 70% at 50% 40%, #000, transparent);
}
.auth-art-inner { position: relative; width: 100%; max-width: 440px; }
.auth-art h2 { font-size: clamp(28px, 2.6vw, 38px); font-weight: 800; letter-spacing: -.03em; line-height: 1.12; }
.auth-points { list-style: none; margin-top: 22px; display: grid; gap: 11px; }
.auth-points li { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 500; color: rgba(255,255,255,.92); }
.auth-points li::before {
  content: ""; flex: none; width: 20px; height: 20px; border-radius: 50%;
  background: rgba(255,255,255,.18) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12 5 5 9-10'/%3E%3C/svg%3E") center / 12px no-repeat;
}

.auth-stat { margin-top: 32px; padding: 18px; border-radius: 18px; box-shadow: 0 0 0 1px rgba(255,255,255,.5), 0 30px 60px -24px rgba(4, 22, 70, .6); }
.auth-stat-head { display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.auth-stat-head span { font-weight: 800; color: #16a34a; background: #eafaf0; padding: 3px 8px; border-radius: 100px; font-size: 11.5px; }
.auth-stat svg { display: block; width: 100%; height: 60px; margin: 12px 0 14px; }
.auth-stat path { fill: none; stroke: #22c55e; stroke-width: 2.5; stroke-linecap: round; stroke-dasharray: 300; stroke-dashoffset: 300; animation: draw 2s ease .3s forwards; }
.auth-stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.auth-stat-row div { background: #f7f8fb; border-radius: 10px; padding: 8px 10px; }
.auth-stat-row small { display: block; font-size: 9.5px; font-weight: 700; color: #8a8fa3; text-transform: uppercase; letter-spacing: .06em; }
.auth-stat-row b { font-size: 15px; }

.auth-quote { margin-top: 24px; padding: 18px; border-radius: 18px; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.22); backdrop-filter: blur(6px); }
.auth-quote blockquote { font-size: 14.5px; line-height: 1.55; }
.auth-quote figcaption { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.auth-quote img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
.auth-quote b { display: block; font-size: 13.5px; }
.auth-quote small { font-size: 12px; color: rgba(255,255,255,.75); }

/* Mobile inline promo (mini side panel) */
.auth-art-mobile { display: none; }

@media (max-width: 960px) {
  .auth { grid-template-columns: 1fr; min-height: 100dvh; }
  .auth-art { display: none; }

  .auth-art-mobile {
    display: block; flex-shrink: 0; position: relative; overflow: hidden;
    margin: 4px 0 0; padding: 18px 16px 16px; border-radius: 20px; color: #fff;
    transition: opacity .28s ease, transform .28s ease;
  }
  .auth-art-mobile::before {
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background-image: radial-gradient(rgba(255,255,255,.2) 1px, transparent 1.4px); background-size: 18px 18px;
    -webkit-mask-image: radial-gradient(85% 80% at 50% 30%, #000, transparent);
    mask-image: radial-gradient(85% 80% at 50% 30%, #000, transparent);
  }
  .auth-art-mobile > * { position: relative; }
  .auth-art-mobile h2 {
    font-size: 17px; font-weight: 800; letter-spacing: -.02em; line-height: 1.3; text-align: center;
  }
  .auth-art-mobile .auth-points { margin-top: 12px; gap: 7px; }
  .auth-art-mobile .auth-points li { font-size: 12.5px; gap: 8px; }
  .auth-art-mobile .auth-points li::before { width: 17px; height: 17px; background-size: 10px; }
  .auth-art-mobile .auth-stat { margin-top: 14px; padding: 12px; border-radius: 14px; }
  .auth-art-mobile .auth-stat-head { font-size: 12px; }
  .auth-art-mobile .auth-stat-head span { font-size: 10.5px; padding: 2px 7px; }
  .auth-art-mobile .auth-stat svg { height: 40px; margin: 8px 0 10px; }
  .auth-art-mobile .auth-stat-row b { font-size: 13px; }
  .auth-art-mobile .auth-stat-row div { padding: 6px 8px; }
  .auth-art-mobile .auth-quote {
    margin-top: 12px; padding: 12px; border-radius: 14px;
  }
  .auth-art-mobile .auth-quote blockquote { font-size: 12.5px; line-height: 1.45; }
  .auth-art-mobile .auth-quote figcaption { margin-top: 10px; gap: 8px; }
  .auth-art-mobile .auth-quote img { width: 32px; height: 32px; }
  .auth-art-mobile .auth-quote b { font-size: 12.5px; }
  .auth-art-mobile .auth-quote small { font-size: 11px; }
  .auth-art-mobile.is-switching-out { opacity: 0; transform: translateY(6px); }
  .auth-art-mobile.is-switching-in { animation: authArtIn .45s cubic-bezier(.2, .85, .25, 1) .04s backwards; }
  .auth-card.done ~ .auth-art-mobile { display: none; }

  .auth-side {
    min-height: 100dvh;
    gap: 0;
    padding:
      max(12px, env(safe-area-inset-top))
      max(20px, env(safe-area-inset-right))
      max(16px, env(safe-area-inset-bottom))
      max(20px, env(safe-area-inset-left));
  }
  .auth-side::before { opacity: .65; }

  .auth-top { flex-shrink: 0; padding-bottom: 4px; }
  .auth-back {
    font-size: 0; padding: 0; width: 44px; height: 44px;
    justify-content: center; border-radius: 12px;
  }
  .auth-back svg { width: 20px; height: 20px; }

  .auth-card {
    flex: 0 1 auto; display: flex; flex-direction: column; justify-content: flex-start;
    max-width: none; width: 100%; margin: 0; padding: 12px 0 16px;
  }
  .auth-card.done { justify-content: flex-start; padding-top: 28px; }

  .auth-tabs { margin-bottom: 20px; padding: 5px; }
  .auth-tabs a { padding: 12px 0; font-size: 15px; min-height: 44px; display: flex; align-items: center; justify-content: center; }
  .auth-tabs-pill { top: 5px; bottom: 5px; left: 5px; width: calc(50% - 5px); }

  .auth-card h1 { font-size: 26px; }
  .auth-sub { font-size: 14.5px; margin-top: 8px; }

  .auth-google { margin-top: 22px; min-height: 48px; padding: 13px 16px; font-size: 15px; }
  .auth-divider { margin: 20px 0; }
  .auth-form { gap: 14px; }
  .input input {
    padding: 14px 14px 14px 42px; font-size: 16px; /* avoids iOS zoom on focus */
  }
  .pw-toggle { width: 44px; height: 44px; right: 4px; }
  .auth-submit { min-height: 50px; font-size: 16px; }
  .field-link { padding: 4px 0; min-height: 28px; display: inline-flex; align-items: center; }

  .auth-foot {
    flex-shrink: 0; margin-top: auto; width: 100%;
    flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between;
    gap: 10px 16px; padding-top: 16px;
  }
  .auth-foot span:last-child { gap: 14px; }

  .auth-panel.is-switching-out { animation-duration: .24s; }
  .auth-panel.is-switching-in { animation-duration: .36s; }
  .auth-panel.is-switching-in > * { animation-duration: .4s; }
  @keyframes authPanelOut {
    to { opacity: 0; transform: translateX(calc(var(--auth-dir, 1) * -12px)) scale(.99); filter: blur(2px); }
  }
  @keyframes authPanelIn {
    from { opacity: 0; transform: translateX(calc(var(--auth-dir, 1) * 14px)) scale(.99); filter: blur(2px); }
    to { opacity: 1; transform: none; filter: none; }
  }
}

@media (max-width: 400px) {
  .auth-side {
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }
  .auth-card h1 { font-size: 24px; }
  .auth-foot { font-size: 12px; justify-content: center; text-align: center; }
  .auth-foot span:last-child { width: 100%; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  .auth-google,
  .auth-submit,
  .auth-submit svg { transition: none; }
  .auth-google:hover:not(:disabled):not(.is-loading),
  .auth-submit:hover:not(:disabled):not(.loading),
  .auth-google:active:not(:disabled):not(.is-loading),
  .auth-submit:active:not(:disabled):not(.loading),
  .auth-submit:hover:not(:disabled) svg { transform: none; }
  .auth-google.is-loading,
  .auth-google.is-loading .auth-google-spinner,
  .auth-submit.loading,
  .auth-submit.loading::after { animation: none; }
  .auth-tabs-pill,
  .auth-art-inner { transition: none; }
  .auth-panel.is-switching-out,
  .auth-panel.is-switching-in,
  .auth-panel.is-switching-in > *,
  .auth-art-inner.is-switching-in,
  .auth-art-mobile.is-switching-in { animation: none !important; }
}
