/* Access surfaces: sign-in, activation, recovery and verification gates.
   Scoped by .auth-* names (plus the .auth-body/.security-standalone page hooks); colours come from the shared tokens in app.css.
   These pages run under a strict CSP: no inline styles, no data: images, no web fonts. */

:where(.auth-page),:where(.auth-page) :where(*,*::before,*::after){box-sizing:border-box}
:where(.auth-page) :where(h1,h2,h3,p,ol,ul,figure,fieldset,legend,form,dl,dd){margin:0;padding:0}
:where(.auth-page) :where(ol,ul){list-style:none}
:where(.auth-page) :where(button,input){font:inherit;color:inherit}
:where(.auth-page) :where(button){border:0;background:none;cursor:pointer}
:where(.auth-page) :where(a){color:inherit}
:where(.auth-page) :where(svg){display:block}

.auth-body,.security-standalone{margin:0;background:var(--canvas,#f3f7fb);color:var(--text,#2d2d2d);font-family:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;line-height:1.5;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility}

.auth-page{--auth-navy-deep:#102a52;position:relative;display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:auto 1fr;min-height:100vh;min-height:100dvh;overflow-x:clip}
.auth-sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;border:0}
.auth-skip{position:absolute;top:.5rem;left:1rem;z-index:100;padding:.7rem 1rem;border:2px solid var(--accent,#1487c9);border-radius:.6rem;background:var(--surface,#fff);color:var(--ink,#2d2d2d);font-weight:650;transform:translateY(-250%)}
.auth-skip:focus{transform:none}

/* Brand: compact band on small screens, full panel from 1024px. */
.auth-lockup{display:inline-flex;align-items:center;gap:.7rem;color:#fff}
.auth-mark{display:grid;place-items:center;flex:none;width:2.5rem;height:2.5rem;border-radius:.75rem;background:var(--brand-sky,#79b5e4);color:var(--brand-primary,#1d427b);font-size:.78rem;font-weight:800;letter-spacing:.02em;box-shadow:0 1px 3px rgba(0,0,0,.18)}
.auth-lockup-text{display:flex;flex-direction:column;line-height:1.15}
.auth-lockup-text strong{font-size:1.0625rem;font-weight:750;letter-spacing:-.01em}
.auth-lockup-text small{font-size:.75rem;color:rgba(255,255,255,.74)}

.auth-brandbar{display:flex;align-items:center;justify-content:space-between;gap:1rem;padding:1rem 1.25rem 3.5rem;color:#fff;background:linear-gradient(135deg,var(--auth-navy-deep),var(--brand-primary,#1d427b) 70%,#1a5a9a)}
.auth-brand{display:none}

.auth-lang{display:inline-flex;gap:.125rem;padding:.1875rem;border:1px solid rgba(255,255,255,.2);border-radius:999px;background:rgba(255,255,255,.1)}
.auth-lang form{margin:0}
.auth-lang button{display:block;min-width:2.5rem;min-height:2.5rem;padding:0 .7rem;border:0;border-radius:999px;background:transparent;color:rgba(255,255,255,.88);font-size:.8125rem;font-weight:700;letter-spacing:.04em;transition:background-color .15s,color .15s}
.auth-lang button:hover{background:rgba(255,255,255,.16);color:#fff}
.auth-lang button[aria-pressed="true"]{background:#fff;color:var(--brand-primary,#1d427b)}
.auth-lang button:focus-visible{outline:2px solid #fff;outline-offset:2px}

/* Card */
.auth-main{display:flex;flex-direction:column;align-items:center;min-width:0;padding:0 1rem 2rem}
.auth-main:focus{outline:none}
.auth-card{position:relative;width:100%;max-width:30rem;margin-top:-2.5rem;padding:1.5rem 1.25rem;border:1px solid var(--border,#dbe5f0);border-radius:1.25rem;background:var(--surface,#fff);box-shadow:var(--shadow-panel,0 1px 2px rgba(15,23,42,.04),0 14px 36px rgba(20,48,91,.12));animation:auth-rise .32s ease-out both}
.auth-card-header{margin-bottom:1.5rem}
.auth-eyebrow{margin-bottom:.5rem;font-size:.75rem;font-weight:750;letter-spacing:.08em;text-transform:uppercase;color:var(--accent-strong,#1d427b)}
.auth-title{font-size:clamp(1.5rem,1.25rem + 1vw,1.875rem);line-height:1.2;font-weight:750;letter-spacing:-.025em;color:var(--ink,#2d2d2d);overflow-wrap:anywhere}
.auth-lead{margin-top:.6rem;font-size:.9375rem;line-height:1.55;color:var(--text-secondary,#4d5d70)}
.auth-footnote{max-width:30rem;margin:1.25rem auto 0;padding:0 .5rem;text-align:center;font-size:.8125rem;line-height:1.5;color:var(--text-muted,#5c6d81)}

/* Messages: they reuse the shared .flash colours. */
.auth-alert{align-items:flex-start;justify-content:flex-start;gap:.7rem;margin:0 0 1.25rem;padding:.8rem .9rem;font-size:.875rem;line-height:1.45;animation:auth-pop .22s ease-out both}
.auth-alert p{min-width:0;overflow-wrap:anywhere}
.auth-alert-icon{display:flex;flex:none;margin-top:.05rem}
.auth-alert-icon svg{width:1.25rem;height:1.25rem}
.auth-alert-info{border-color:var(--accent-border,#bad4eb);background:var(--accent-soft,#eaf3fb);color:var(--accent-strong,#1d427b)}
.auth-alert-warning{border-color:var(--warning,#f3d58b);background:var(--warning-soft,#fffbeb);color:var(--warning,#92400e)}

/* Forms */
.auth-form{display:grid;gap:1.15rem}
.auth-field{display:grid;gap:.4rem;min-width:0}
.auth-label-row{display:flex;flex-wrap:wrap;align-items:baseline;justify-content:space-between;gap:.15rem .75rem}
.auth-label{margin:0;font-size:.875rem;font-weight:700;color:var(--ink,#2d2d2d)}
.auth-input{min-height:3rem;padding:.7rem .9rem;border-radius:.8rem;font-size:1rem;line-height:1.4}
.auth-input::placeholder{color:var(--text-muted,#5c6d81)}
.auth-input-code{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,"Liberation Mono",monospace;font-size:1.25rem;letter-spacing:.14em;text-align:center}
.auth-input-code::placeholder{letter-spacing:0}
.auth-field.has-error .auth-input,.auth-input[aria-invalid="true"]{border-color:var(--danger,#be123c);box-shadow:0 0 0 3px var(--danger-soft,rgba(190,18,60,.12))}
.auth-input:user-invalid{border-color:var(--danger,#be123c)}
.auth-error{font-size:.8125rem;line-height:1.4;font-weight:600;color:var(--danger,#9f1239)}
.auth-error[hidden]{display:none}
.auth-hint{font-size:.8125rem;line-height:1.5;color:var(--text-muted,#5c6d81)}
.auth-aside{font-size:.75rem;font-weight:600;color:var(--text-muted,#5c6d81)}
.auth-control{position:relative;display:block}
.auth-control.has-toggle .auth-input{padding-right:3.5rem}
.auth-toggle{position:absolute;top:.125rem;right:.125rem;bottom:.125rem;display:inline-flex;align-items:center;justify-content:center;width:2.75rem;border:0;border-radius:.65rem;background:transparent;color:var(--text-secondary,#4d5d70);transition:background-color .15s,color .15s}
.auth-toggle[hidden]{display:none}
.auth-toggle:hover{background:var(--accent-soft,#eaf3fb);color:var(--accent-strong,#1d427b)}
.auth-toggle svg{width:1.25rem;height:1.25rem}
.auth-toggle .auth-icon-hide{display:none}
.auth-toggle[aria-pressed="true"] .auth-icon-show{display:none}
.auth-toggle[aria-pressed="true"] .auth-icon-hide{display:block}

.auth-button{width:100%;min-height:3rem;justify-content:center;padding:.75rem 1.25rem;border-radius:.85rem;font-size:.9375rem;font-weight:700;line-height:1.2;text-align:center;text-decoration:none}
.auth-button svg{flex:none;width:1.125rem;height:1.125rem}

.btn-primary.auth-button:active{transform:none}
.auth-button-compact{width:auto;min-height:2.75rem;padding:.6rem 1.1rem;font-size:.875rem}
.auth-button[aria-disabled="true"]{cursor:progress;opacity:.88;transform:none}
.auth-button[aria-busy="true"]::before{content:"";flex:none;width:1rem;height:1rem;border:2px solid currentColor;border-right-color:transparent;border-radius:50%;animation:auth-spin .7s linear infinite}

.auth-link,.auth-link-button{display:inline-flex;align-items:center;gap:.4rem;min-height:2.75rem;padding:.35rem 0;color:var(--accent-strong,#1d427b);font-size:.9375rem;font-weight:650;text-decoration:underline;text-decoration-thickness:1px;text-underline-offset:.2em}
.auth-link:hover,.auth-link-button:hover{text-decoration-thickness:2px}
.auth-link svg{flex:none;width:1rem;height:1rem}
.auth-link-small{font-size:.8125rem}
.auth-label-row .auth-link-small{min-height:0;margin-block:-.75rem;padding-block:.75rem}
.auth-link-button{border:0;background:none}
.auth-aside-link{text-align:center}

.auth-callout{display:flex;gap:.9rem;margin-top:1.5rem;padding:1rem;border:1px solid var(--border,#dbe5f0);border-radius:1rem;background:var(--surface-alt,#f5f9fd)}
.auth-callout-icon{display:grid;place-items:center;flex:none;width:2.5rem;height:2.5rem;border-radius:.75rem;background:var(--accent-soft,#eaf3fb);color:var(--accent-strong,#1d427b)}
.auth-callout-icon svg{width:1.25rem;height:1.25rem}
.auth-callout-body{display:grid;justify-items:start;gap:.4rem;min-width:0}
.auth-callout-body p{font-size:.875rem;line-height:1.5;color:var(--text-secondary,#4d5d70)}
.auth-callout-body .auth-callout-title{font-size:.9375rem;font-weight:750;color:var(--ink,#2d2d2d)}
.auth-callout-body .auth-button{margin-top:.4rem}
.auth-callout-next{margin:0 0 1.25rem;border-color:var(--accent-border,#bad4eb);background:var(--accent-soft,#eaf3fb)}

.auth-note{text-align:center;font-size:.8125rem;line-height:1.5;color:var(--text-muted,#5c6d81)}
.auth-flow{display:grid;gap:1.25rem;min-width:0}
.auth-flow>.auth-steps,.auth-flow>.auth-callout-next,.auth-flow>.auth-key-block,.auth-flow>.auth-codes,.auth-flow>.auth-details{margin:0}
.auth-flow>.auth-section,.auth-flow>.auth-footer-links{margin-top:.25rem}
.auth-section{display:grid;gap:.75rem;margin-top:1.5rem;padding-top:1.25rem;border-top:1px solid var(--border,#dbe5f0)}
.auth-section form{margin:0}
.auth-footer-links{display:flex;flex-wrap:wrap;align-items:center;justify-content:center;gap:.25rem 1.25rem;margin-top:1.5rem;padding-top:.5rem;border-top:1px solid var(--border,#dbe5f0)}
.auth-details{margin-top:.25rem}
.auth-details summary{display:flex;align-items:center;min-height:2.75rem;color:var(--accent-strong,#1d427b);font-size:.875rem;font-weight:650;list-style:none;cursor:pointer}
.auth-details summary::-webkit-details-marker{display:none}
.auth-details summary::after{content:"";flex:none;width:.45rem;height:.45rem;margin:-.2rem 0 0 .6rem;border-right:2px solid currentColor;border-bottom:2px solid currentColor;transform:rotate(45deg);transition:transform .15s}
.auth-details summary:focus-visible{border-radius:.4rem;outline:2px solid var(--accent,#1487c9);outline-offset:2px}
.auth-details[open] summary::after{margin-top:.2rem;transform:rotate(225deg)}
.auth-details[open] summary{margin-bottom:.5rem}

/* Flow indicator */
.auth-steps{display:flex;gap:.5rem;margin:0 0 1.5rem}
.auth-steps li{position:relative;display:flex;flex:1 1 0;flex-direction:column;gap:.45rem;min-width:0;font-size:.75rem;font-weight:650;line-height:1.3;color:var(--text-muted,#5c6d81)}
.auth-steps li::after{content:"";position:absolute;top:.8125rem;left:2.25rem;right:-.25rem;height:2px;border-radius:2px;background:var(--border-strong,#c6d5e5)}
.auth-steps li:last-child::after{display:none}
.auth-steps li.is-done::after{background:var(--accent,#1487c9)}
.auth-step-number{display:grid;place-items:center;width:1.75rem;height:1.75rem;border:1.5px solid var(--border-strong,#c6d5e5);border-radius:50%;background:var(--surface,#fff);font-size:.75rem;font-weight:750}
.auth-step-number svg{width:.95rem;height:.95rem}
.auth-steps li[aria-current="step"]{color:var(--ink,#2d2d2d)}
.auth-steps li[aria-current="step"] .auth-step-number{border-color:var(--accent-strong,#1d427b);background:var(--accent-strong,#1d427b);color:var(--surface,#fff)}
.auth-steps li.is-done .auth-step-number{border-color:var(--accent,#1487c9);background:var(--accent-soft,#eaf3fb);color:var(--accent-strong,#1d427b)}

/* Token purpose: native radios; the selected option reveals what it does. */
.auth-choices{display:grid;gap:.6rem;min-width:0;border:0}
.auth-choices>legend{margin-bottom:.6rem}
.auth-choice{position:relative;display:block;cursor:pointer}
.auth-choice input{position:absolute;inset:0;z-index:1;width:100%;height:100%;margin:0;opacity:0;cursor:pointer}
.auth-choice-body{position:relative;display:grid;gap:.2rem;padding:.8rem 1rem .8rem 2.9rem;border:1px solid var(--border-strong,#c6d5e5);border-radius:.9rem;background:var(--surface,#fff);transition:border-color .15s,background-color .15s}
.auth-choice-body::before{content:"";position:absolute;top:.95rem;left:1rem;width:1.15rem;height:1.15rem;border:2px solid var(--border-strong,#c6d5e5);border-radius:50%;background:var(--surface,#fff);transition:border-color .15s,background-color .15s,box-shadow .15s}
.auth-choice:hover .auth-choice-body{border-color:var(--accent,#1487c9)}
.auth-choice input:checked~.auth-choice-body{border-color:var(--accent,#1487c9);background:var(--accent-soft,#eaf3fb)}
.auth-choice input:checked~.auth-choice-body::before{border-color:var(--accent-strong,#1d427b);background:var(--accent-strong,#1d427b);box-shadow:inset 0 0 0 3px var(--surface,#fff)}
.auth-choice input:focus-visible~.auth-choice-body{outline:2px solid var(--accent,#1487c9);outline-offset:2px}
.auth-choice-body br{display:none}
.auth-choice-title{font-size:.9375rem;font-weight:700;color:var(--ink,#2d2d2d)}
.auth-choice-detail{display:none;font-size:.8125rem;line-height:1.5;color:var(--text-secondary,#4d5d70)}
.auth-choice input:checked~.auth-choice-body .auth-choice-detail{display:block}
.auth-token-form:has(input[name="purpose"][value="email_verify"]:checked) .auth-password-group,
.auth-token-form:has(input[name="purpose"][value="email_change"]:checked) .auth-password-group{display:none}

/* Authenticator material */
.auth-key-block{display:grid;gap:.5rem;margin-bottom:1.25rem}
.auth-key-label{font-size:.8125rem;font-weight:700;color:var(--ink,#2d2d2d)}
.auth-key{display:block;padding:.85rem 1rem;border:1px dashed var(--border-strong,#c6d5e5);border-radius:.8rem;background:var(--surface-alt,#f5f9fd);color:var(--ink,#2d2d2d);font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,"Liberation Mono",monospace;font-size:1rem;letter-spacing:.06em;line-height:1.5;overflow-wrap:anywhere;word-break:break-all;user-select:all}
.auth-codes{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.5rem;margin:0 0 1.25rem}
.auth-codes li{padding:.7rem .5rem;border:1px solid var(--border,#dbe5f0);border-radius:.7rem;background:var(--surface-alt,#f5f9fd);text-align:center}
.auth-codes code{color:var(--ink,#2d2d2d);font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,"Liberation Mono",monospace;font-size:.9375rem;letter-spacing:.04em;overflow-wrap:anywhere;user-select:all}

/* Wide screens: brand panel on the left, form as the protagonist. */
@media (min-width:640px){
  .auth-brandbar{padding-inline:2rem}
  .auth-main{padding-inline:2rem}
  .auth-card{padding:2rem}
}
@media (min-width:1024px){
  .auth-page{grid-template-columns:minmax(26rem,5fr) minmax(0,6fr)}
  .auth-brand{position:relative;display:block;grid-column:1;grid-row:1 / span 2;overflow:hidden;color:#fff;background:radial-gradient(60rem 36rem at 115% -10%,rgba(28,158,218,.38),transparent 60%),radial-gradient(40rem 30rem at -20% 110%,rgba(121,181,228,.24),transparent 60%),linear-gradient(160deg,#18407b 0%,var(--brand-primary,#1d427b) 42%,var(--auth-navy-deep) 100%)}
  .auth-brand::before{content:"";position:absolute;inset:0;background-image:linear-gradient(rgba(255,255,255,.05) 1px,transparent 1px),linear-gradient(90deg,rgba(255,255,255,.05) 1px,transparent 1px);background-size:44px 44px;-webkit-mask-image:linear-gradient(180deg,transparent,#000 30%,#000 70%,transparent);mask-image:linear-gradient(180deg,transparent,#000 30%,#000 70%,transparent);pointer-events:none}
  .auth-brand-inner{position:sticky;top:0;display:flex;flex-direction:column;gap:clamp(1.5rem,3vh,2.5rem);height:100vh;height:100dvh;padding:clamp(2rem,4vw,3.5rem)}
  .auth-brand-copy{max-width:30rem}
  .auth-brand-title{font-size:clamp(1.65rem,2.3vw,2.5rem);line-height:1.15;font-weight:750;letter-spacing:-.025em}
  .auth-brand-text{margin-top:1rem;font-size:1.0625rem;line-height:1.55;color:rgba(255,255,255,.8)}
  .auth-art-wrap{position:relative;flex:1 1 auto;min-height:0}
  .auth-art{position:absolute;inset:0;width:100%;height:100%;filter:drop-shadow(0 24px 40px rgba(6,18,40,.4))}
  .auth-brandbar{grid-column:2;grid-row:1;justify-content:flex-end;padding:1.5rem 2.5rem 0;background:none}
  .auth-brandbar .auth-lockup{display:none}
  .auth-brandbar .auth-lang{border-color:var(--border,#dbe5f0);background:var(--surface,#fff)}
  .auth-brandbar .auth-lang button{color:var(--text-secondary,#4d5d70)}
  .auth-brandbar .auth-lang button:hover{background:var(--accent-soft,#eaf3fb);color:var(--accent-strong,#1d427b)}
  .auth-brandbar .auth-lang button[aria-pressed="true"]{background:var(--accent-strong,#1d427b);color:var(--surface,#fff)}
  .auth-brandbar .auth-lang button:focus-visible{outline-color:var(--accent,#1487c9)}
  .auth-main{grid-column:2;grid-row:2;justify-content:center;padding:1.5rem 2.5rem 3rem}
  .auth-card{margin-top:0;padding:2.25rem}
}
@media (min-width:1024px) and (max-height:620px){.auth-art-wrap{display:none}}
@media (max-width:359px){
  .auth-brandbar{padding-inline:1rem}
  .auth-main{padding-inline:.75rem}
  .auth-card{padding:1.25rem 1rem}
  .auth-lockup-text small{display:none}
}

@keyframes auth-rise{from{opacity:0;transform:translateY(10px)}to{opacity:1;transform:none}}
@keyframes auth-pop{from{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:none}}
@keyframes auth-spin{to{transform:rotate(360deg)}}
@keyframes auth-sheet{from{opacity:0;transform:translate(-16px,20px)}to{opacity:1;transform:none}}
@keyframes auth-badge{from{opacity:0;transform:scale(.6)}to{opacity:1;transform:none}}
@keyframes auth-grow{from{transform:scaleX(.15)}to{transform:none}}
.auth-art-sheet,.auth-art-badge,.auth-art-progress{transform-box:fill-box;transform-origin:center}
.auth-art-sheet{animation:auth-sheet .7s cubic-bezier(.2,.7,.2,1) both}
.auth-art-sheet-mid{animation-delay:.1s}
.auth-art-sheet-front{animation-delay:.2s}
.auth-art-badge{animation:auth-badge .5s .75s cubic-bezier(.3,1.4,.5,1) both}
.auth-art-progress{transform-origin:left center;animation:auth-grow .8s .6s ease-out both}

@media (prefers-reduced-motion:reduce){
  .auth-page *,.auth-page *::before,.auth-page *::after{animation:none!important;transition:none!important}
}
@media (forced-colors:active){
  .auth-choice-body{border-color:CanvasText}
  .auth-choice input:checked~.auth-choice-body{outline:2px solid Highlight}
  .auth-lang button[aria-pressed="true"]{outline:2px solid Highlight}
}
