:root {
  color-scheme: light;
  --page: #eef3fb;
  --surface: #ffffff;
  --surface-soft: #f5f8fc;
  --text: #152238;
  --muted: #647189;
  --line: #d7e0ed;
  --primary: #215dcc;
  --primary-hover: #174cae;
  --primary-soft: #e7efff;
  --danger: #b4233b;
  --success: #087a55;
  --shadow: 0 26px 70px rgb(32 58 102 / 16%);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  font-synthesis: none;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --page: #09111d;
    --surface: #111c2b;
    --surface-soft: #172437;
    --text: #eef4fb;
    --muted: #a4b2c6;
    --line: #2b3b51;
    --primary: #83a8ff;
    --primary-hover: #a1bcff;
    --primary-soft: #1d345f;
    --danger: #ff8fa1;
    --success: #65d6ae;
    --shadow: 0 26px 70px rgb(0 0 0 / 40%);
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  min-width: 320px;
  min-height: 100%;
  margin: 0;
}

body {
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 8% 10%, rgb(56 103 202 / 16%), transparent 28rem),
    radial-gradient(circle at 90% 90%, rgb(20 151 119 / 9%), transparent 24rem),
    var(--page);
  font-size: 15px;
  line-height: 1.55;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

.skip-link {
  position: fixed;
  z-index: 10;
  top: 10px;
  left: 10px;
  padding: 10px 14px;
  border-radius: 9px;
  color: #ffffff;
  background: #164cad;
  font-weight: 750;
  text-decoration: none;
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: none;
}

.auth-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(320px, 0.86fr) minmax(480px, 1.14fr);
}

.auth-brand {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  justify-content: space-between;
  gap: 56px;
  padding: clamp(36px, 6vw, 88px);
  color: #f6f9ff;
  background:
    linear-gradient(145deg, rgb(17 38 76 / 20%), rgb(13 29 56 / 88%)),
    linear-gradient(145deg, #255fc7, #173b82 62%, #10264d);
}

.brand-lockup,
.mobile-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 1px solid rgb(255 255 255 / 30%);
  border-radius: 14px;
  color: #ffffff;
  background: rgb(255 255 255 / 14%);
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.08em;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 20%);
}

.brand-lockup strong,
.brand-lockup span {
  display: block;
}

.brand-lockup strong {
  font-size: 19px;
  letter-spacing: -0.02em;
}

.brand-lockup span {
  margin-top: 2px;
  color: rgb(240 246 255 / 70%);
  font-size: 13px;
}

.brand-message {
  max-width: 580px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--primary);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.auth-brand .eyebrow {
  color: #bcd2ff;
}

.brand-message h1 {
  max-width: 640px;
  margin: 0;
  font-size: clamp(35px, 4.3vw, 64px);
  letter-spacing: -0.05em;
  line-height: 1.05;
}

.brand-message > p:last-child {
  max-width: 540px;
  margin: 24px 0 0;
  color: rgb(239 245 255 / 76%);
  font-size: 17px;
}

.trust-list {
  display: grid;
  max-width: 600px;
  gap: 12px;
  padding: 0;
  margin: 0;
  list-style: none;
  color: rgb(240 246 255 / 78%);
  font-size: 13px;
}

.trust-list li {
  display: flex;
  align-items: center;
  gap: 10px;
}

.trust-list li span {
  display: grid;
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgb(255 255 255 / 22%);
  border-radius: 50%;
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
}

.auth-stage {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: clamp(24px, 5vw, 72px);
}

.auth-card {
  width: min(100%, 500px);
  padding: clamp(30px, 5vw, 52px);
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.auth-card:has(.auth-view-wide:not([hidden])) {
  width: min(100%, 720px);
}

.mobile-brand {
  display: none;
  margin-bottom: 34px;
}

.mobile-brand .brand-mark {
  border-color: var(--line);
  color: #ffffff;
  background: #215dcc;
}

.auth-view h2 {
  margin: 0;
  font-size: clamp(28px, 4vw, 38px);
  letter-spacing: -0.045em;
  line-height: 1.12;
}

.view-copy {
  margin: 14px 0 26px;
  color: var(--muted);
}

.auth-form {
  display: grid;
  gap: 18px;
}

.auth-form label,
.auth-form label > span {
  display: grid;
  gap: 7px;
}

.auth-form label > span,
.secret-block > span {
  color: var(--text);
  font-size: 13px;
  font-weight: 750;
}

input {
  width: 100%;
  min-height: 50px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--text);
  background: var(--surface);
  outline: none;
  transition: border-color 130ms ease, box-shadow 130ms ease;
}

