:root {
  --purple: #8214e6;
  --purple-dark: #6510c4;
  --text: #111116;
  --muted: #5c5d67;
  --line: #dedee4;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, ui-sans-serif, system-ui, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; min-height: 0; overflow: hidden; }
body { margin: 0; min-width: 320px; background: #fbf9ff; }
button, a { font: inherit; }
a { color: var(--purple); text-decoration: none; }
[hidden] { display: none !important; }

.shell {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
  display: grid;
  grid-template-rows: clamp(76px, 12vh, 116px) minmax(0, 1fr) clamp(58px, 10vh, 97px);
  background: #fff url('/static/authentication/assets/aurora-page-background.png') center / cover no-repeat;
}

main { min-width: 0; min-height: 0; overflow: hidden; }
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  padding: 0 clamp(28px, 3.15vw, 48px);
  font-size: clamp(18px, 1.5vw, 23px);
  letter-spacing: -.02em;
}
.header > strong { min-width: 0; overflow: hidden; font-weight: 720; text-overflow: ellipsis; white-space: nowrap; }
.brand { display: block; width: clamp(190px, 16.93vw, 260px); line-height: 0; }
.brand img { display: block; width: 100%; height: auto; }

.footer {
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 clamp(28px, 4.15vw, 64px);
  font-size: clamp(13px, 1.05vw, 16px);
}
.footer > :last-child { justify-self: end; }
.footer span { display: flex; align-items: center; gap: 11px; white-space: nowrap; }
.footer svg { width: 21px; height: 21px; fill: none; stroke: var(--purple); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.login-view {
  --horizontal-bias: clamp(0px, calc((100vw - 1160px) * .255), 95px);
  width: 100%;
  height: 100%;
  min-height: 0;
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(390px, 500px) minmax(420px, 580px);
  justify-content: center;
  align-items: center;
  gap: clamp(46px, 4.17vw, 64px);
  padding: clamp(14px, 3vh, 29px) clamp(28px, 4vw, 64px);
}
.instructions { width: min(100%, 500px); min-width: 0; transform: translate(var(--horizontal-bias), 21px); }
.sign-in-label {
  margin: 0 0 12px;
  color: var(--purple);
  font-size: 12px;
  font-weight: 760;
  letter-spacing: .12em;
  line-height: 1;
  text-transform: uppercase;
}
.instructions h1 { margin: 0; font-size: clamp(39px, 3.35vw, 51px); font-weight: 770; line-height: 1.04; letter-spacing: -.035em; white-space: nowrap; }
.instructions > .sign-in-copy { margin: 16px 0 27px; color: var(--muted); font-size: clamp(17px, 1.28vw, 19px); line-height: 1.45; }
.steps { list-style: none; margin: 0; padding: 0 0 26px; display: grid; gap: 18px; border-bottom: 1px solid var(--line); }
.steps li { position: relative; display: flex; align-items: center; gap: 15px; min-height: 42px; }
.steps li:not(:last-child)::after { content: ""; position: absolute; left: 18px; top: 38px; width: 1px; height: 22px; background: linear-gradient(var(--purple), rgba(130, 20, 230, .1)); }
.step-number { flex: 0 0 auto; width: 37px; height: 37px; display: grid; place-items: center; border: 1px solid rgba(130, 20, 230, .55); border-radius: 50%; color: var(--purple); background: rgba(255, 255, 255, .48); font-size: 15px; font-weight: 650; box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .36); }
.step-copy { min-width: 0; display: grid; gap: 2px; }
.step-copy strong { color: var(--text); font-size: clamp(16px, 1.15vw, 18px); font-weight: 660; line-height: 1.18; }
.step-copy small { color: #777681; font-size: 12.5px; line-height: 1.25; }
.scan-instruction { display: flex; align-items: center; gap: 7px; }
.scan-icon { width: 27px; height: 27px; display: grid; place-items: center; border: 1px solid rgba(130, 20, 230, .18); border-radius: 8px; color: var(--purple); background: rgba(130, 20, 230, .07); }
.scan-icon svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.browser-line { width: fit-content; max-width: 100%; min-height: 40px; display: flex; align-items: center; gap: 11px; margin: 18px 0 15px; padding: 8px 13px; border: 1px solid rgba(130, 20, 230, .12); border-radius: 12px; background: rgba(255, 255, 255, .58); color: #33333a; font-size: 14px; backdrop-filter: blur(12px); }
.browser-line svg, .open-button svg { flex: 0 0 auto; width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.browser-line svg { width: 20px; height: 20px; color: var(--purple); }
.open-button {
  width: min(100%, 360px);
  min-height: 52px;
  padding: 0 25px;
  border: 1px solid rgba(255, 255, 255, .72);
  border-radius: 14px;
  background: linear-gradient(108deg, #7011d4 0%, #8614e8 50%, #991af0 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 630;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2), 0 8px 22px rgba(112, 20, 206, .18);
  transition: transform 150ms ease, box-shadow 150ms ease;
}
.open-button svg { width: 20px; height: 20px; stroke-width: 1.9; }
.open-button:hover { transform: translateY(-1px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .24), 0 11px 26px rgba(112, 20, 206, .23); }
.open-button:focus-visible, button:focus-visible { outline: 3px solid rgba(130, 20, 230, .28); outline-offset: 3px; }
.open-button[aria-disabled="true"] { pointer-events: none; opacity: .68; }

.qr-region {
  --qr-width: min(580px, 37.8vw, calc((100dvh - 280px) * .853));
  width: var(--qr-width);
  min-width: 0;
  text-align: center;
  transform: translate(var(--horizontal-bias), -14px);
}
.qr-shell { width: 100%; aspect-ratio: 580 / 658; position: relative; background: transparent url('/static/authentication/assets/aurora-qr-card.png') center / 100% 100% no-repeat; }
.qr-frame { position: absolute; left: 8.1%; top: 6.4%; width: 83.8%; aspect-ratio: 1; display: grid; place-items: center; overflow: hidden; background: #fff; }
.qr-frame svg { display: block; width: 100%; height: 100%; }
.qr-skeleton { width: 100%; height: 100%; background: #f3f0f5; animation: shimmer 1.5s ease-in-out infinite alternate; }
.refresh-copy { position: absolute; top: 86.6%; left: 7%; width: 86%; font-size: clamp(15px, 1.18vw, 18px); line-height: 1.25; }
.refresh-copy strong { color: var(--purple); }
.progress { position: absolute; left: 8.1%; top: 93.9%; width: 83.8%; height: 4px; background: #e6deec; border-radius: 999px; overflow: hidden; }
.progress span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--purple); transition: width 1s linear; }
.retry-button {
  min-height: 42px;
  margin: 6px auto 0;
  padding: 0 18px;
  border: 1px solid rgba(130, 20, 230, .3);
  border-radius: 12px;
  color: var(--purple-dark);
  background: rgba(255, 255, 255, .82);
  cursor: pointer;
  font-size: 14px;
  font-weight: 650;
}
.retry-button:disabled { cursor: wait; opacity: .62; }
.desktop-open { display: none; }
.mobile-open { display: none; }
.mobile-copy { display: none; }
.passport-panel, .qr-canvas { display: contents; }
.mobile-browser-line, .mobile-steps { display: none; }

.success-view { width: 100%; height: 100%; display: grid; place-items: center; padding: 20px; }
.success-card { width: min(560px, 92vw); max-height: 100%; padding: clamp(24px, 4.2vh, 42px); overflow: hidden; border: 1px solid rgba(130, 20, 230, .16); border-radius: 32px; background: rgba(255, 255, 255, .78); box-shadow: 0 24px 80px rgba(93, 28, 154, .12); backdrop-filter: blur(24px); text-align: center; animation: success-enter 420ms cubic-bezier(.22, .8, .25, 1) both; }
.success-avatar-shell { position: relative; width: 78px; height: 78px; margin: 0 auto 16px; border-radius: 50%; background: rgba(255, 255, 255, .8); box-shadow: 0 13px 34px rgba(112, 20, 206, .18); animation: avatar-reveal 520ms 80ms cubic-bezier(.22, .8, .25, 1) both; }
.success-avatar, .success-avatar-fallback { position: absolute; inset: 0; width: 100%; height: 100%; border: 3px solid rgba(255, 255, 255, .9); border-radius: inherit; }
.success-avatar { display: block; object-fit: cover; background: #f1e7fb; }
.success-avatar-fallback { display: grid; place-items: center; color: #fff; background: linear-gradient(145deg, #a325f4, #6d10d0); font-size: 28px; font-weight: 760; text-transform: uppercase; }
.success-mark { position: absolute; right: -3px; bottom: -2px; width: 27px; height: 27px; display: grid; place-items: center; border: 3px solid #fff; border-radius: 50%; color: #fff; background: linear-gradient(145deg, #a325f4, #6d10d0); box-shadow: 0 6px 14px rgba(112, 20, 206, .25); }
.success-mark svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.eyebrow { margin: 0 0 8px !important; color: var(--purple) !important; font-size: 13px !important; font-weight: 750; letter-spacing: .09em; text-transform: uppercase; }
.success-status { display: block; width: 100%; max-width: none !important; margin: 0 auto 8px !important; text-align: center; }
.success-card h1 { margin: 0 auto; max-width: 500px; font-size: clamp(30px, 3.5vw, 44px); line-height: 1.05; letter-spacing: -.03em; text-wrap: balance; }
.success-card > p { margin: 12px auto 20px; max-width: 410px; color: var(--muted); font-size: 15px; line-height: 1.45; }
.success-card dl { margin: 0 0 20px; padding: 3px 20px; border: 1px solid rgba(130, 20, 230, .12); border-radius: 18px; background: rgba(255,255,255,.64); text-align: left; }
.success-card dl div { display: grid; grid-template-columns: minmax(110px, .8fr) minmax(0, 1.5fr); align-items: center; gap: 20px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.success-card dl div:last-child { border-bottom: 0; }
.success-card dt { color: var(--muted); }
.success-card dd { min-width: 0; margin: 0; overflow: hidden; font-weight: 650; text-align: right; text-overflow: ellipsis; white-space: nowrap; }
.success-card .ramses-id-row dd { overflow: visible; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 12.5px; overflow-wrap: anywhere; text-overflow: clip; white-space: normal; }
.success-card button { min-height: 48px; padding: 0 24px; border: 1px solid rgba(130,20,230,.25); border-radius: 13px; color: var(--purple-dark); background: #fff; cursor: pointer; font-weight: 650; }

@keyframes shimmer { to { opacity: .42; } }
@keyframes qr-enter { from { opacity: 0; transform: translateY(8px) scale(.985); } }
@keyframes success-enter { from { opacity: 0; transform: translateY(10px) scale(.99); } }
@keyframes avatar-reveal { from { opacity: 0; transform: scale(.88); } }

@media (min-width: 981px) {
  .header { padding-inline: 54px; font-size: 20px; }
  .header > * { transform: translateY(10px); }
  .brand { width: 235px; }
}

@media (max-height: 850px) and (min-width: 721px) {
  .instructions, .qr-region { transform: translateX(var(--horizontal-bias)); }
  .instructions h1 { font-size: clamp(36px, 3.25vw, 46px); }
  .sign-in-label { margin-bottom: 8px; }
  .instructions > .sign-in-copy { margin: 10px 0 14px; font-size: 16px; }
  .steps { gap: 8px; padding-bottom: 12px; }
  .steps li { min-height: 36px; }
  .steps li:not(:last-child)::after { left: 16px; top: 33px; height: 13px; }
  .step-number { width: 33px; height: 33px; font-size: 13px; }
  .step-copy strong { font-size: 16px; }
  .step-copy small { font-size: 11px; }
  .scan-icon { width: 24px; height: 24px; }
  .scan-icon svg { width: 15px; height: 15px; }
  .browser-line { min-height: 36px; margin: 10px 0; padding: 6px 11px; font-size: 13px; }
  .open-button { min-height: 48px; font-size: 15px; }
}

@media (max-width: 980px) and (min-width: 721px) {
  .login-view { grid-template-columns: minmax(270px, 1fr) minmax(320px, .95fr); gap: clamp(18px, 2.6vw, 28px); padding-inline: 24px; }
  .instructions, .qr-region { transform: none; }
  .qr-region { --qr-width: min(43vw, calc((100dvh - 230px) * .853)); }
}

@media (max-width: 720px) {
  .shell { grid-template-rows: 58px minmax(0, 1fr) 40px; }
  .header { padding: 0 18px; font-size: clamp(13px, 3.2vw, 16px); }
  .header > strong { max-width: 42vw; }
  .brand { width: clamp(119px, 30vw, 145px); }
  .footer { grid-template-columns: 1fr 1fr; padding: 0 16px; font-size: 9.5px; }
  .footer span { display: none; }

  .login-view {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: clamp(18px, 2.8dvh, 26px);
    padding: 12px 20px 8px;
  }
  .instructions, .qr-region { transform: none; }
  .instructions { flex: 0 0 auto; width: min(100%, 420px); margin: 0 auto; text-align: center; }
  .sign-in-label, .desktop-copy, .desktop-steps, .desktop-browser-line, .desktop-open { display: none; }
  .mobile-copy { display: inline; }
  .instructions h1 { font-size: clamp(29px, 7.8vw, 35px); line-height: 1.04; white-space: normal; }
  .instructions > .sign-in-copy { margin: 9px 0 0; font-size: 12.5px; line-height: 1.3; }

  .qr-region {
    width: min(100%, 420px);
    min-height: 0;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: clamp(18px, 2.5dvh, 24px);
  }
  .passport-panel { display: contents; }
  .mobile-browser-line { display: block; color: #66656f; font-size: 12.5px; line-height: 1; text-align: center; }
  .mobile-browser-line > strong { font-weight: 560; }

  .qr-shell {
    --passport-qr-size: clamp(168px, min(55vw, 25.5dvh), 255px);
    width: 100%;
    aspect-ratio: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(17px, 2.35dvh, 22px);
    background: none;
  }
  .qr-canvas {
    width: calc(var(--passport-qr-size) + 50px);
    height: calc(var(--passport-qr-size) + 50px);
    position: relative;
    display: grid;
    place-items: center;
    padding: 25px;
    border: 1px solid rgba(130, 20, 230, .11);
    border-radius: 22px;
    background:
      linear-gradient(var(--purple), var(--purple)) 8px 8px / 20px 2px no-repeat,
      linear-gradient(var(--purple), var(--purple)) 8px 8px / 2px 20px no-repeat,
      linear-gradient(var(--purple), var(--purple)) right 8px top 8px / 20px 2px no-repeat,
      linear-gradient(var(--purple), var(--purple)) right 8px top 8px / 2px 20px no-repeat,
      linear-gradient(var(--purple), var(--purple)) left 8px bottom 8px / 20px 2px no-repeat,
      linear-gradient(var(--purple), var(--purple)) left 8px bottom 8px / 2px 20px no-repeat,
      linear-gradient(var(--purple), var(--purple)) right 8px bottom 8px / 20px 2px no-repeat,
      linear-gradient(var(--purple), var(--purple)) right 8px bottom 8px / 2px 20px no-repeat,
      rgba(255, 255, 255, .72);
    box-shadow: 0 18px 48px rgba(91, 23, 142, .08);
    animation: qr-enter 430ms cubic-bezier(.22, .8, .25, 1) both;
  }
  .qr-frame { position: relative; left: auto; top: auto; width: var(--passport-qr-size); aspect-ratio: 1; overflow: hidden; background: #fff; }
  .qr-frame svg { width: 100%; height: 100%; }

  .mobile-steps { list-style: none; width: min(100%, 300px); display: grid; grid-template-columns: repeat(3, 1fr); margin: 0; padding: 0; }
  .mobile-steps li { display: flex; align-items: center; justify-content: center; gap: 7px; color: #25242b; text-align: center; }
  .mobile-step-number { width: 18px; height: 18px; display: grid; place-items: center; border: 1px solid rgba(130, 20, 230, .45); border-radius: 50%; color: var(--purple); font-size: 9px; font-weight: 700; }
  .mobile-steps strong { font-size: 11.5px; font-weight: 620; line-height: 1; }

  .refresh-copy { position: static; width: 100%; color: #62616b; font-size: 10.5px; line-height: 1; }
  .progress { position: static; width: min(100%, 300px); height: 3px; margin-top: -15px; }
  .mobile-open { display: flex; width: 100%; min-height: 44px; margin: 0; padding: 0 18px; border-radius: 13px; gap: 8px; font-size: 13px; }
  .mobile-open svg { width: 18px; height: 18px; }
  .retry-button { min-height: 38px; margin: 0; font-size: 12px; }

  .success-view { padding: 10px 16px; }
  .success-card { padding: 20px; border-radius: 24px; }
  .success-avatar-shell { width: 66px; height: 66px; margin-bottom: 11px; }
  .success-avatar-fallback { font-size: 24px; }
  .success-mark { width: 24px; height: 24px; }
  .success-card h1 { font-size: clamp(25px, 7vw, 30px); }
  .success-card > p { margin: 10px auto 15px; font-size: 13px; }
  .success-card dl { margin-bottom: 14px; padding-inline: 14px; font-size: 12px; }
  .success-card dl div { grid-template-columns: minmax(92px, .8fr) minmax(0, 1.5fr); gap: 12px; padding: 8px 0; }
  .success-card .ramses-id-row dd { font-size: 10.5px; }
  .success-card button { min-height: 44px; }
}

@media (max-height: 720px) and (max-width: 720px) {
  .shell { grid-template-rows: 52px minmax(0, 1fr) 36px; }
  .brand { width: 108px; }
  .header { padding-inline: 13px; font-size: 12px; }
  .footer { padding-inline: 8px; font-size: 9.5px; }
  .footer svg { width: 12px; height: 12px; }
  .login-view { gap: 15px; padding: 7px 14px 4px; }
  .instructions h1 { font-size: 24px; }
  .instructions > .sign-in-copy { margin-top: 4px; font-size: 11px; }
  .qr-region { gap: 14px; }
  .mobile-browser-line > strong { font-size: 11px; }
  .qr-shell { gap: 12px; --passport-qr-size: clamp(150px, min(52vw, 24.5dvh), 184px); }
  .qr-canvas { width: calc(var(--passport-qr-size) + 42px); height: calc(var(--passport-qr-size) + 42px); padding: 21px; border-radius: 17px; }
  .mobile-steps li { gap: 5px; }
  .mobile-step-number { width: 14px; height: 14px; font-size: 7px; }
  .mobile-steps strong { font-size: 9px; }
  .refresh-copy { font-size: 9px; }
  .progress { margin-top: -8px; }
  .mobile-open { min-height: 40px; font-size: 12px; }
  .success-card { padding: 12px 18px; }
  .success-avatar-shell { width: 52px; height: 52px; margin-bottom: 6px; }
  .success-mark { width: 21px; height: 21px; border-width: 2px; }
  .success-card h1 { font-size: 24px; }
  .success-card > p { margin: 7px auto 10px; }
  .success-card dl { margin-bottom: 8px; }
  .success-card dl div { padding-block: 6px; }
  .success-card button { min-height: 40px; }
}

@media (prefers-reduced-motion: reduce) {
  .open-button, .progress span { transition: none; }
  .qr-skeleton { animation: none; }
  .qr-canvas, .success-card, .success-avatar-shell { animation: none; }
}
