/*
 * Cua Spaces sign-in, in the cua.ai look. Every colour, font, the hero
 * headline (type, the gradient last word, its halo) and the white pill button
 * come from @cua/design: cua-spaces.css and cua-spaces-fonts.css are the
 * package's spaces.css and spaces-fonts.css, the same files cua.ai imports,
 * and the float poster is the package's art. scripts/sync-design-assets.mjs
 * copies them and CI fails if they drift. This file owns only layout and the
 * Keycloak class contract; it maps the theme's --kc-* names onto --spaces-*.
 *
 * Wrapper contract verified against Keycloak 26.0.6 keycloak.v2/template.ftl:
 * body > kcLogin > kcLoginContainer > (#kc-header + kcLoginMain), then
 * kcLoginMainHeader + kcLoginMainBody + the parent-owned footer. Only those
 * verified wrapper properties are renamed in theme.properties; field, error,
 * recovery, locale, and required-action behavior remains parent-owned.
 */

/* Matches the specificity of cua-design.css's dark-mode root selector, so
   these win by source order. kcHtmlClass puts cua-html on <html>. */
:root.cua-html {
  --kc-bg-base: var(--spaces-page);
  --kc-bg-elev-1: var(--spaces-surface);
  --kc-bg-elev-2: var(--spaces-surface-raised);
  --kc-bg-card-hover: var(--spaces-surface-raised);
  --kc-ink-strong: var(--spaces-fg);
  --kc-ink-body: var(--spaces-fg-2);
  --kc-ink-muted: var(--spaces-fg-3);
  --kc-brand: var(--spaces-blue);
  --kc-brand-soft: var(--spaces-action-primary-bg);
  --kc-brand-glow: rgba(94, 192, 232, 0.35);
  --kc-line-soft: var(--spaces-line);
  --kc-line-strong: var(--spaces-line-strong);
  --kc-font-display: var(--spaces-font-display);
  --kc-font-body: var(--spaces-font-body);
  --kc-radius-card: 12px;
  --kc-radius-card-lg: 28px;
  --kc-radius-pill: var(--spaces-radius-pill);
  --kc-focus-color: var(--spaces-blue);
  --kc-split: 58%;
  /* 1x is 2124x1314; 2x is 3200x1980, the size a tall panel needs on a
     Retina display. Both keep the poster's 1.616 aspect, so `cover` crops
     them the same way. 1x screens never fetch the 2x file. */
  --cua-photo-wide: image-set(
    url("assets/art/float-poster-wide.webp") 1x type("image/webp"),
    url("assets/art/float-poster-wide-2x.webp") 2x type("image/webp"),
    url("assets/art/float-poster-wide.jpg") 1x type("image/jpeg"),
    url("assets/art/float-poster-wide-2x.jpg") 2x type("image/jpeg")
  );
  --cua-band: 208px;
  /* Desktop split grid. The panel headline and the form column's first row
     (the Cua key) share one top line, and the headline keeps the same inset
     from the panel's right edge as from its left. */
  --cua-split-top: clamp(48px, 10vh, 160px);
  --cua-split-inset: clamp(40px, 5vw, 80px);
  /* Field outlines need 3:1 against the page (WCAG 1.4.11); 36% white is 3.2:1. */
  --cua-control-line: rgba(255, 255, 255, 0.36);
}

::selection {
  background: var(--spaces-blue);
  color: var(--spaces-ink);
}

html.cua-html {
  -webkit-font-smoothing: antialiased;
  /* The theme is dark-only. Without this, native controls (checkboxes,
     autofill, scrollbars) render light when the OS is in light mode. */
  color-scheme: dark;
}

html.cua-html,
body.cua-body {
  min-height: 100%;
  margin: 0;
  background: var(--kc-bg-base);
  color: var(--kc-ink-body);
  font-family: var(--kc-font-body);
}

body.cua-body {
  min-height: 100vh;
  min-height: 100dvh;
}

.cua-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.cua-login {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  box-sizing: border-box;
  padding: 24px;
  background: var(--kc-bg-base);
}

.cua-login__container {
  width: 100%;
  max-width: 420px;
}

#kc-header {
  margin-bottom: 20px;
  text-align: center;
}

#kc-header-wrapper {
  color: var(--kc-ink-strong);
  font-family: var(--kc-font-display);
  font-size: 30px;
  line-height: 1.1;
}

/* The Cua key (the Spaces app icon's keycap, unaltered), for pages without the
   split layout's brandmark. */
#kc-header::before {
  content: "";
  display: block;
  width: 36px;
  height: 36px;
  margin: 0 auto 16px;
  background: image-set(url("assets/brand/key-72.webp") 2x, url("assets/brand/key-108.webp") 3x) center / 36px 36px no-repeat;
}

