/* Shared login portal contract. The templates supply the content and states. */
.xw-auth-page {
  --xw-auth-ink: #102a43;
  --xw-auth-muted: #486581;
  --xw-auth-line: #b8c8d8;
  --xw-auth-surface: rgba(255, 255, 255, 0.84);
  --xw-auth-accent: #0b5cab;
  --xw-auth-accent-hover: #084982;
  --xw-auth-danger: #a61b1b;
  --xw-auth-focus: #0b5cab;
  box-sizing: border-box;
  isolation: isolate;
  min-height: 100vh;
  padding: clamp(24px, 5vw, 72px);
  overflow-x: hidden;
  color: var(--xw-auth-ink);
  background: #e9f0f5;
  background-image: linear-gradient(135deg, #f8fbfd 0%, #e6eff5 52%, #dce8f0 100%);
}

.xw-auth-page *,
.xw-auth-page *::before,
.xw-auth-page *::after { box-sizing: inherit; }

.xw-auth-page::before,
.xw-auth-page::after {
  position: fixed;
  z-index: -1;
  width: min(38vw, 520px);
  aspect-ratio: 1;
  border-radius: 50%;
  content: "";
  filter: blur(18px);
  opacity: 0.56;
  pointer-events: none;
}

.xw-auth-page::before { top: -14%; left: -9%; background: #b8d7e8; }
.xw-auth-page::after { right: -11%; bottom: -18%; background: #c2d5c9; }

.xw-auth-shell {
  display: grid;
  grid-template-columns: minmax(280px, 1.1fr) minmax(360px, 0.9fr);
  align-items: center;
  gap: clamp(48px, 9vw, 144px);
  width: min(100%, 1180px);
  min-height: calc(100vh - clamp(48px, 10vw, 144px));
  margin: 0 auto;
}

.xw-auth-brand { max-width: 610px; }

.xw-auth-brand__identity {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 28px;
}

.xw-auth-brand__logo {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  overflow: hidden;
}

.xw-auth-brand__logo img,
.xw-auth-brand__logo svg {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.xw-auth-brand__identity-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.xw-auth-brand__site-name {
  color: #163a59;
  font-size: 0.875rem;
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.xw-auth-brand__role {
  color: var(--xw-auth-muted);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.xw-auth-brand__message {
  max-width: 13ch;
  margin: 0;
  color: var(--xw-auth-ink);
  font-size: clamp(2.25rem, 4.6vw, 4.5rem);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.045em;
}

.xw-auth-brand__description {
  max-width: 49ch;
  margin: 28px 0 0;
  color: var(--xw-auth-muted);
  font-size: 1rem;
  line-height: 1.65;
}

.xw-auth-trust {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  margin: 24px 0 0;
  padding: 0;
  color: #243b53;
  font-size: 0.875rem;
  font-weight: 700;
  line-height: 1.45;
  list-style: none;
}

.xw-auth-trust li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.xw-auth-trust li::before {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--xw-auth-accent);
  content: "";
}

.xw-auth-panel {
  width: min(100%, 460px);
  justify-self: end;
  padding: clamp(28px, 4vw, 48px);
  border: 1px solid rgba(255, 255, 255, 0.86);
  border-radius: 20px;
  background: var(--xw-auth-surface);
  box-shadow: 0 20px 55px rgba(38, 68, 94, 0.16);
  backdrop-filter: blur(16px);
}

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

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

.xw-auth-field > label {
  color: #243b53;
  font-size: 0.875rem;
  font-weight: 650;
  line-height: 1.35;
}

.xw-auth-input {
  display: block;
  width: 100%;
  min-height: 46px;
  padding: 10px 13px;
  border: 1px solid var(--xw-auth-line);
  border-radius: 8px;
  outline: 0;
  color: var(--xw-auth-ink);
  background: rgba(255, 255, 255, 0.93);
  font-family: inherit;
  font-size: 16px;
  line-height: 1.4;
  transition: border-color 180ms ease, box-shadow 180ms ease, background-color 180ms ease;
}

.xw-auth-input::placeholder { color: #627d98; opacity: 1; }
.xw-auth-input:hover { border-color: #829ab1; }
.xw-auth-input:disabled { cursor: not-allowed; color: #334e68; background: #e7eef3; opacity: 1; }
.xw-auth-input[aria-invalid="true"] { border-color: var(--xw-auth-danger); }

.xw-auth-password-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 8px;
  border: 0;
  border-radius: 8px;
  color: #1f5f93;
  background: transparent;
  font: inherit;
  cursor: pointer;
  transition: color 180ms ease, background-color 180ms ease;
}

.xw-auth-password-toggle:hover { color: #083f70; background: rgba(11, 92, 171, 0.1); }
.xw-auth-password-toggle:disabled { color: #486581; cursor: not-allowed; }

.xw-auth-captcha {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.xw-auth-captcha img,
.xw-auth-captcha button {
  min-width: 100px;
  min-height: 44px;
  border: 1px solid var(--xw-auth-line);
  border-radius: 8px;
  background: #fff;
}

.xw-auth-captcha img { display: block; object-fit: cover; cursor: pointer; }

.xw-auth-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 46px;
  padding: 10px 18px;
  border: 1px solid var(--xw-auth-accent);
  border-radius: 8px;
  color: #fff;
  background: var(--xw-auth-accent);
  font: inherit;
  font-weight: 700;
  line-height: 1.4;
  cursor: pointer;
  transition: background-color 180ms ease, border-color 180ms ease, transform 150ms ease;
}

.xw-auth-submit:hover { border-color: var(--xw-auth-accent-hover); background: var(--xw-auth-accent-hover); }
.xw-auth-submit:active { transform: translateY(1px); }
.xw-auth-submit:disabled,
.xw-auth-submit[aria-busy="true"] { border-color: #486581; background: #486581; cursor: wait; }

.xw-auth-status {
  min-height: 1.4em;
  margin: 0;
  color: #243b53;
  font-size: 0.875rem;
  line-height: 1.45;
}

.xw-auth-status[data-state="error"],
.xw-auth-status[role="alert"] { color: var(--xw-auth-danger); }

.xw-auth-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 16px;
  color: var(--xw-auth-muted);
  font-size: 0.8125rem;
  line-height: 1.45;
}

.xw-auth-meta__ip,
.xw-auth-session-hint { margin: 0; }

.xw-auth-session-hint {
  color: #334e68;
  font-weight: 650;
}

.xw-auth-page :focus-visible {
  outline: 3px solid var(--xw-auth-focus);
  outline-offset: 3px;
}

@media (max-width: 1023px) {
  .xw-auth-shell { gap: clamp(32px, 5vw, 56px); }
}

@media (max-width: 767px) {
  .xw-auth-page { padding: 24px 18px; }
  .xw-auth-shell { grid-template-columns: minmax(0, 1fr); min-height: auto; gap: 28px; }
  .xw-auth-brand { max-width: none; }
  .xw-auth-brand__identity { margin-bottom: 18px; }
  .xw-auth-brand__message { max-width: 17ch; font-size: clamp(1.75rem, 8vw, 2.5rem); }
  .xw-auth-brand__description,
  .xw-auth-trust { display: none; }
  .xw-auth-panel { justify-self: stretch; width: 100%; }
}

@media (max-width: 420px) {
  .xw-auth-panel { padding: 24px 18px; }
  .xw-auth-captcha { grid-template-columns: minmax(0, 1fr); }
  .xw-auth-captcha img,
  .xw-auth-captcha button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .xw-auth-page *,
  .xw-auth-page *::before,
  .xw-auth-page *::after { scroll-behavior: auto !important; animation: none !important; transition-duration: 0.01ms !important; }
}
