:root {
  --auth-bg: #edf4fc;
  --auth-card: rgba(255, 255, 255, .96);
  --auth-line: #d8e5f4;
  --auth-text: #18365f;
  --auth-muted: #6f84a2;
  --auth-primary: #2e6fd0;
  --auth-primary-dark: #1e55a5;
  --auth-success: #1c8b5d;
  --auth-danger: #bc3f4b;
  --auth-shadow: 0 32px 80px rgba(32, 73, 130, .18);
}

* { box-sizing: border-box; }

body.auth-page {
  margin: 0;
  min-height: 100vh;
  padding: 28px;
  display: grid;
  place-items: center;
  color: var(--auth-text);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  background:
    radial-gradient(circle at 8% 5%, rgba(46, 111, 208, .18), transparent 31%),
    radial-gradient(circle at 92% 0%, rgba(73, 159, 226, .18), transparent 28%),
    linear-gradient(150deg, #f9fcff 0%, var(--auth-bg) 54%, #e8f0fa 100%);
}

.auth-shell {
  width: min(100%, 940px);
  min-height: 590px;
  display: grid;
  grid-template-columns: minmax(280px, .86fr) minmax(390px, 1.14fr);
  overflow: hidden;
  border: 1px solid rgba(191, 211, 236, .92);
  border-radius: 32px;
  background: var(--auth-card);
  box-shadow: var(--auth-shadow);
  backdrop-filter: blur(18px);
}

.auth-brand {
  position: relative;
  padding: 42px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: #fff;
  background:
    radial-gradient(circle at 84% 12%, rgba(255, 255, 255, .22), transparent 28%),
    linear-gradient(145deg, #326fc8 0%, #173e78 100%);
}

.auth-brand::after {
  content: "";
  position: absolute;
  right: -100px;
  bottom: -125px;
  width: 330px;
  height: 330px;
  border: 58px solid rgba(255, 255, 255, .07);
  border-radius: 50%;
}

.brand-mark {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 19px;
  font-weight: 900;
  letter-spacing: .01em;
}

.brand-shield {
  width: 43px;
  height: 43px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .32);
  border-radius: 14px;
  background: rgba(255, 255, 255, .14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22);
  font-size: 21px;
}

.brand-copy {
  position: relative;
  z-index: 1;
  margin: auto 0;
  padding: 52px 0;
}

.brand-copy h1 {
  margin: 0 0 16px;
  max-width: 310px;
  font-size: clamp(31px, 4vw, 45px);
  line-height: 1.05;
  letter-spacing: -.035em;
}

.brand-copy p {
  margin: 0;
  max-width: 310px;
  color: rgba(255, 255, 255, .74);
  font-size: 15px;
  font-weight: 650;
  line-height: 1.62;
}

.brand-security {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(255, 255, 255, .78);
  font-size: 12px;
  font-weight: 750;
}

.brand-security::before {
  content: "";
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: #72e2af;
  box-shadow: 0 0 0 5px rgba(114, 226, 175, .14);
}

.auth-content {
  padding: 48px 54px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.auth-eyebrow {
  margin: 0 0 10px;
  color: var(--auth-primary);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.auth-content h2 {
  margin: 0 0 10px;
  color: #15345f;
  font-size: clamp(30px, 3.7vw, 40px);
  line-height: 1.08;
  letter-spacing: -.03em;
}

.auth-subtitle {
  margin: 0 0 28px;
  color: var(--auth-muted);
  font-size: 15px;
  font-weight: 650;
  line-height: 1.55;
}

.auth-form { display: flex; flex-direction: column; gap: 17px; }

.auth-field label {
  display: block;
  margin: 0 0 8px;
  color: #294c79;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .055em;
  text-transform: uppercase;
}

.auth-input {
  width: 100%;
  min-height: 56px;
  padding: 0 17px;
  border: 1px solid var(--auth-line);
  border-radius: 15px;
  outline: 0;
  background: #f9fbfe;
  color: #173761;
  font: inherit;
  font-size: 17px;
  font-weight: 750;
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

.auth-input::placeholder { color: #9aabc0; }
.auth-input:focus {
  border-color: #82ace7;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(46, 111, 208, .12);
}

.auth-input.code {
  min-height: 65px;
  text-align: center;
  font-size: 30px;
  font-weight: 900;
  letter-spacing: .28em;
  font-variant-numeric: tabular-nums;
}

.auth-submit {
  width: 100%;
  min-height: 57px;
  margin-top: 3px;
  border: 0;
  border-radius: 15px;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(135deg, var(--auth-primary), var(--auth-primary-dark));
  box-shadow: 0 16px 32px rgba(46, 111, 208, .24);
  font: inherit;
  font-size: 16px;
  font-weight: 900;
  transition: transform .16s ease, box-shadow .16s ease, filter .16s ease;
}

.auth-submit:hover { transform: translateY(-1px); box-shadow: 0 20px 36px rgba(46, 111, 208, .3); }
.auth-submit:active { transform: translateY(0); }
.auth-submit:disabled { cursor: not-allowed; filter: grayscale(.25); opacity: .66; box-shadow: none; }

.auth-alert {
  margin: 0 0 20px;
  padding: 13px 15px;
  border: 1px solid rgba(188, 63, 75, .25);
  border-radius: 14px;
  color: #9a2e3a;
  background: rgba(188, 63, 75, .08);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.45;
}

.auth-hint {
  margin-top: 20px;
  padding: 13px 15px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border: 1px solid #deebf8;
  border-radius: 14px;
  color: var(--auth-muted);
  background: #f7fbff;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.5;
}

.auth-hint strong { color: #2b527f; }

.auth-progress {
  margin: 0 0 27px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.progress-step {
  padding: 10px 11px;
  display: flex;
  gap: 9px;
  align-items: center;
  border: 1px solid var(--auth-line);
  border-radius: 12px;
  color: var(--auth-muted);
  background: #f8fbff;
  font-size: 11px;
  font-weight: 850;
}

.progress-step span {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  flex: 0 0 24px;
  border-radius: 50%;
  background: #e4edf8;
  color: #5c7697;
}

.progress-step.done { color: #257653; border-color: #cce9dc; background: #f4fbf8; }
.progress-step.done span { color: #fff; background: var(--auth-success); }
.progress-step.active { color: #24538e; border-color: #bcd3f1; background: #f0f6ff; }
.progress-step.active span { color: #fff; background: var(--auth-primary); }

.setup-content { padding: 36px 44px; }
.setup-content .auth-subtitle { margin-bottom: 20px; }

.qr-layout {
  margin-bottom: 18px;
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 20px;
  align-items: center;
}

.qr-card {
  padding: 12px;
  border: 1px solid var(--auth-line);
  border-radius: 19px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(36, 77, 129, .09);
}

.qr-card img { display: block; width: 100%; height: auto; border-radius: 10px; }

.setup-steps { margin: 0; padding: 0; list-style: none; counter-reset: setup; }
.setup-steps li {
  position: relative;
  margin: 0 0 12px;
  padding-left: 35px;
  color: #5f7695;
  font-size: 13px;
  font-weight: 720;
  line-height: 1.45;
  counter-increment: setup;
}
.setup-steps li::before {
  content: counter(setup);
  position: absolute;
  left: 0;
  top: -2px;
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--auth-primary);
  background: #edf4fd;
  font-size: 11px;
  font-weight: 900;
}

.manual-key {
  margin: 0 0 18px;
  padding: 11px 13px;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  border: 1px dashed #bfd1e9;
  border-radius: 12px;
  background: #f8fbff;
}

.manual-key div { min-width: 0; }
.manual-key small { display: block; margin-bottom: 4px; color: var(--auth-muted); font-size: 10px; font-weight: 850; text-transform: uppercase; }
.manual-key code { color: #244f85; font-size: 12px; font-weight: 900; letter-spacing: .06em; word-break: break-all; }
.copy-key {
  padding: 8px 10px;
  border: 1px solid #c9dbef;
  border-radius: 10px;
  cursor: pointer;
  color: #2e619d;
  background: #fff;
  font: inherit;
  font-size: 11px;
  font-weight: 900;
}

.admin-identity {
  margin: -12px 0 24px;
  padding: 11px 13px;
  display: flex;
  align-items: center;
  gap: 11px;
  border: 1px solid #e1ebf7;
  border-radius: 14px;
  background: #f8fbff;
}
.identity-avatar {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: 0 0 38px;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(145deg, #4c88dc, #265ca9);
  font-weight: 900;
}
.admin-identity strong { display: block; color: #254b7b; font-size: 13px; }
.admin-identity small { color: var(--auth-muted); font-size: 11px; font-weight: 750; }

.auth-link {
  margin-top: 17px;
  text-align: center;
  color: #7187a5;
  font-size: 12px;
  font-weight: 750;
}
.auth-link a { color: #2e66ad; font-weight: 900; text-decoration: none; }
.auth-link a:hover { text-decoration: underline; }

@media (max-width: 780px) {
  body.auth-page { padding: 15px; align-items: start; }
  .auth-shell { min-height: 0; grid-template-columns: 1fr; border-radius: 24px; }
  .auth-brand { min-height: 210px; padding: 27px; }
  .brand-copy { padding: 32px 0 12px; }
  .brand-copy h1 { max-width: 480px; font-size: 31px; }
  .brand-copy p { max-width: 510px; }
  .brand-security { display: none; }
  .auth-content, .setup-content { padding: 32px 25px; }
}

@media (max-width: 540px) {
  body.auth-page { padding: 0; background: #fff; }
  .auth-shell { width: 100%; border: 0; border-radius: 0; box-shadow: none; }
  .auth-brand { min-height: 176px; border-radius: 0 0 28px 28px; }
  .brand-copy { padding: 25px 0 0; }
  .brand-copy p { display: none; }
  .auth-content, .setup-content { padding: 31px 21px 38px; }
  .qr-layout { grid-template-columns: 1fr; }
  .qr-card { width: min(100%, 210px); margin: 0 auto; }
  .manual-key { align-items: flex-start; }
  .auth-progress { gap: 6px; }
  .progress-step { padding: 8px; font-size: 10px; }
}