.cua-login__main {
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
  width: 100%;
  padding: 32px;
  background: var(--kc-bg-elev-1);
  border: 1px solid var(--kc-line-soft);
  border-radius: var(--kc-radius-card-lg);
  box-shadow: var(--kc-shadow-card);
  color: var(--kc-ink-body);
}

.cua-login__main-header,
.cua-login__body {
  box-sizing: border-box;
}

.cua-login__main-header {
  margin-bottom: 20px;
}

.cua-login__title {
  margin: 0;
  color: var(--kc-ink-strong);
  font-family: var(--kc-font-display);
  font-size: 32px;
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.04;
  text-wrap: balance;
}

.cua-login__body {
  position: relative;
}

.cua-login__body > form,
.cua-login__body > div:not(.cua-login-split):not(.cua-alert) {
  color: var(--kc-ink-body);
}

.cua-alert {
  display: flex;
  align-items: flex-start;
  box-sizing: border-box;
  margin: 0 0 20px;
  padding: 12px 14px;
  background: var(--kc-bg-elev-2);
  border: 1px solid var(--kc-line-strong);
  border-radius: var(--kc-radius-card);
  color: var(--kc-ink-body);
  line-height: 1.45;
}

.cua-alert__icon {
  flex: 0 0 auto;
  margin-right: 10px;
}

.cua-alert:has(.cua-alert__glyph--error) {
  border-color: var(--kc-status-danger);
}

.cua-alert:has(.cua-alert__glyph--warning) {
  border-color: var(--kc-status-warning);
}

.cua-alert:has(.cua-alert__glyph--success) {
  border-color: var(--kc-status-success);
}

.cua-alert:has(.cua-alert__glyph--info) {
  border-color: var(--kc-status-info);
}

.cua-alert__glyph--error {
  color: var(--kc-status-danger);
}

.cua-alert__glyph--warning {
  color: var(--kc-status-warning);
}

.cua-alert__glyph--success {
  color: var(--kc-status-success);
}

.cua-alert__glyph--info {
  color: var(--kc-status-info);
}

.cua-alert__title {
  color: var(--kc-ink-strong);
}

.cua-login-split {
  position: relative;
  display: grid;
  background: var(--kc-bg-base);
}

/* The photo panel: a rounded card holding the Spaces float poster, as on
   spaces.cua.ai. On phones it is a short band above the form. */
.cua-editorial {
  position: relative;
  isolation: isolate;
  height: var(--cua-band);
  box-sizing: border-box;
  overflow: hidden;
  margin: 8px 8px 0;
  background: var(--spaces-night) var(--cua-photo-wide) 88% 42% / cover no-repeat;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 20px;
}

/* Phones show only the photo; the line stays for screen readers. */
.cua-editorial__copy {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* cua.ai's float hero headline: white upright Outfit with a soft black halo
   over the starfield, and the last word in the keys' colours (Cua Blue, the
   lifted navy, terracotta) clipped to the text, with the lifted navy as a
   solid fill where background-clip: text is missing. The halo moves from
   text-shadow to a filter on the word, since a text-shadow would paint over
   the clipped fill. Same tokens and recipe as cua.ai (global.css .sc-word). */
.cua-editorial__headline {
  margin: 0;
  color: #ffffff;
  font-family: var(--spaces-font-display);
  font-size: clamp(40px, 3.9vw, 64px);
  font-weight: var(--spaces-headline-weight);
  letter-spacing: var(--spaces-headline-tracking);
  line-height: var(--spaces-headline-leading);
  text-shadow: var(--spaces-headline-shadow);
  /* 15ch is the narrowest box that keeps "one supercomputer." whole and sets
     the line in three balanced rows instead of orphaning "Combine". */
  max-width: 15ch;
  text-wrap: balance;
}

.cua-editorial__accent {
  display: inline-block;
  text-shadow: none;
  filter: var(--spaces-headline-accent-halo);
}

.cua-editorial__ink {
  color: var(--spaces-headline-accent-fallback);
}

