:root {
  --portal-auth-blue: #2f7df6;
  --portal-auth-blue-dark: #1557c0;
  --portal-auth-green: #13b981;
  --portal-auth-ink: #172033;
  --portal-auth-muted: #687083;
  --portal-auth-line: #dce5f2;
  --portal-auth-wash: #f4f7fb;
  --portal-auth-paper: #ffffff;
}

body.portal-auth-locked {
  overflow: hidden;
}

.portal-auth-page {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  grid-template-columns: minmax(320px, 0.88fr) minmax(420px, 1fr);
  min-height: 100dvh;
  color: var(--portal-auth-ink);
  background: var(--portal-auth-wash);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}

.portal-auth-page[hidden],
.portal-auth-session-chip[hidden] {
  display: none !important;
}

.portal-auth-aside {
  display: grid;
  align-content: space-between;
  gap: 32px;
  padding: 42px;
  background: var(--portal-auth-paper);
  border-right: 1px solid var(--portal-auth-line);
}

.portal-auth-brand {
  display: flex;
  gap: 14px;
  align-items: center;
}

.portal-auth-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: var(--portal-auth-blue);
  font-weight: 900;
}

.portal-auth-brand strong,
.portal-auth-brand small,
.portal-auth-note strong,
.portal-auth-note span {
  display: block;
}

.portal-auth-brand strong {
  font-size: 22px;
}

.portal-auth-brand small,
.portal-auth-note span,
.portal-auth-kicker,
.portal-auth-field span,
.portal-auth-checks li,
.portal-auth-status,
.portal-auth-tip,
.portal-auth-demo small {
  color: var(--portal-auth-muted);
}

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

.portal-auth-kicker {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
}

.portal-auth-copy h1 {
  margin: 0;
  max-width: 11em;
  font-size: clamp(36px, 4vw, 54px);
  line-height: 1.08;
  letter-spacing: 0;
}

.portal-auth-copy p {
  margin: 0;
  max-width: 34em;
  color: #4f5b70;
  font-size: 16px;
  line-height: 1.8;
}

.portal-auth-checks {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.portal-auth-checks li {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 14px;
}

.portal-auth-checks li::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--portal-auth-green);
  box-shadow: 0 0 0 4px rgba(19, 185, 129, 0.12);
}

.portal-auth-main {
  display: grid;
  place-items: center;
  padding: 42px;
  overflow-y: auto;
}

.portal-auth-panel {
  width: min(100%, 560px);
  display: grid;
  gap: 24px;
  padding: 30px;
  border: 1px solid var(--portal-auth-line);
  border-radius: 8px;
  background: var(--portal-auth-paper);
}

.portal-auth-panel-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.portal-auth-panel-head h2 {
  margin: 0;
  font-size: 26px;
  line-height: 1.2;
}

.portal-auth-panel-head p {
  margin: 8px 0 0;
  color: var(--portal-auth-muted);
  line-height: 1.6;
}

.portal-auth-surface {
  flex: 0 0 auto;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--portal-auth-blue-dark);
  background: #edf4ff;
  font-size: 14px;
  font-weight: 800;
}

.portal-auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  padding: 6px;
  border-radius: 8px;
  background: #f1f5fb;
}

.portal-auth-tabs button,
.portal-auth-actions button,
.portal-auth-send-code,
.portal-auth-demo button,
.portal-auth-session-chip button {
  border: 0;
  border-radius: 8px;
  font: inherit;
  cursor: pointer;
}

.portal-auth-tabs button {
  padding: 11px 14px;
  color: #526078;
  background: transparent;
  font-weight: 800;
}

.portal-auth-tabs button.active {
  color: var(--portal-auth-blue-dark);
  background: #fff;
  box-shadow: inset 0 0 0 1px #cfe0fb;
}

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

.portal-auth-mode[hidden] {
  display: none;
}

.portal-auth-field {
  display: grid;
  gap: 8px;
}

.portal-auth-field span {
  font-size: 13px;
  font-weight: 800;
}

.portal-auth-field input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border: 1px solid var(--portal-auth-line);
  border-radius: 8px;
  color: var(--portal-auth-ink);
  background: #fff;
  font: inherit;
  outline: 0;
}

.portal-auth-field input:focus {
  border-color: var(--portal-auth-blue);
  box-shadow: 0 0 0 3px rgba(47, 125, 246, 0.12);
}

.portal-auth-code-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 132px;
  gap: 10px;
}

