.auth-page { background: #fafbfe; }
.auth-shell { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); max-width: 1800px; margin: 0 auto; padding: 20px; gap: 20px; }
.auth-story { position: relative; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; padding: 42px clamp(32px, 4.5vw, 80px) 30px; border: 1px solid #29304e; border-radius: 24px; background: radial-gradient(ellipse at 90% 85%, #36377980, transparent 60%), #171c35; color: #fff; }
.auth-story::before { content: ""; position: absolute; inset: 0; background-image: radial-gradient(#a8afd526 1px, transparent 1px); background-size: 24px 24px; mask-image: linear-gradient(transparent 10%, #000 100%); pointer-events: none; }
.auth-story > * { position: relative; }
.auth-brand { display: flex; align-items: center; gap: 12px; font-size: 20px; font-weight: 650; letter-spacing: -.035em; }
.auth-brand-icon { display: grid; place-items: center; width: 42px; height: 44px; border: 1px solid #ffffff29; border-radius: 13px; background: #ffffff0d; color: #c0baff; }
.auth-story-content { padding: 58px 0 44px; max-width: 510px; }
.auth-eyebrow { margin: 0 0 22px; color: #b1abcf; font-size: 10px; font-weight: 600; letter-spacing: .17em; }
.auth-story h2 { margin: 0; font-size: clamp(36px, 3.6vw, 58px); font-weight: 550; line-height: 1.12; letter-spacing: -.055em; }
.auth-story h2 span { color: #b9adff; }
.auth-story-description { max-width: 350px; margin: 24px 0 0; color: #b3b8cf; font-size: 15px; line-height: 1.8; }
.auth-illustration { position: relative; height: 210px; margin: 30px -8px 12px; }
.auth-orbit { position: absolute; left: 50%; top: 50%; border: 1px solid #a89cf51a; border-radius: 50%; transform: translate(-50%, -50%); }
.auth-orbit-outer { width: 236px; height: 236px; }
.auth-orbit-inner { width: 172px; height: 172px; background: #9d8bff05; }
.auth-connections { position: absolute; width: 100%; height: 100%; color: #8e81cb; }
.auth-node { position: absolute; top: 50%; display: grid; place-items: center; width: 64px; height: 64px; border: 1px solid #ffffff24; border-radius: 18px; background: #272d49; transform: translate(-50%, -50%); color: #c4c9e5; box-shadow: 0 10px 30px #090d2026; }
.auth-node > svg { width: 27px; height: 27px; }
.auth-node > span { position: absolute; top: calc(100% + 12px); color: #b3b8cf; font-size: 11px; white-space: nowrap; }
.auth-node-database { left: 15%; }
.auth-node-cloud { left: 85%; }
.auth-node-guard { left: 50%; width: 90px; height: 100px; border-radius: 26px; background: linear-gradient(145deg, #8071de, #5143a3); border-color: #bfb0ff80; color: #f4efff; box-shadow: 0 0 50px #8d76f526, inset 0 1px #ffffff30; }
.auth-node-guard > svg { width: 44px; height: 44px; }
.auth-story-features { display: flex; flex-wrap: wrap; gap: 12px 18px; color: #c5c8dc; font-size: 11px; }
.auth-story-features span::before { content: ""; display: inline-block; width: 4px; height: 4px; margin: 0 7px 2px 0; border-radius: 50%; background: #a99be9; }
.auth-story-footer { margin: 0; color: #969dbb; font-size: 11px; }
.auth-workspace { display: flex; flex-direction: column; justify-content: space-between; align-items: center; min-width: 0; padding: 30px clamp(24px, 4vw, 64px) 14px; }
.auth-workspace-top { display: flex; justify-content: space-between; align-items: center; gap: 16px; width: 100%; color: #686f82; font-size: 9px; font-weight: 600; letter-spacing: .13em; }
.auth-access-label { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 400; letter-spacing: 0; }
.auth-card { width: 380px; max-width: 100%; margin: 60px 0; }
.auth-heading { margin-bottom: 32px; }
.auth-heading-icon { display: grid; place-items: center; width: 52px; height: 52px; margin-bottom: 24px; border: 1px solid #e6e3fb; border-radius: 16px; background: #eeecfa; color: #6b59bf; box-shadow: 0 3px 5px #251f4b04; }
.auth-heading h1 { margin: 0; font-size: 34px; font-weight: 650; line-height: 1.25; letter-spacing: -.045em; color: #20243b; }
.auth-heading p { margin: 10px 0 0; color: #686f82; font-size: 14px; line-height: 1.65; }
.auth-form { gap: 22px; }
.auth-field { min-width: 0; }
.auth-field label { margin: 0 0 9px; color: #34394e; font-weight: 600; font-size: 12px; }
.auth-field input { width: 100%; min-height: 50px; margin: 0; border: 1px solid #dfe2eb; border-radius: 9px; background: #fff; color: #272b40; font-size: 14px; padding: 13px 15px; transition: border-color .15s, box-shadow .15s; }
.auth-field input::placeholder { color: #686f82; opacity: 1; }
.auth-field input:hover { border-color: #b9b5d1; }
.auth-field input:focus { border-color: #8a78d0; outline: none; box-shadow: 0 0 0 3px #7660c712; }
.auth-field .password-field { position: relative; display: block; }
.auth-field .password-field input { width: 100%; padding-right: 66px; }
.auth-field .password-toggle { position: absolute; top: 3px; right: 3px; margin: 0; min-width: 48px; min-height: 44px; padding: 7px 10px; border: 0; border-radius: 6px; color: #6b6288; font-size: 11px; font-weight: 600; }
.auth-field .password-toggle:hover { background: #f2effa; color: #56429a; }
.auth-field .password-toggle:focus-visible { outline-offset: -2px; }
.auth-form .auth-submit { position: relative; width: 100%; min-height: 50px; margin: 4px 0 0; align-self: stretch; border: 1px solid #6553b4; border-radius: 9px; background: #6c58bd; box-shadow: 0 3px 5px #45317c14, inset 0 1px #ffffff17; font-size: 13px; font-weight: 600; transition: background .15s, box-shadow .15s; }
.auth-form .auth-submit::after { content: "\2192"; position: absolute; right: 17px; font-size: 19px; font-weight: 400; }
.auth-form .auth-submit:hover { background: #5d48ad; box-shadow: 0 4px 10px #45317c24; }
.auth-form .auth-submit:disabled::after { content: ""; width: 14px; height: 14px; border: 2px solid #ffffff50; border-top-color: #fff; border-radius: 50%; animation: auth-spin .8s linear infinite; }
.auth-form .auth-submit:disabled { opacity: .75; }
.auth-hint { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.auth-caps { margin: 8px 0 0; color: var(--warn); font-size: 12px; }
.auth-support { padding-top: 26px; margin: 30px 0 0; border-top: 1px solid #e7e8ef; text-align: center; color: #686f82; font-size: 12px; line-height: 1.9; }
.auth-support span { color: #51566d; }
.auth-footer { margin: 0; color: #686f82; font-size: 10px; text-align: center; line-height: 1.8; }
.auth-footer span { margin: 0 7px; }
.auth-back { color: #6c58bd; text-align: center; font-size: 13px; font-weight: 500; text-underline-offset: 3px; }
.auth-setup-note { padding: 12px 14px; border: 1px solid #e6e3f1; background: #f2f0f9; border-radius: 9px; color: var(--text-dim); font-size: 12px; overflow-wrap: anywhere; }
.auth-field .auth-code { text-align: center; letter-spacing: .3em; font-size: 22px; font-variant-numeric: tabular-nums; }
.auth-card .alert { align-items: flex-start; font-size: 13px; padding: 12px; }
.auth-card .alert > svg { margin-top: 3px; }
.auth-card .alert-dismiss { min-width: 24px; min-height: 24px; }
@keyframes auth-spin { to { transform: rotate(360deg); } }
@media (min-width: 1600px) { .auth-story-content { max-width: 540px; } }
@media (max-width: 1050px) {
  .auth-shell { padding: 14px; gap: 0; }
  .auth-story { padding: 32px; }
  .auth-workspace { padding: 22px 32px 12px; }
  .auth-access-label { display: none; }
  .auth-story h2 { font-size: 40px; }
  .auth-story-features { gap: 10px; }
}
@media (max-width: 760px) {
  .auth-shell { display: flex; flex-direction: column; padding: 0; }
  .auth-story { display: block; padding: 23px 26px; border: 0; border-radius: 0; background: #171c35; overflow: visible; }
  .auth-story::before, .auth-story-content, .auth-story-footer { display: none; }
  .auth-brand { font-size: 18px; }
  .auth-brand-icon { width: 36px; height: 38px; border-radius: 11px; }
  .auth-workspace { flex: 1; width: 100%; padding: 28px 26px 20px; }
  .auth-workspace-top { max-width: 400px; }
  .auth-access-label { display: flex; }
  .auth-card { width: 400px; margin: 42px 0; }
  .auth-heading h1 { font-size: 30px; }
  .auth-field input { font-size: 16px; }
}
@media (max-width: 360px) {
  .auth-workspace { padding-right: 20px; padding-left: 20px; }
  .auth-workspace-top { font-size: 8px; gap: 8px; }
  .auth-access-label { font-size: 10px; }
  .auth-form .auth-submit { padding-right: 36px; }
}
/* Motion: staggered entrance, a living illustration (orbits turning, data
   flowing database → guard → offsite), and small feedback cues. All of it
   is switched off for prefers-reduced-motion below. */
@keyframes auth-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes auth-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes auth-orbit-turn { to { transform: translate(-50%, -50%) rotate(360deg); } }
@keyframes auth-float { 50% { transform: translate(-50%, calc(-50% - 6px)); } }
@keyframes auth-pulse { from { opacity: .55; transform: scale(1); } to { opacity: 0; transform: scale(1.55); } }
@keyframes auth-flow { to { stroke-dashoffset: -22; } }
@keyframes auth-blink { 50% { opacity: .35; } }
@keyframes auth-shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
@keyframes auth-shine { from { transform: translateX(-120%) skewX(-20deg); } to { transform: translateX(220%) skewX(-20deg); } }

.auth-brand, .auth-story-footer { animation: auth-fade .7s ease-out both; }
.auth-eyebrow, .auth-story h2, .auth-story-description, .auth-illustration, .auth-story-features { animation: auth-rise .7s cubic-bezier(.2, .7, .2, 1) both; }
.auth-story h2 { animation-delay: .08s; }
.auth-story-description { animation-delay: .16s; }
.auth-illustration { animation-delay: .24s; }
.auth-story-features { animation-delay: .32s; }
.auth-workspace-top, .auth-footer { animation: auth-fade .6s ease-out .1s both; }
.auth-heading, .auth-form > *, .auth-support, .auth-card > [id='loginError'] { animation: auth-rise .55s cubic-bezier(.2, .7, .2, 1) both; }
.auth-heading { animation-delay: .1s; }
.auth-card > [id='loginError'] { animation-delay: .15s; }
.auth-form > :nth-child(1) { animation-delay: .18s; }
.auth-form > :nth-child(2) { animation-delay: .24s; }
.auth-form > :nth-child(3) { animation-delay: .3s; }
.auth-form > :nth-child(4) { animation-delay: .36s; }
.auth-form > :nth-child(5) { animation-delay: .42s; }
.auth-support { animation-delay: .46s; }
.auth-card .alert { animation: auth-shake .45s ease-in-out .7s both; }

.auth-orbit-outer { border-style: dashed; border-color: #a89cf530; animation: auth-orbit-turn 40s linear infinite; }
.auth-orbit-inner { animation: auth-orbit-turn 26s linear infinite reverse; }
.auth-orbit::before { content: ""; position: absolute; top: -4px; left: 50%; width: 7px; height: 7px; margin-left: -3.5px; border-radius: 50%; background: #b9adff; box-shadow: 0 0 10px #b9adff; }
.auth-orbit-inner::before { top: auto; bottom: -3px; width: 5px; height: 5px; background: #8e81cb; }
.auth-node-database, .auth-node-cloud { animation: auth-float 5s ease-in-out infinite; }
.auth-node-cloud { animation-delay: -2.5s; }
.auth-node-guard { animation: auth-float 4s ease-in-out infinite; }
.auth-node-guard::after { content: ""; position: absolute; inset: -1px; border: 1px solid #bfb0ff; border-radius: inherit; animation: auth-pulse 2.4s ease-out infinite; pointer-events: none; }
.auth-node { z-index: 2; }
.auth-story-features span::before { animation: auth-blink 2.4s ease-in-out infinite; }
.auth-story-features span:nth-child(2)::before { animation-delay: .8s; }
.auth-story-features span:nth-child(3)::before { animation-delay: 1.6s; }

.auth-heading-icon { position: relative; overflow: hidden; }
.auth-heading-icon::after { content: ""; position: absolute; inset: 0; width: 40%; background: linear-gradient(90deg, transparent, #ffffffb0, transparent); transform: translateX(-120%) skewX(-20deg); animation: auth-shine 1s ease-in-out .6s both; }
.auth-form .auth-submit::after { transition: transform .2s ease; }
.auth-form .auth-submit:hover:not(:disabled)::after { transform: translateX(4px); }
.auth-form .auth-submit:active:not(:disabled) { transform: translateY(1px); }

/* Backup run scene, driven by login.js through data-phase:
   start → dump → transfer → compress → upload → done, then repeat. */
.auth-file { position: absolute; top: 50%; left: 15%; z-index: 1; display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid #c9bfff80; border-radius: 8px; background: #3a3470; color: #e3ddff; box-shadow: 0 0 16px #9d8bff70; transform: translate(-50%, -50%); opacity: 0; }
.auth-file svg { width: 16px; height: 16px; }
.auth-file-gz, [data-phase='compress'] .auth-file-doc, [data-phase='upload'] .auth-file-doc, [data-phase='done'] .auth-file-doc { display: none; }
[data-phase='compress'] .auth-file-gz, [data-phase='upload'] .auth-file-gz, [data-phase='done'] .auth-file-gz { display: block; }
[data-phase='dump'] .auth-file, [data-phase='transfer'] .auth-file, [data-phase='compress'] .auth-file, [data-phase='upload'] .auth-file { opacity: 1; }
[data-phase='transfer'] .auth-file { left: 50%; transition: left 1.4s cubic-bezier(.45, 0, .25, 1); }
[data-phase='compress'] .auth-file { left: 50%; }
[data-phase='upload'] .auth-file { left: 85%; transition: left 2.2s cubic-bezier(.45, 0, .25, 1); }
[data-phase='done'] .auth-file { left: 85%; transition: opacity .3s; }
.auth-node { transition: border-color .3s, box-shadow .3s, color .3s; }
.auth-node > svg { transition: transform .3s; }
[data-phase='dump'] .auth-node-database { border-color: #b9adff90; color: #fff; box-shadow: 0 0 28px #9d8bff40; }
[data-phase='dump'] .auth-node-database > svg { animation: auth-blink .7s ease-in-out infinite; }
[data-phase='compress'] .auth-node-guard { box-shadow: 0 0 60px #9d8bff70, inset 0 1px #ffffff30; }
[data-phase='compress'] .auth-node-guard > svg { transform: scale(.88); }
[data-phase='done'] .auth-node-cloud { border-color: #4ade8080; color: #d1fae5; box-shadow: 0 0 30px #22c55e30; }
.auth-node > .auth-badge { position: absolute; top: -8px; right: -8px; display: grid; place-items: center; width: 22px; height: 22px; border: 2px solid #171c35; border-radius: 50%; color: #fff; transform: scale(0); transition: transform .3s cubic-bezier(.3, 1.6, .5, 1); }
.auth-badge svg { width: 11px; height: 11px; }
.auth-badge-gz { background: #7c6ae0; }
.auth-badge-check { background: #22c55e; }
[data-phase='compress'] .auth-badge-gz, [data-phase='upload'] .auth-badge-gz, [data-phase='done'] .auth-badge-check { transform: scale(1); }
[data-phase='transfer'] .auth-link-in, [data-phase='upload'] .auth-link-out { color: #c9bfff; animation: auth-flow .6s linear infinite; }

@media (prefers-reduced-motion: reduce) {
  .auth-field input, .auth-form .auth-submit, .auth-form .auth-submit::after { transition: none; }
  .auth-page *, .auth-page *::before, .auth-page *::after { animation: none !important; }
}