@supports ((background-clip: text) or (-webkit-background-clip: text)) {
  .cua-editorial__ink {
    background-image: var(--spaces-headline-accent-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
  }
}

/* cua.ai's subline under the hero headline: grey Inter at medium weight. */
.cua-editorial__subline {
  margin: 12px 0 0;
  max-width: 30ch;
  color: var(--spaces-headline-subline-ink);
  font-family: var(--spaces-font-body);
  font-size: clamp(16px, 1.2vw, 28px);
  font-weight: 500;
  line-height: 1.45;
  text-shadow: var(--spaces-headline-shadow);
  text-wrap: balance;
}

.cua-authcol {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  box-sizing: border-box;
  width: 100%;
  padding: 24px 20px 40px;
  background: var(--kc-bg-base);
}

.cua-brandmark {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 28px;
}

/* The Cua key, unaltered, at the app sidebar's size. */
.cua-brandmark img {
  display: block;
  width: 36px;
  height: 36px;
  user-select: none;
}

.cua-brandmark__name {
  color: var(--kc-ink-strong);
  font-family: var(--kc-font-display);
  font-size: 24px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.04em;
}

.cua-auth-heading {
  margin-bottom: 24px;
}

.cua-auth-heading h1 {
  margin: 0;
  color: var(--kc-ink-strong);
  font-family: var(--kc-font-display);
  font-size: clamp(32px, 8vw, 38px);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.04;
  text-wrap: balance;
}

.cua-auth-heading p {
  margin: 10px 0 0;
  color: var(--kc-ink-muted);
  font-size: 15px;
  line-height: 1.5;
}

.cua-auth-heading .cua-auth-credit {
  margin-top: 12px;
  color: var(--kc-ink-strong);
  font-size: 13px;
  font-weight: 600;
}

.kcSocialProviders {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.kc-btn {
  min-height: 48px;
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-sizing: border-box;
  padding: 0 16px;
  border-radius: var(--kc-radius-pill);
  cursor: pointer;
  font-family: var(--kc-font-body);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  transition:
    background-color 250ms ease,
    border-color 250ms ease,
    box-shadow 250ms ease,
    color 250ms ease,
    opacity 250ms ease,
    transform 250ms ease;
}

.kc-btn-broker,
.kc-btn-secondary {
  background: var(--kc-bg-elev-1);
  border: 1px solid var(--kc-line-soft);
  color: var(--kc-ink-strong);
}

.kc-btn-broker:hover,
.kc-btn-secondary:hover {
  background: var(--kc-bg-card-hover);
  border-color: var(--kc-line-strong);
  color: #ffffff;
  text-decoration: none;
}

.kc-btn-broker:active,
.kc-btn-secondary:active {
  background: var(--kc-bg-card-hover);
  border-color: var(--kc-line-strong);
  color: #ffffff;
}

.kc-btn-broker-primary,
.kc-btn-broker-primary:hover,
.kc-btn-broker-primary:active {
  background: var(--spaces-action-primary-bg);
  border-color: var(--spaces-action-primary-bg);
  color: var(--spaces-action-primary-fg);
}

.kc-btn-broker-primary:hover {
  opacity: 0.88;
}

.kc-btn__content {
  display: inline-flex;
  min-width: 0;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.kc-btn__help {
  color: inherit;
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.35;
  opacity: 0.72;
}

.kc-btn--block {
  width: 100%;
}

.kc-btn-link {
  min-height: 44px;
  padding: 0;
  background: transparent;
  border: 0;
  color: var(--kc-ink-strong);
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, 0.3);
  text-underline-offset: 4px;
}

.kc-btn__mark {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
}

.cua-or {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  margin: 24px 0;
  color: var(--kc-ink-muted);
  font-size: 12px;
  line-height: 1;
}

.cua-or::before,
.cua-or::after {
  content: "";
  height: 1px;
  background: var(--kc-line-soft);
}

.cua-email-login {
  display: block;
}

.cua-auth-unavailable {
  margin: 0;
  padding: 14px 16px;
  background: var(--kc-bg-elev-1);
  border: 1px solid var(--kc-status-danger);
  border-radius: var(--kc-radius-card);
  color: var(--kc-ink-body);
  font-size: 13px;
  line-height: 1.5;
}

.kc-field {
  margin-bottom: 14px;
}

.kc-label {
  display: block;
  margin-bottom: 6px;
  color: var(--kc-ink-muted);
  font-family: var(--kc-font-body);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.4;
}

.cua-control {
  position: relative;
  display: block;
  width: 100%;
}

.kc-input,
.cua-control > input,
.cua-control > select,
.cua-control > textarea,
input.cua-control,
select.cua-control,
textarea.cua-control {
  min-height: var(--kc-control-h-md);
  width: 100%;
  display: block;
  box-sizing: border-box;
  padding: 0 14px;
  background: var(--kc-bg-elev-1);
  border: 1px solid var(--cua-control-line);
  border-radius: var(--kc-radius-card);
  color: var(--kc-ink-strong);
  caret-color: var(--kc-brand);
  font-family: var(--kc-font-body);
  font-size: 15px;
  transition:
    border-color var(--kc-motion-fast) ease,
    box-shadow var(--kc-motion-fast) ease;
}

.cua-control > textarea,
textarea.cua-control {
  min-height: 112px;
  padding-block: 12px;
  resize: vertical;
}

.kc-input::placeholder,
.cua-control > input::placeholder,
.cua-control > textarea::placeholder,
input.cua-control::placeholder,
textarea.cua-control::placeholder {
  color: var(--kc-ink-muted);
}

.cua-control > select,
select.cua-control {
  padding-right: 40px;
}

.cua-form {
  display: block;
}

.cua-inputgroup {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.cua-inputgroup__item--fill {
  flex: 1;
  min-width: 0;
}

.cua-control__util {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  pointer-events: none;
}

.cua-control__status {
  color: var(--kc-status-danger);
}

.cua-is-error > input,
.cua-is-error > select,
.cua-is-error > textarea,
input.cua-is-error,
select.cua-is-error,
textarea.cua-is-error {
  border-color: var(--kc-status-danger);
}

.cua-control--readonly > input,
input.cua-control--readonly {
  opacity: 0.72;
  cursor: not-allowed;
}

.cua-btn-icon {
  min-width: var(--kc-control-h-md);
  min-height: var(--kc-control-h-md);
  display: inline-grid;
  place-items: center;
  box-sizing: border-box;
  padding: 0 12px;
  background: transparent;
  border: 1px solid var(--cua-control-line);
  border-radius: var(--kc-radius-card);
  color: var(--kc-ink-muted);
  cursor: pointer;
}

.cua-btn-icon:hover {
  border-color: var(--kc-brand);
  color: var(--kc-ink-strong);
}

.cua-btn-icon > i {
  pointer-events: none;
}

.cua-help,
.cua-help__list,
.cua-help__item {
  margin: 0;
  padding: 0;
}

.cua-help__list {
  list-style: none;
}

.cua-help__text {
  color: var(--kc-ink-muted);
  font-size: 13px;
  line-height: 1.45;
}

.cua-help__text--error,
.cua-required {
  color: var(--kc-status-danger);
}

.cua-required {
  margin-left: 4px;
}

.kc-form-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  flex-wrap: wrap;
  margin-top: 18px;
  color: var(--kc-ink-body);
  font-size: 13px;
}

.kc-checkbox,
.cua-check,
#kc-form-options > div > div:has(> #logout-sessions),
#kc-form-options label {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 20px;
}

.kc-checkbox input,
.cua-check__input,
#logout-sessions,
#kc-form-options input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--kc-brand);
}

