/* === Tokens ============================================================= */
:root{
  --primary:#3fc1c9;
  --bg-from:#f1f5f9;
  --bg-to:rgba(63,193,201,.40);
  --text:#0f172a;
  --muted:#64748b;
  --card-bg:#fff;
  --border:#e2e8f0;
}

/* === Base =============================================================== */
*,*::before,*::after{ box-sizing:border-box; }
html,body{ min-height:100%; height:auto; margin:0; }
/* iOS Safari inflates text blocks it considers too small for the layout ("font boosting"),
   which made these pages render noticeably larger on iPhones than the sizes below specify —
   most visibly on the passkey pages, whose descriptions sit at .82rem (~10.7px on phones).
   The frontend never showed this because Tailwind's preflight already sets the property. */
html{ -webkit-text-size-adjust:100%; text-size-adjust:100%; }
/* Fluid root font-size: everything else is sized in rem, so the whole UI
   (type + spacing) scales with the viewport. 16px at >=1500px (unchanged on
   large screens), scaling gently down to 14px around 400px. */
html{ font-size:clamp(14px, 0.18vw + 13.3px, 16px); }
/* Pages that fall back to upstream templates (passkey register/authenticate, and every other
   non-overridden one) additionally load Keycloak's PatternFly bundle. PatternFly v4 contains
   `html{font-size:var(--pf-global--root--FontSize,unset)!important}` — an !important on the ROOT
   element, which silently defeated the scaling above and left those pages ~23% too large on phones.
   Feeding the variable steers that rule instead of fighting it. PatternFly v3 additionally pins
   `body{font-size:12px}`, so body is tied back to the root size here. */
:root{ --pf-global--root--FontSize: clamp(14px, 0.18vw + 13.3px, 16px); }
body{ font-size:1rem; }
body{
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Helvetica Neue, Arial, "Apple Color Emoji","Segoe UI Emoji";
  color:var(--text);
  background: radial-gradient(circle at 22% 34%, rgba(53,189,200,.06), transparent 18rem), #fff;
  background-repeat:no-repeat;
  background-attachment:fixed;
  background-size:100% 100%;
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
  overflow-x:hidden;
}

/* Small muted subtitle used on the update-password sub-page */
.kc-subtitle{ margin:.5rem 0 .25rem; color:var(--muted); line-height:1.55; }

/* === Inputs ============================================================= */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="number"],
input[type="search"]{
  display:block; width:100%;
  border:1px solid var(--border);
  border-radius:.6rem;
  padding:.7rem .85rem;
  font-size:1rem; outline:0;
  background:#fff;
  transition:border-color .2s, box-shadow .2s;
}
input:focus{
  border-color:var(--primary);
  box-shadow:0 0 0 3px rgba(63,193,201,.22);
}
.kc-field{ margin-bottom:1rem; }
.kc-field label{ display:block; font-size:.9rem; margin-bottom:.375rem; }