.portal-auth-send-code {
  color: var(--portal-auth-blue-dark);
  background: #eaf2ff;
  font-weight: 900;
}

.portal-auth-actions {
  display: grid;
  gap: 10px;
}

.portal-auth-actions button,
.portal-auth-demo button {
  min-height: 48px;
  padding: 0 16px;
  color: #fff;
  background: var(--portal-auth-blue);
  font-weight: 900;
}

.portal-auth-actions button.secondary,
.portal-auth-demo button {
  color: var(--portal-auth-blue-dark);
  background: #eaf2ff;
}

.portal-auth-actions button:disabled,
.portal-auth-send-code:disabled,
.portal-auth-demo button:disabled {
  cursor: progress;
  opacity: 0.62;
}

.portal-auth-status {
  min-height: 22px;
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
}

.portal-auth-status.error {
  color: #d93d5c;
}

.portal-auth-status.success {
  color: #0f8f66;
}

.portal-auth-qr-layout {
  display: grid;
  grid-template-columns: 184px minmax(0, 1fr);
  gap: 20px;
  align-items: center;
}

.portal-auth-qr {
  width: 184px;
  height: 184px;
  border: 1px solid #cfe0fb;
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.portal-auth-qr.is-preview {
  display: grid;
  place-items: center;
  padding: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #f4f8ff 100%);
}

.portal-auth-qr.is-qr {
  display: block;
  padding: 0;
}

.portal-auth-qr img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.portal-auth-qr-preview {
  display: grid;
  justify-items: center;
  gap: 8px;
  text-align: center;
}

.portal-auth-qr-preview strong {
  color: var(--portal-auth-ink);
  font-size: 18px;
  line-height: 1.25;
}

.portal-auth-qr-preview small {
  max-width: 132px;
  color: var(--portal-auth-muted);
  font-size: 12px;
  line-height: 1.45;
}

.portal-auth-qr-icon {
  width: 74px;
  height: 74px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--portal-auth-blue-dark);
  background: #eaf2ff;
}

.portal-auth-qr-icon svg {
  width: 44px;
  height: 44px;
  display: block;
}

.portal-auth-qr-icon rect,
.portal-auth-qr-icon path,
.portal-auth-qr-icon circle {
  fill: none;
  stroke: currentColor;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.portal-auth-demo {
  display: grid;
  gap: 10px;
}

.portal-auth-tip {
  padding: 12px 14px;
  border-radius: 8px;
  background: #f6f8fb;
  font-size: 14px;
  line-height: 1.6;
}

.portal-auth-session-chip {
  position: fixed;
  left: 18px;
  right: auto;
  bottom: 18px;
  z-index: 9000;
  display: flex;
  gap: 10px;
  align-items: center;
  max-width: min(360px, calc(100vw - 36px));
  padding: 9px 10px 9px 12px;
  border: 1px solid var(--portal-auth-line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 12px 28px rgba(23, 32, 51, 0.08);
}

.portal-auth-session-chip strong {
  display: block;
  font-size: 14px;
}

.portal-auth-session-chip small {
  display: block;
  color: var(--portal-auth-muted);
  font-size: 12px;
}

.portal-auth-session-chip button {
  padding: 8px 10px;
  color: var(--portal-auth-blue-dark);
  background: #eaf2ff;
  font-size: 13px;
  font-weight: 800;
}

@media (max-width: 900px) {
  .portal-auth-page {
    grid-template-columns: 1fr;
    overflow-y: auto;
  }

  .portal-auth-aside {
    gap: 22px;
    padding: 24px 22px;
    border-right: 0;
    border-bottom: 1px solid var(--portal-auth-line);
  }

  .portal-auth-main {
    padding: 22px;
  }

  .portal-auth-copy h1 {
    max-width: none;
    font-size: 34px;
  }
}

@media (max-width: 560px) {
  .portal-auth-panel {
    padding: 20px;
  }

  .portal-auth-panel-head,
  .portal-auth-qr-layout {
    grid-template-columns: 1fr;
  }

  .portal-auth-panel-head {
    display: grid;
  }

  .portal-auth-code-row {
    grid-template-columns: 1fr;
  }

  .portal-auth-send-code {
    height: 44px;
  }

  .portal-auth-qr {
    width: min(100%, 220px);
    height: auto;
    aspect-ratio: 1;
  }

  .portal-auth-session-chip {
    left: 12px;
    right: 12px;
    bottom: 12px;
    max-width: none;
    justify-content: space-between;
  }
}