.cua-login__main .cua-check,
.cua-login__main .cua-check__label,
.cua-login__main label[for="logout-sessions"],
.cua-login__main #kc-form-options label {
  color: var(--kc-ink-body);
}

.kc-reset-link,
.cua-login__main a:not(.kc-btn) {
  color: var(--kc-ink-strong);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, 0.3);
  text-underline-offset: 4px;
}

.kc-reset-link:hover,
.cua-login__main a:not(.kc-btn):hover {
  color: #ffffff;
  text-decoration-color: currentColor;
}

.cua-legal {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--kc-line-soft);
  font-size: 13px;
}

.cua-login__main .cua-legal a:not(.kc-btn) {
  color: var(--kc-ink-muted);
  font-weight: 400;
  text-decoration: none;
}

.cua-login__main .cua-legal a:not(.kc-btn):hover {
  color: var(--kc-ink-strong);
  text-decoration: underline;
}

.kc-actions {
  margin-top: 20px;
}

.kc-actions .kc-btn + .kc-btn,
.kc-field .kc-btn + .kc-btn {
  margin-top: 10px;
}

.kc-btn-primary,
.kc-btn-primary:hover,
.kc-btn-primary:active {
  min-height: 48px;
  background: var(--spaces-action-primary-bg);
  border: 1px solid var(--spaces-action-primary-bg);
  color: var(--spaces-action-primary-fg);
}

.kc-btn-primary:hover {
  opacity: 0.88;
}

.kc-btn:disabled,
.kc-btn[aria-disabled="true"] {
  cursor: default;
  pointer-events: none;
  opacity: 0.5;
  box-shadow: none;
  transform: none;
}

.kc-register {
  display: flex;
  justify-content: center;
  gap: 5px;
  margin: 20px 0 0;
  color: var(--kc-ink-muted);
  font-size: 13px;
  line-height: 1.6;
  text-align: center;
}

.cua-required-note {
  margin: 0 0 18px;
  color: var(--kc-ink-muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.4;
}

.cua-required-note > span {
  color: var(--kc-status-danger);
}

.cua-register-consent {
  margin: 12px 0 0;
  color: var(--kc-ink-muted);
  font-size: 13px;
  line-height: 1.5;
}

.cua-register-back {
  margin: 20px 0 0;
  color: var(--kc-ink-muted);
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
}

#kc-register-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 12px;
}

#kc-register-form > * {
  grid-column: 1 / -1;
}

#kc-register-form > .kc-field:has(#firstName) {
  grid-column: 1;
}

#kc-register-form > .kc-field:has(#lastName) {
  grid-column: 2;
}

.cua-journey {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0;
  margin: 0 0 28px;
  padding: 0;
  color: var(--kc-ink-muted);
  font-size: 12px;
  font-weight: 600;
  list-style: none;
}

.cua-journey__step {
  position: relative;
  z-index: 0;
  min-width: 0;
  flex: 1;
  display: grid;
  justify-items: center;
  gap: 8px;
  text-align: center;
}