/* === Buttons ============================================================= */
.kc-btn{
  appearance:none;
  display:inline-flex; align-items:center; justify-content:center; gap:.45rem;
  padding:.7rem .9rem;
  border:1px solid var(--border);
  border-radius:.5rem;
  background:#fff; color:var(--text);
  font-weight:600; text-decoration:none; cursor:pointer;
  transition:background-color .2s, border-color .2s, box-shadow .2s, transform .05s;
}
.kc-btn:hover{ text-decoration:none; }
.kc-btn:focus-visible{ outline:0; border-color:var(--primary); box-shadow:0 0 0 3px rgba(63,193,201,.25); }
.kc-btn:active{ transform:translateY(1px); }
.kc-btn--primary{ background:var(--primary); color:#fff; border-color:var(--primary); }
.kc-btn--primary:hover{ filter:brightness(.98); }
.kc-btn--outline{ background:#fff; color:var(--primary); border-color:var(--primary); }
.kc-btn--outline:hover{ background:rgba(63,193,201,.08); }
.kc-btn--ghost{ background:transparent; color:var(--primary); border-color:transparent; }
.kc-btn--ghost:hover{ background:#f8fafc; }
.kc-btn--sm{ padding:.55rem .75rem; font-size:.95rem; }
.kc-actions{ display:grid; gap:.6rem; margin-top:.4rem; }
/* Primary submit buttons — matched to the login page's .cl-btn (size, radius, weight, hover) */
.kc-actions .kc-btn{ width:100%; background:var(--primary); color:#fff; border-color:var(--primary); font-weight:500; font-size:.98rem; padding:.85rem 1rem; border-radius:.6rem; }
.kc-actions .kc-btn:hover{ transform:translateY(-1px); box-shadow:0 12px 24px -12px rgba(63,193,201,.7); filter:brightness(1.02); }
.kc-links{ margin-top:.75rem; text-align:center; display:flex; flex-direction:column; align-items:center; gap:.5rem; }
.kc-links a{ color:var(--primary); text-decoration:none; font-size:.9rem; }
.kc-links a:hover{ text-decoration:underline; }

/* === Alerts ============================================================= */
.kc-alert{
  display:flex; gap:.5rem; align-items:flex-start;
  margin:.75rem 0 1rem; padding:.75rem 1rem;
  border-radius:.5rem; border:1px solid;
  background:#fffbeb; color:#92400e;
  font-size:.95rem;
}
.kc-alert .kc-alert-icon{ font-weight:700; line-height:1.2; }
.kc-alert.is-error{ background:#FEF2F2; border-color:#FCA5A5; color:#991B1B; }
.kc-alert.is-success{ background:#ECFDF5; border-color:#A7F3D0; color:#065F46; }
.kc-alert.is-info{ background:#EFF6FF; border-color:#93C5FD; color:#1E40AF; }

/* === Toolbar ============================================================ */
.kc-toolbar{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:.6rem;
  margin:1rem 0 1.25rem;
}
@media (max-width:560px){ .kc-toolbar{ grid-template-columns:1fr; } }

/* === Recovery codes grid =============================================== */
/* Show the codes in a compact 2-column grid (auto-fits to 1 col when narrow) instead of a
   tall single-column list — all codes stay visible/saveable, the card is just shorter. */
.kc-code-list{
  list-style:none; margin:.25rem 0 .5rem; padding:0;
  display:grid; grid-template-columns:repeat(auto-fit, minmax(9rem, 1fr)); gap:.3rem 1.4rem;
  counter-reset:rc;
}
.kc-code-list li{
  display:flex; align-items:baseline; gap:.55rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size:.95rem; letter-spacing:.01em; color:var(--text); font-variant-numeric:tabular-nums;
}
.kc-code-list li::before{
  content:counter(rc) "."; counter-increment:rc;
  color:var(--muted); font-size:.8rem; min-width:1.4rem; text-align:right; flex:0 0 auto;
}

/* === Form Actions Grid ================================================= */
.kc-actions-form{ display:grid; gap:.6rem; grid-template-columns:1fr; }
@media (min-width:560px){ .kc-actions-form{ grid-template-columns:1fr 1fr; } }
.kc-actions-form > *:only-child{ grid-column:1 / -1; }

/* === WebAuthn / Passkey pages ========================================== */
/* These pages render upstream Keycloak markup (PatternFly classes) inside the
   shared fallback card. We restyle the action buttons by their stable IDs so the
   passkey JS bindings stay untouched. ID specificity beats the PatternFly classes. */
#authenticateWebAuthnButton,
#registerWebAuthn,
#kc-try-again{
  display:block; width:100%;
  border:1px solid var(--primary); border-radius:.6rem; outline:0;
  background:var(--primary); color:#fff;
  font-family:inherit; font-weight:500; font-size:.98rem; line-height:1.2;
  padding:.85rem 1rem; cursor:pointer;
  transition:filter .2s, transform .05s, box-shadow .2s;
}
#authenticateWebAuthnButton:hover,
#registerWebAuthn:hover,
#kc-try-again:hover{ transform:translateY(-1px); box-shadow:0 12px 24px -12px rgba(63,193,201,.7); filter:brightness(1.02); }
#authenticateWebAuthnButton:active,
#registerWebAuthn:active,
#kc-try-again:active{ transform:translateY(0); }
/* Replace the browser's default (black) focus ring — the button is autofocused */
#authenticateWebAuthnButton:focus-visible,
#registerWebAuthn:focus-visible,
#kc-try-again:focus-visible{ box-shadow:0 0 0 3px rgba(63,193,201,.45); }
/* Secondary "Cancel" button (app-initiated passkey registration) */
#cancelWebAuthnAIA{
  display:block; width:100%; margin-top:.6rem;
  border:1px solid var(--border); border-radius:.6rem; outline:0;
  background:#fff; color:var(--primary);
  font-family:inherit; font-weight:600; font-size:.98rem; line-height:1.2;
  padding:.85rem 1rem; cursor:pointer; transition:background-color .2s;
}
#cancelWebAuthnAIA:hover{ background:rgba(63,193,201,.08); }
#cancelWebAuthnAIA:focus-visible{ border-color:var(--primary); box-shadow:0 0 0 3px rgba(63,193,201,.25); }
/* The register/error "header" section may carry a PatternFly key glyph — hide it in our title */
.cl-card-title .pficon,
.cl-welcome-title .pficon{ display:none; }

/* WebAuthn authenticator chooser (shown when the user has several passkeys).
   Upstream renders PatternFly "select-auth-box-*" markup; restyle it to match our
   info cards. These items are informational — the button below triggers auth. */
.select-auth-box-paragraph{
  margin:0 0 .65rem; color:var(--muted);
  font-size:.82rem; font-weight:600; text-transform:uppercase; letter-spacing:.04em;
}
.select-auth-box-parent{
  display:flex; align-items:center; gap:.85rem;
  padding:.7rem .85rem; margin:0 0 .55rem;
  border:1px solid var(--border); border-radius:.65rem; background:#fff;
}
.select-auth-box-icon{
  display:inline-flex; align-items:center; justify-content:center; flex:0 0 auto;
  width:2.4rem; height:2.4rem; margin:0;
  border-radius:.6rem; background:rgba(63,193,201,.12);
}
.select-auth-box-icon i,
.select-auth-box-icon .select-auth-box-icon-properties{
  font-size:1.1rem !important; color:var(--primary); line-height:1;
}
.select-auth-box-parent .select-auth-box-headline{
  margin:0; padding:0; font-size:.97rem; font-weight:600; color:var(--text);
}
.select-auth-box-parent .select-auth-box-desc{
  font-size:.82rem; color:var(--muted); line-height:1.35;
}
/* PatternFly v3 is Bootstrap-based and pulls `.form-group` out by -20px on each side to cancel
   grid gutters that our card does not have — which made the credential rows sit flush against
   (and 2px past) the card edge. Same specificity as upstream, and our sheet loads last. */
.cl-card .form-group,
.cl-card .row{ margin-left:0; margin-right:0; }

/* Empty PatternFly spacer that would otherwise stretch the row */
.select-auth-box-parent .pf-m-fill{ display:none; }
/* Space the action button away from the list */
#kc-form-buttons{ margin-top:.6rem; }

/* === Auth Options (method picker) ====================================== */
.kc-auth-grid{ display:flex; flex-direction:column; gap:.6rem; margin-top:.25rem; }
.kc-auth-option{ margin:0; padding:0; border:0; }
.kc-auth-option-btn{
  position:relative;
  width:100%;
  justify-content:flex-start !important;
  align-items:center;
  text-align:left;
  gap:.9rem;
  padding:.95rem 2.75rem .95rem 1rem;
  border:1px solid var(--border) !important;
  background:#fff !important;
  color:var(--text);
  border-radius:.8rem;
  box-shadow:none;
  transition:border-color .2s, box-shadow .2s, background-color .2s, transform .05s;
}
.kc-auth-option-btn:hover{ background:rgba(63,193,201,.05) !important; border-color:var(--primary) !important; color:var(--text); text-decoration:none; box-shadow:0 8px 20px -12px rgba(63,193,201,.55); }
.kc-auth-option-btn:active{ transform:translateY(1px); }
/* chevron on the right */
.kc-auth-option-btn::after{
  content:""; position:absolute; right:1rem; top:50%; transform:translateY(-50%);
  width:18px; height:18px; opacity:.45;
  background:no-repeat center/contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23566781' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 18 6-6-6-6'/%3E%3C/svg%3E");
}
.kc-auth-option-btn:hover::after{ opacity:1; }
/* left icon badge */
.kc-auth-option-icon{
  display:inline-flex; align-items:center; justify-content:center; flex:0 0 auto;
  width:42px; height:42px; border-radius:.6rem;
  background:#f3fbfb; color:var(--primary); border:1px solid #cdebee;
}
.kc-auth-option-icon svg{ width:20px; height:20px; }
.kc-auth-option-text{ display:flex; flex-direction:column; gap:.15rem; min-width:0; text-align:left; }
.kc-auth-option-title{ font-weight:600; color:var(--text); font-size:.95rem; }
.kc-auth-option-help{ color:var(--muted); font-size:.85rem; line-height:1.4; font-weight:400; text-align:left; }

/* === Misc Controls ====================================================== */
.kc-checkbox-inline{ display:inline-flex; align-items:flex-start; gap:.55rem; line-height:1.35; cursor:pointer; user-select:none; }
.kc-checkbox-inline input[type="checkbox"]{ margin-top:.15rem; }
.kc-hint{ margin-top:.35rem; font-size:.9rem; color:#b91c1c; }
.kc-list{ margin:8px 0 16px; padding-left:1.25rem; color:var(--muted); }
.kc-list li{ margin:4px 0; }
input[maxlength="6"][type="text"]{ letter-spacing:.35em; text-align:center; font-variant-numeric:tabular-nums; font-weight:700; }

/* === Utility ============================================================ */
.sr-only{
  position:absolute; width:1px; height:1px; padding:0; margin:-1px;
  overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0;
}

body.cl-login{
  background:#fff;
}
.cl-login *,
.cl-login *::before,
.cl-login *::after{ box-sizing:border-box; }

.cl-page{
  position:relative;
  isolation:isolate;
  display:flex;
  flex-direction:column;
  min-height:100vh;
  min-height:100dvh;
  color:var(--text);
  background:radial-gradient(circle at 22% 34%, rgba(53,189,200,.08), transparent 18rem), #fff;
  overflow:hidden;
}

/* Decorative shapes (palette matched to the 502 error page) */
.cl-decor{ position:absolute; z-index:-1; pointer-events:none; }
.cl-decor--c1{ top:clamp(-340px,-16vw,-190px); right:clamp(-280px,-11vw,-130px); width:clamp(620px,52vw,1040px); height:clamp(620px,52vw,1040px); border-radius:50%; background:linear-gradient(200deg, rgba(72,200,209,.20), rgba(72,200,209,.06)); }
.cl-decor--c2{ bottom:clamp(-320px,-15vw,-190px); left:clamp(-160px,-6vw,-70px); width:clamp(440px,34vw,720px); height:clamp(440px,34vw,720px); border-radius:50%; background:linear-gradient(160deg, rgba(72,200,209,.20), rgba(72,200,209,.06)); }
.cl-decor--c3{ bottom:clamp(-560px,-25vw,-360px); left:clamp(-260px,-10vw,-150px); width:clamp(580px,46vw,980px); height:clamp(580px,46vw,980px); border-radius:50%; background:linear-gradient(160deg, rgba(72,200,209,.13), rgba(72,200,209,.04)); }
.cl-decor--dots{ bottom:8%; left:3.5%; width:220px; height:170px; background-image:radial-gradient(rgba(53,189,200,.46) 2.15px, transparent 2.8px); background-size:22px 22px; -webkit-mask-image:radial-gradient(ellipse at center,#000 4%,rgba(0,0,0,.55) 42%,rgba(0,0,0,.2) 72%,transparent 100%); mask-image:radial-gradient(ellipse at center,#000 4%,rgba(0,0,0,.55) 42%,rgba(0,0,0,.2) 72%,transparent 100%); }

/* Top bar */
.cl-topbar{ display:flex; align-items:center; justify-content:space-between; padding:1.6rem 3rem 0; z-index:2; position:relative; }
/* translateY compensates for the logo's baked-in tagline so the wordmark's optical
   centre lines up with the language pill's centre */
.cl-logo{ height:46px; width:auto; transform:translateY(5px); }

/* Language dropdown */
.cl-lang{ position:relative; }
.cl-lang summary{ list-style:none; cursor:pointer; display:inline-flex; align-items:center; gap:.45rem; padding:.45rem .85rem; border:1px solid var(--border); border-radius:999px; background:rgba(255,255,255,.85); backdrop-filter:saturate(160%) blur(6px); color:var(--text); font-size:.85rem; font-weight:600; box-shadow:0 2px 8px rgba(2,6,23,.05); transition:border-color .2s, box-shadow .2s; }
.cl-lang summary::-webkit-details-marker{ display:none; }
.cl-lang summary:hover{ border-color:var(--primary); }
.cl-lang[open] summary{ border-color:var(--primary); box-shadow:0 0 0 3px rgba(63,193,201,.18); }
.cl-lang-globe{ width:15px; height:15px; color:var(--muted); }
.cl-lang-caret{ width:14px; height:14px; color:var(--muted); transition:transform .2s; }
.cl-lang[open] .cl-lang-caret{ transform:rotate(180deg); }
.cl-lang ul{ position:absolute; right:0; margin:.45rem 0 0; padding:.35rem; min-width:100%; list-style:none; background:#fff; border:1px solid var(--border); border-radius:.75rem; box-shadow:0 16px 34px -16px rgba(2,6,23,.28); z-index:5; }
.cl-lang li a{ display:block; padding:.42rem .7rem; border-radius:.5rem; color:var(--text); text-decoration:none; font-size:.85rem; white-space:nowrap; }
.cl-lang li a:hover{ background:#f1f5f9; }
.cl-lang li a[aria-selected="true"]{ color:var(--primary); font-weight:700; }

/* Content + grid */
.cl-content{ flex:1 1 auto; display:flex; flex-direction:column; justify-content:center; padding:1rem clamp(2rem,4vw,4.5rem); min-height:0; }
/* Wide, centred container with the two capped columns pushed apart (space-between):
   welcome hugs the left, card hugs the right, equal outer margins at every width.
   The empty middle is intentional (the decorative circles live there). */
/* The grid fills the full content height (flex:1 + a single 1fr row) so each column can be
   positioned vertically on its own: the hero pins to the top (fixed position, independent of
   the card's height), the card stays vertically centred where it is. */
.cl-grid{ width:100%; max-width:1380px; margin:0 auto; flex:1 1 auto; display:grid; grid-template-columns:minmax(0,33rem) minmax(400px,500px); grid-template-rows:1fr; gap:3rem; justify-content:space-between; align-items:center; }

/* Left welcome — pinned to the top of the (full-height) grid, so its position is the SAME
   on every page regardless of the card's height. */
.cl-welcome{ max-width:33rem; align-self:start; margin-top:clamp(5rem,16vh,11rem); animation:cl-rise .6s cubic-bezier(.16,1,.3,1) both; }
.cl-card-col{ align-self:center; }
@keyframes cl-rise{ from{opacity:0; transform:translateY(14px);} to{opacity:1; transform:translateY(0);} }
.cl-welcome-title{ margin:0; font-size:clamp(2.4rem,4vw,3.25rem); font-weight:700; letter-spacing:-.035em; line-height:1.05; }
.cl-welcome-accent{ display:block; width:54px; height:4px; border-radius:999px; background:var(--primary); margin:1.1rem 0 1.25rem; }
.cl-welcome-sub{ margin:0; color:#334155; font-size:1.12rem; font-weight:500; line-height:1.62; max-width:25rem; }

/* Right column: card + trust note */
.cl-card-col{ display:flex; flex-direction:column; align-items:stretch; }
/* Sub-pages: reserve a login-sized column height so the left heading lines up at the
   same vertical position as on the login page (shorter cards would otherwise sit lower). */
.cl-sub .cl-card-col{ min-height:26rem; }

/* Card (borderless, clean white; shadow balanced top+bottom) */
.cl-card{ width:100%; background:#fff; border:0; border-radius:1.15rem; box-shadow:0 -6px 22px rgba(17,29,51,.04), 0 10px 40px rgba(17,29,51,.10), 0 4px 16px rgba(53,189,200,.10); padding:2.9rem 2.85rem 3.2rem; animation:cl-rise .6s cubic-bezier(.16,1,.3,1) .05s both; }
.cl-card-title{ margin:0 0 2.3rem; font-size:1.55rem; font-weight:700; letter-spacing:-.015em; }
/* Optional short instruction directly under the card title (pulled up close to it) */
.cl-card-sub{ margin:-1.7rem 0 1.9rem; color:var(--muted); font-size:.95rem; line-height:1.55; }

/* Centred card variant (e.g. error page): badge + message + action, all centred */
.cl-card--center{ display:flex; flex-direction:column; align-items:center; text-align:center; }
.cl-card-badge{ display:inline-flex; align-items:center; justify-content:center; width:56px; height:56px; border-radius:50%; margin-bottom:1.3rem; background:#fffbeb; color:#d97706; border:1px solid #fde68a; }
.cl-card-badge svg{ width:28px; height:28px; }
.cl-card-message{ margin:0 0 1.8rem; color:var(--text); font-size:1.02rem; line-height:1.55; max-width:24rem; }
.cl-card .kc-alert{ margin:0 0 1rem; }

/* Dense variant for content-heavy cards (e.g. backup-codes config) — tighter
   inner spacing so the card stays shorter without hiding any content. */
.cl-card--dense{ padding:2.5rem 2.6rem 2.7rem; }
.cl-card--dense .cl-card-title{ margin-bottom:1.6rem; }
.cl-card--dense .kc-alert{ margin:0 0 .9rem; padding:.7rem .95rem; }
.cl-card--dense .kc-code-list{ margin:.25rem 0 .5rem; }
.cl-card--dense .kc-toolbar{ margin:.85rem 0 1.05rem; }
.cl-card--dense .kc-field{ margin-bottom:.9rem; }

/* Terms page: short consent text with links (rendered as plain body text) */
.kc-terms{ margin:0 0 .5rem; color:var(--text); font-size:.98rem; line-height:1.62; }
.kc-terms p{ margin:0; }
.kc-terms a{ color:var(--primary); text-decoration:underline; font-weight:600; }
.kc-terms a:hover{ filter:brightness(.97); }

/* Fields */
.cl-form{ display:flex; flex-direction:column; gap:1.7rem; }
/* Denser variant for content-heavy cards (e.g. 2FA setup) */
.cl-form--compact{ gap:1.15rem; }

/* Collapsible disclosure (e.g. "enter the key manually" on the 2FA setup page) */
.cl-disclose > summary{ list-style:none; cursor:pointer; display:inline-flex; align-self:center; align-items:center; gap:.4rem; color:var(--primary); font-size:.88rem; font-weight:600; padding:.1rem 0; }
.cl-disclose > summary::-webkit-details-marker{ display:none; }
.cl-disclose > summary:hover{ text-decoration:underline; }
.cl-disclose > summary::after{ content:""; width:14px; height:14px; flex:0 0 auto; background:no-repeat center/contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%233fc1c9' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); transition:transform .2s; }
.cl-disclose[open] > summary::after{ transform:rotate(180deg); }
.cl-disclose{ display:flex; flex-direction:column; }
.cl-field{ display:flex; flex-direction:column; gap:.4rem; }
.cl-field > label{ font-size:.85rem; font-weight:600; color:var(--text); }
.cl-input{ position:relative; display:flex; align-items:center; }
.cl-input-icon{ position:absolute; left:.85rem; display:inline-flex; color:var(--muted); pointer-events:none; }
.cl-input-icon svg{ width:18px; height:18px; }
.cl-input input{ width:100%; border:1px solid var(--border); border-radius:.6rem; padding:.7rem .85rem .7rem 2.5rem; font-size:.97rem; outline:0; background:#fff; color:var(--text); transition:border-color .2s, box-shadow .2s; }
.cl-input input::placeholder{ color:#9aa7b5; }
.cl-input input:focus{ border-color:var(--primary); box-shadow:0 0 0 3px rgba(63,193,201,.22); }
.cl-input input[id^="password"]{ padding-right:2.75rem; }
/* Keep fields white even when the browser autofills saved credentials */
.cl-input input:-webkit-autofill,
.cl-input input:-webkit-autofill:hover,
.cl-input input:-webkit-autofill:focus{ -webkit-text-fill-color:var(--text); -webkit-box-shadow:0 0 0 1000px #fff inset; box-shadow:0 0 0 1000px #fff inset; caret-color:var(--text); }

/* Password reveal toggle */
.cl-eye{ position:absolute; right:.5rem; display:inline-flex; align-items:center; justify-content:center; width:2rem; height:2rem; border:0; background:transparent; color:var(--muted); cursor:pointer; border-radius:.4rem; }
.cl-eye:hover{ color:var(--text); }
.cl-eye svg{ width:18px; height:18px; }
.cl-eye .cl-eye-off{ display:none; }
.cl-eye[aria-pressed="true"] .cl-eye-on{ display:none; }
.cl-eye[aria-pressed="true"] .cl-eye-off{ display:inline; }

/* Row: remember + forgot */
.cl-row{ display:flex; align-items:center; justify-content:space-between; gap:1rem; }
.cl-remember{ display:inline-flex; align-items:center; gap:.5rem; color:var(--muted); font-size:.88rem; cursor:pointer; }
.cl-remember input{ width:1rem; height:1rem; accent-color:var(--primary); }
.cl-forgot{ color:var(--primary); text-decoration:none; font-size:.88rem; font-weight:600; }
.cl-forgot:hover{ text-decoration:underline; }

/* Submit */
.cl-btn{ appearance:none; width:100%; margin-top:.6rem; display:inline-flex; align-items:center; justify-content:center; gap:.5rem; padding:.85rem 1rem; border:1px solid var(--primary); border-radius:.6rem; background:var(--primary); color:#fff; font-weight:500; font-size:.98rem; text-decoration:none; cursor:pointer; transition:transform .2s, box-shadow .2s, filter .2s; }
.cl-btn:hover{ transform:translateY(-1px); box-shadow:0 12px 24px -12px rgba(63,193,201,.7); filter:brightness(1.02); }
.cl-btn:active{ transform:translateY(1px); }

/* "or" divider */
.cl-or{ display:flex; align-items:center; gap:.85rem; margin:2rem 0; color:var(--muted); font-size:.82rem; }
.cl-or span{ flex:0 0 auto; }
.cl-or::before, .cl-or::after{ content:""; flex:1 1 0; height:1px; background:var(--border); }

/* Help link — icon optically centred to the text (line-height:1 collapses the leading
   so align-items:center matches the visible glyphs); both turn primary on hover */
.cl-help{ display:inline-flex; align-items:center; justify-content:center; gap:.45rem; width:100%; line-height:1; color:var(--text); text-decoration:none; font-size:.9rem; font-weight:600; }
/* Same look when used on a <button> (e.g. "try another way" posts a form) */
button.cl-help{ appearance:none; background:transparent; border:0; padding:0; font-family:inherit; cursor:pointer; }
.cl-help svg{ display:block; width:16px; height:16px; flex:0 0 auto; color:var(--muted); transition:color .2s; }
.cl-help:hover{ color:#179aa5; }
.cl-help:hover svg{ color:#179aa5; }

/* Trust note — centered under the card */
.cl-foot{ display:flex; align-items:center; justify-content:center; gap:.45rem; margin:2.25rem 0 0; color:var(--muted); font-size:.82rem; }
.cl-foot svg{ width:14px; height:14px; }
.cl-flag{ width:15px; height:15px; border-radius:3px; }

/* Responsive */

/* 1340–1600px: not enough room for the full spread, so distribute space evenly across
   left | middle | right (space-evenly) → balanced gap and outer margins. Above 1600px
   the default space-between pushes the columns fully apart. */
@media (max-width:1600px){
  .cl-content{ padding:1rem clamp(2rem,3vw,3.5rem); }
  .cl-grid{ max-width:none; justify-content:space-evenly; }
}

/* The two-column hero only works when there's genuinely room for both the welcome
   copy and a comfortable card. Below ~1340px we collapse to a single, centred column
   (just the card) — cleaner than a cramped two-column. */
@media (max-width:1340px){
  /* Topbar floats as an overlay so it takes no flow space → the card can centre on the
     FULL screen height, not just the area below the logo/language. */
  .cl-topbar{ position:absolute; top:0; left:0; right:0; padding:1.4rem clamp(1.25rem,4vw,2.75rem) 0; }
  /* Centre the card over the whole viewport height via auto margins (not justify-content):
     auto margins centre when there's spare room but never go negative, so a tall card simply
     top-aligns below the ~5rem padding (clear of the overlay topbar) and the page scrolls —
     no clipping, and no reliance on the patchily-supported `safe center`. */
  /* Top padding is locked to the overlay topbar's height (1.4rem pad + 46px logo) plus a
     ~0.8rem buffer, so the card always clears the logo/language pill regardless of how far
     the root font (and thus 5rem) scales down. max() keeps the larger of the two. */
  .cl-content{ justify-content:flex-start; padding:max(5rem, calc(46px + 2.2rem)) clamp(1.25rem,4vw,2.75rem); }
  .cl-grid{ grid-template-columns:1fr; grid-template-rows:none; flex:0 1 auto; gap:0; max-width:460px; margin:auto; align-items:stretch; }
  /* Hide the welcome hero on tablet/mobile — just the centred card */
  .cl-welcome{ display:none; }
  .cl-decor--dots{ display:none; }
  .cl-decor--c3{ display:none; }
}
@media (max-width:480px){
  /* Compact phone layout: drop the root rem so type AND rem-based spacing shrink together,
     then trim the few largest gaps a little further. */
  html{ font-size:13px; }
  :root{ --pf-global--root--FontSize:13px; }
  .cl-logo{ height:30px; }
  /* Same clearance guarantee at phone size (logo is 30px here) */
  .cl-content{ padding:max(4.25rem, calc(30px + 2rem)) 1.25rem 2.5rem; }
  .cl-card{ padding:1.7rem 1.4rem 1.8rem; }
  /* kept in sync with .cl-card-sub's negative top margin (reset page) */
  .cl-card-title{ margin-bottom:1.85rem; }
  .cl-form{ gap:1.15rem; }
  .cl-or{ margin:1.5rem 0; }
  .cl-foot{ margin-top:1.7rem; }
  .cl-decor--c1{ opacity:.7; }
  /* Stack "remember me" and "reset password" on their own lines instead of
     squeezing them side by side (which wraps both texts). */
  .cl-row{ flex-direction:column; align-items:flex-start; gap:.85rem; }
}
/* Sub-pages behave exactly like the login page on narrow screens: the hero is hidden
   (not stacked) and only the centred card shows. The card carries its own title, so no
   context is lost. (Handled by the base ≤1340px rule above — no .cl-sub override needed.) */

@media (prefers-reduced-motion: reduce){
  .cl-welcome, .cl-card{ animation:none; }
}