input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent);
}

.code-input {
  max-width: 230px;
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 25px;
  font-weight: 750;
  letter-spacing: 0.24em;
  text-align: center;
}

.recovery-input {
  font-family: ui-monospace, "Cascadia Code", monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.primary-action,
.secondary-action,
.copy-button,
.text-action,
.back-button {
  border: 0;
  color: var(--text);
  background: transparent;
  font-weight: 750;
}

.primary-action {
  display: inline-flex;
  min-height: 50px;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 11px 18px;
  border-radius: 11px;
  color: #ffffff;
  background: #215dcc;
  box-shadow: 0 8px 20px rgb(33 93 204 / 22%);
}

.primary-action:hover:not(:disabled) {
  background: #174cae;
}

.primary-action:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.secondary-action,
.copy-button {
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-soft);
}

.secondary-action:hover,
.copy-button:hover {
  border-color: var(--primary);
}

.text-action,
.back-button {
  padding: 8px 0;
  color: var(--primary);
}

.text-action {
  margin-top: 14px;
}

.back-button {
  margin: -12px 0 25px;
}

.auth-notice {
  min-height: 24px;
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.auth-notice.is-error {
  color: var(--danger);
}

.auth-notice.is-success {
  color: var(--success);
}

.loading-mark {
  width: 52px;
  height: 52px;
  margin-bottom: 25px;
  border: 4px solid var(--primary-soft);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}

.enrollment-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 28px;
  align-items: center;
  margin: 28px 0;
}

.qr-frame {
  display: grid;
  width: 240px;
  height: 240px;
  place-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #ffffff;
}

.qr-frame canvas,
.qr-frame img {
  width: 220px;
  height: 220px;
}

.qr-unavailable {
  display: grid;
  gap: 8px;
  place-items: center;
  color: #40516b;
  text-align: center;
}

.qr-unavailable > span {
  display: grid;
  width: 72px;
  height: 72px;
  place-items: center;
  border-radius: 20px;
  color: #ffffff;
  background: #215dcc;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.setup-details dl {
  display: grid;
  gap: 10px;
  margin: 0 0 20px;
}

.setup-details dl div {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 10px;
}

.setup-details dt {
  color: var(--muted);
}

.setup-details dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-weight: 700;
}

.secret-block {
  display: grid;
  gap: 7px;
}

.secret-block > div {
  display: flex;
  align-items: center;
  gap: 8px;
}

.secret-block code {
  display: block;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 9px;
  background: var(--surface-soft);
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  overflow-wrap: anywhere;
}

.enrollment-form {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
}

.enrollment-form .primary-action {
  margin-bottom: 0;
}

.recovery-toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
}

.recovery-code-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 26px;
  padding: 18px 18px 18px 44px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
}

.recovery-code-list code {
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-weight: 750;
  letter-spacing: 0.06em;
}

.acknowledgement {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 20px 0;
  color: var(--muted);
}

.acknowledgement input {
  width: 18px;
  min-height: 18px;
  flex: 0 0 auto;
  margin-top: 2px;
}

.auth-footer {
  display: flex;
  gap: 9px;
  color: var(--muted);
  font-size: 12px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 900px) {
  .auth-shell {
    grid-template-columns: 1fr;
  }

  .auth-brand {
    display: none;
  }

  .mobile-brand {
    display: flex;
  }

  .auth-stage {
    min-height: 100vh;
  }
}

@media (max-width: 620px) {
  .auth-stage {
    justify-content: flex-start;
    padding: 0;
  }

  .auth-card,
  .auth-card:has(.auth-view-wide:not([hidden])) {
    width: 100%;
    min-height: calc(100vh - 42px);
    padding: 30px 22px;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .enrollment-layout {
    grid-template-columns: 1fr;
  }

  .qr-frame {
    justify-self: center;
  }

  .enrollment-form {
    grid-template-columns: 1fr;
  }

  .recovery-code-list {
    grid-template-columns: 1fr;
  }

  .auth-footer {
    padding: 0 18px 15px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
}