.cua-journey__step:not(:last-child)::after {
  content: "";
  position: absolute;
  z-index: -1;
  top: 14px;
  left: calc(50% + 20px);
  width: calc(100% - 40px);
  height: 1px;
  background: var(--kc-line-strong);
}

.cua-journey__dot {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  box-sizing: border-box;
  background: var(--kc-bg-base);
  border: 1.5px solid var(--kc-line-strong);
  border-radius: 50%;
  color: var(--kc-ink-muted);
  font-size: 12px;
}

.cua-journey__step--done {
  color: var(--kc-status-success);
}

.cua-journey__step--done .cua-journey__dot {
  background: var(--kc-status-success);
  border-color: var(--kc-status-success);
  color: #000000;
}

.cua-journey__step--current {
  color: var(--kc-ink-strong);
}

.cua-journey__step--current .cua-journey__dot {
  border-color: var(--kc-brand);
  color: var(--kc-brand);
}

.kc-btn:focus-visible,
.kc-input:focus-visible,
.cua-control > input:focus-visible,
.cua-control > select:focus-visible,
.cua-control > textarea:focus-visible,
input.cua-control:focus-visible,
select.cua-control:focus-visible,
textarea.cua-control:focus-visible,
.cua-btn-icon:focus-visible,
.kc-checkbox input:focus-visible,
.cua-check__input:focus-visible,
#kc-form-options input[type="checkbox"]:focus-visible,
.cua-login__main a:focus-visible,
.cua-login__main button:focus-visible,
.cua-login__main select:focus-visible,
.cua-authlist a:focus-visible,
.cua-tile:focus-within {
  outline: var(--kc-focus-width) solid var(--kc-focus-color);
  outline-offset: var(--kc-focus-offset);
}

.kc-input:focus-visible,
.cua-control > input:focus-visible,
.cua-control > select:focus-visible,
.cua-control > textarea:focus-visible,
input.cua-control:focus-visible,
select.cua-control:focus-visible,
textarea.cua-control:focus-visible {
  border-color: var(--kc-brand);
  box-shadow: 0 0 0 2px var(--kc-brand-glow);
}

p.instruction {
  margin: 0 0 20px;
  color: var(--kc-ink-body);
  font-size: 15px;
  line-height: 1.55;
}

#kc-info-message,
#kc-error-message,
#kc-logout-confirm,
#kc-info,
#kc-info-wrapper {
  color: var(--kc-ink-body);
}

#kc-info {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--kc-line-soft);
}

div#kc-form-buttons,
#kc-form-options {
  margin-top: 24px;
}

#kc-form-buttons .kc-btn + .kc-btn,
#kc-form-options .kc-btn + .kc-btn {
  margin-top: 10px;
}

.clearfix {
  display: none;
}

/*
 * Shared secondary-flow shell. The main login owns #cua-editorial and keeps
 * its richer split layout; every inherited Keycloak screen uses this quiet
 * shell. :has() is progressive enhancement: older engines retain the safe,
 * centered dark-card fallback declared above.
 */
html:not(:has(#cua-editorial)) .cua-login {
  display: block;
  padding: 0;
}

html:not(:has(#cua-editorial)) .cua-login__container {
  box-sizing: border-box;
  width: min(100%, 476px);
  max-width: none;
  margin-inline: auto;
  padding: 40px 28px;
}

html:not(:has(#cua-editorial)) #kc-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 30px;
  text-align: left;
}

html:not(:has(#cua-editorial)) #kc-header::before {
  flex: 0 0 auto;
  margin: 0;
}

/* The Cua key above stands for the brand; keep the realm name for screen readers. */
#kc-header-wrapper {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

html:not(:has(#cua-editorial)) .cua-login__main {
  overflow: visible;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

html:not(:has(#cua-editorial)) .cua-login__main-header {
  margin-bottom: 24px;
}

html:not(:has(#cua-editorial)) .cua-login__title {
  font-size: clamp(32px, 5vw, 40px);
}

html:not(:has(#cua-editorial)) .cua-login__main:has(#kc-info-message) .cua-login__title,
html:not(:has(#cua-editorial)) .cua-login__main:has(#kc-error-message) .cua-login__title {
  font-size: clamp(30px, 4.4vw, 36px);
}

.cua-contentwrap,
.cua-mt {
  margin-top: 16px;
}

.cua-buttons,
.cua-options,
.cua-infoarea {
  margin-top: 24px;
}

.cua-inputwrap,
.cua-labelwrap {
  min-width: 0;
}

.cua-signup {
  color: var(--kc-ink-muted);
}

.cua-footerband {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--kc-line-soft);
}

/* register.ftl keeps its wrapper class literal upstream; its stable form and
 * options ids let the Cua theme own the visible footer without that class. */
#kc-register-form > .kc-field:has(> #kc-form-options) {
  margin-top: 24px;
  padding-top: 20px;
  background: transparent;
  border-top: 1px solid var(--kc-line-soft);
  color: var(--kc-ink-muted);
  text-align: center;
}

#kc-register-form #kc-form-options {
  margin-top: 0;
}

.cua-footerband__item,
.cua-social__item {
  min-width: 0;
}

.cua-footerband__help {
  color: var(--kc-ink-muted);
  font-size: 13px;
}

.cua-login__footer {
  margin-top: 16px;
}

.cua-login__utilities {
  display: flex;
  align-items: center;
  gap: 10px;
}

.subtitle {
  margin-bottom: 20px;
  color: var(--kc-ink-muted);
  font-family: var(--kc-font-body);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.kc-btn--lg {
  min-height: var(--kc-control-h-lg);
}

#linkAccount {
  background: var(--spaces-action-primary-bg);
  border-color: var(--spaces-action-primary-bg);
  color: var(--spaces-action-primary-fg);
}

.kc-login-tooltip {
  position: relative;
}

.kc-tooltip-text {
  position: absolute;
  z-index: 4;
  right: 0;
  bottom: calc(100% + 8px);
  width: max-content;
  max-width: 220px;
  padding: 7px 9px;
  overflow: hidden;
  background: var(--kc-bg-elev-2);
  border: 1px solid var(--kc-line-strong);
  border-radius: 7px;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  color: var(--kc-ink-strong);
  font-size: 12px;
  line-height: 1.35;
  opacity: 0;
  pointer-events: none;
  white-space: normal;
}

.kc-login-tooltip:hover .kc-tooltip-text,
.kc-login-tooltip:focus-visible .kc-tooltip-text {
  overflow: visible;
  clip: auto;
  clip-path: none;
  opacity: 1;
}

.cua-tile,
.cua-authlist,
.cua-panel {
  box-sizing: border-box;
  width: 100%;
  margin: 0;
  padding: 0;
  background: var(--kc-bg-elev-1);
  border: 1px solid var(--kc-line-soft);
  border-radius: var(--kc-radius-card);
  color: var(--kc-ink-body);
}

.cua-tile {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-height: var(--kc-control-h-lg);
  padding: 12px 14px;
}

.cua-tile + .cua-tile {
  margin-top: 10px;
}

.cua-tile--selected {
  border-color: var(--kc-brand);
  box-shadow: 0 0 0 2px var(--kc-brand-glow);
}

.cua-tile__header,
.cua-tile__title,
.cua-authlist__title {
  color: var(--kc-ink-strong);
  font-weight: 600;
}

.cua-tile__input {
  accent-color: var(--kc-brand);
}

.cua-authlist {
  overflow: hidden;
  list-style: none;
}

.cua-authlist__row + .cua-authlist__row {
  border-top: 1px solid var(--kc-line-soft);
}

.cua-authlist__item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 12px 14px;
}

/* Keycloak 26 keeps this first structural wrapper hard-coded in the parent
 * select-authenticator template, so bridge its position without a fork. */
.cua-authlist__item > div:first-child {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  flex: 1;
  gap: 3px 12px;
  align-items: center;
  min-width: 0;
}

.cua-authlist__item > div:first-child > .cua-authlist__icon {
  grid-column: 1;
  grid-row: 1 / span 2;
}

.cua-authlist__item > div:first-child > .cua-authlist__body,
.cua-authlist__item > div:first-child > .cua-authlist__desc {
  grid-column: 2;
}

.cua-authlist__item > div:first-child > .cua-authlist__body {
  grid-row: 1;
}

.cua-authlist__item > div:first-child > .cua-authlist__desc {
  grid-row: 2;
  margin-top: 0;
}

.cua-authlist__body,
.cua-authlist__fill {
  min-width: 0;
  flex: 1;
}

.cua-authlist__icon,
.cua-authlist__glyph {
  flex: 0 0 auto;
  color: var(--kc-brand);
}

.cua-authlist__desc {
  margin-top: 3px;
  color: var(--kc-ink-muted);
  font-size: 13px;
  line-height: 1.4;
}

.cua-panel {
  padding: 18px;
}

.cua-panel__main,
.cua-panel__body {
  min-width: 0;
}

.cua-list {
  margin: 0;
  padding-left: 22px;
  color: var(--kc-ink-body);
}

.cua-alert--warning {
  border-color: var(--kc-status-warning);
}

.cua-alert__desc {
  min-width: 0;
  flex: 1;
}

#kc-totp-settings {
  margin: 0 0 28px;
  padding-left: 24px;
}

#kc-totp-settings > li + li {
  margin-top: 18px;
}

#kc-totp-supported-apps,
#kc-totp-settings ul {
  margin: 8px 0 0;
  padding-left: 20px;
  color: var(--kc-ink-muted);
}

#kc-totp-secret-key,
#device-user-code,
#certificate_subjectDN {
  overflow-wrap: anywhere;
  font-family: var(--kc-font-mono);
}

#device-user-code {
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

#kc-totp-secret-qr-code {
  box-sizing: border-box;
  max-width: 100%;
  height: auto;
  padding: 12px;
  background: #ffffff;
  border: 1px solid var(--kc-line-strong);
  border-radius: var(--kc-radius-card);
}

#kc-recovery-codes-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 18px;
  margin: 0;
  padding: 0;
  font-family: var(--kc-font-mono);
  font-size: 13px;
  list-style: none;
}

#kc-info-message,
#kc-error-message,
#kc-logout-confirm {
  line-height: 1.55;
}

@media (min-width: 1024px) {
  html:not(:has(#cua-editorial)) .cua-login {
    display: grid;
    grid-template-columns: var(--kc-split) calc(100% - var(--kc-split));
    place-items: stretch;
  }

  /* Device, error, info, and other parent-owned pages get the same photo card. */
  html:not(:has(#cua-editorial)) .cua-login::before {
    content: "";
    grid-column: 1;
    grid-row: 1;
    box-sizing: border-box;
    min-height: calc(100vh - 24px);
    min-height: calc(100dvh - 24px);
    margin: 12px;
    background: var(--spaces-night) var(--cua-photo-wide) right center / cover no-repeat;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--kc-radius-card-lg);
  }

  html:not(:has(#cua-editorial)) .cua-login__container {
    grid-column: 2;
    grid-row: 1;
    align-self: center;
    width: min(var(--kc-form-max), calc(100% - 96px));
    padding: 48px 0;
  }
}

html:has(#cua-editorial) .cua-login {
  display: block;
  padding: 0;
}

html:has(#cua-editorial) .cua-login__container,
html:has(#cua-editorial) .cua-login__main,
html:has(#cua-editorial) .cua-login__body {
  width: 100%;
  max-width: none;
  min-height: 100vh;
  min-height: 100dvh;
}

html:has(#cua-editorial) .cua-login__main {
  overflow: visible;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

html:has(#cua-editorial) #kc-header {
  display: none;
}

html:has(#cua-editorial) .cua-login__main-header {
  position: absolute;
  z-index: 2;
  margin: 0;
}

html:has(#cua-editorial) #kc-page-title {
  display: none;
}

html:has(#cua-editorial) .cua-login__body > .cua-alert {
  position: absolute;
  z-index: 3;
  top: calc(var(--cua-band) + 20px);
  right: 20px;
  left: 20px;
  margin: 0;
}

html:has(#cua-editorial) .cua-login__body:has(> .cua-alert) .cua-authcol {
  padding-top: 132px;
}

@media (max-width: 1023px) {
  html:has(#cua-editorial) .cua-login__body:has(> .cua-alert) .cua-authcol {
    padding-top: 96px;
  }
}

@media (min-width: 1024px) {
  html:has(#cua-editorial) .cua-login-split {
    min-height: 100vh;
    min-height: 100dvh;
    grid-template-columns: var(--kc-split) calc(100% - var(--kc-split));
    align-items: start;
  }

  .cua-editorial {
    position: sticky;
    top: 12px;
    height: calc(100vh - 24px);
    height: calc(100dvh - 24px);
    margin: 12px;
    /* A shade at the top, like the closing image on spaces.cua.ai, keeps the
       line readable over the keys in a tall panel. */
    background:
      linear-gradient(180deg, var(--spaces-night) 0%, rgba(5, 6, 7, 0.86) 30%, rgba(5, 6, 7, 0) 60%),
      var(--spaces-night) var(--cua-photo-wide) 80% center / cover no-repeat;
    border-radius: var(--kc-radius-card-lg);
  }

  /* The poster's keys sit in its right half; the line goes on the dark left.
     The panel starts 12px down the page, so this top lands the headline on
     the same line as the form column's first row. */
  .cua-editorial__copy {
    position: absolute;
    top: calc(var(--cua-split-top) - 12px);
    right: var(--cua-split-inset);
    left: var(--cua-split-inset);
    width: auto;
    height: auto;
    overflow: visible;
    clip-path: none;
    white-space: normal;
  }

  .cua-authcol {
    min-height: 100vh;
    min-height: 100dvh;
    width: min(360px, calc(100% - 64px));
    margin-inline: auto;
    padding: var(--cua-split-top) 0 56px;
    justify-content: flex-start;
    border-left: 0;
  }

  .cua-brandmark {
    margin-bottom: 36px;
  }

  html:has(#cua-editorial) .cua-login__body > .cua-alert {
    top: 28px;
    right: max(48px, calc((40% - var(--kc-form-max)) / 2));
    left: auto;
    width: min(var(--kc-form-max), calc(40% - 96px));
  }

  html:has(#cua-editorial) .cua-login__body:has(> .cua-alert) .cua-authcol {
    padding-top: 132px;
  }
}

@media (min-width: 1280px) {
  .cua-authcol {
    width: min(360px, calc(100% - 96px));
  }

  .cua-auth-heading h1 {
    font-size: 40px;
  }
}

@media (prefers-contrast: more) {
  :root.cua-html {
    --kc-line-strong: rgba(255, 255, 255, 0.45);
    --cua-control-line: rgba(255, 255, 255, 0.6);
  }

  .cua-login__main {
    background: #000000;
    border-color: rgba(255, 255, 255, 0.45);
  }

  .cua-tile,
  .cua-authlist,
  .cua-panel {
    border-color: rgba(255, 255, 255, 0.45);
  }
}

@media (prefers-reduced-motion: reduce) {
  .kc-btn,
  .kc-input,
  .cua-control > input,
  .cua-control > select,
  .cua-control > textarea,
  input.cua-control,
  select.cua-control,
  textarea.cua-control {
    transition: none;
  }

  .kc-btn:hover,
  .kc-btn:active {
    transform: none;
  }
}

@media (forced-colors: active) {
  .kc-btn__mark--google {
    display: none;
  }

  .kc-btn-primary,
  .kc-btn-primary:hover,
  .kc-btn-primary:active,
  .kc-btn-broker-primary,
  .kc-btn-broker-primary:hover,
  .kc-btn-broker-primary:active,
  #linkAccount {
    background: ButtonFace;
    border: 1px solid ButtonText;
    color: ButtonText;
  }

  .kc-btn,
  .kc-btn:hover,
  .kc-btn:active {
    opacity: 1;
    box-shadow: none;
    transform: none;
  }

  .kc-btn:disabled,
  .kc-btn[aria-disabled="true"] {
    border-color: GrayText;
    color: GrayText;
  }

  .kc-btn-secondary,
  .cua-btn-icon {
    border-color: ButtonText;
    color: ButtonText;
  }

  html:not(:has(#cua-editorial)) .cua-login {
    display: block;
  }

  html:not(:has(#cua-editorial)) .cua-login::before {
    display: none;
  }

  .cua-tile,
  .cua-authlist,
  .cua-panel,
  .cua-journey__dot {
    background: Canvas;
    border-color: CanvasText;
    color: CanvasText;
  }

  #kc-totp-secret-qr-code {
    background: Canvas;
    border-color: CanvasText;
  }
}

@media (max-width: 379px) {
  .cua-login {
    padding: 16px;
  }

  .cua-login__main {
    padding: 20px;
  }

  html:has(#cua-editorial) .cua-login {
    padding: 0;
  }

  html:has(#cua-editorial) .cua-login__main {
    padding: 0;
  }

  html:not(:has(#cua-editorial)) .cua-login__container {
    padding: 28px 20px;
  }

  #kc-recovery-codes-list {
    grid-template-columns: 1fr;
  }

  .kcSocialProviders {
    grid-template-columns: 1fr;
  }

  #kc-register-form {
    grid-template-columns: 1fr;
  }

  #kc-register-form > .kc-field:has(#firstName),
  #kc-register-form > .kc-field:has(#lastName) {
    grid-column: 1;
  }
}

/* Keycloak 26.7: provider grid (more than three providers on parent pages). */
.cua-social--grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.cua-social__name {
  margin: 0 auto;
}

.cua-social__item.cua-social__item--grid {
  list-style: none;
}

.kc-btn.cua-is-disabled,
.kc-btn[aria-disabled="true"] {
  opacity: 0.6;
  pointer-events: none;
}

/* Keycloak 26.7: the copy box on the code page (field.clipboard). */
.cua-clip {
  border: 1px solid var(--kc-line-soft);
  border-radius: var(--kc-radius-card, 16px);
  background: var(--kc-bg-elev-1);
  overflow: hidden;
}

.cua-clip__group {
  padding: 8px;
}

.cua-clip__content {
  margin: 0;
  padding: 12px 16px;
  border-top: 1px solid var(--kc-line-soft);
  color: var(--kc-ink-strong);
  overflow-x: auto;
}

.cua-clip__content[hidden] {
  display: none;
}

.cua-clip__content pre,
.cua-clip__content code {
  margin: 0;
  color: inherit;
  font-family: var(--kc-font-mono, "JetBrains Mono", ui-monospace, monospace);
  font-size: 14px;
  white-space: pre-wrap;
  word-break: break-all;
}

.cua-clip.cua-is-expanded {
  border-color: var(--kc-line-strong);
}

.cua-authlist__subtitle {
  color: var(--kc-ink-muted);
  font-size: 13px;
}

.cua-trace {
  margin: 0 0 16px;
  color: var(--kc-ink-muted);
  font-size: 13px;
  word-break: break-all;
}

/* Keycloak 26.7 shows the identified email (read-only, with a restart button)
 * above every page of a flow that already knows it. The Cua split pages carry
 * the email in their own form, so hide the duplicate there; parent-owned pages
 * such as the OTP step keep it. */
html:has(#cua-editorial) .cua-login__body > .cua-contentwrap:has(#kc-attempted-username) {
  display: none;
}
