/* ==========================================================================
   sd-auth.css — signed-out pages (NLP v25, UI refresh phase 2)
   Loaded after css/sd.css by auth_page_start() (includes/auth_layout.php).
   Tokens only — every color comes from sd.css or the tenant brand.
   ========================================================================== */

body.sd-auth { background: var(--sd-canvas); min-height: 100vh; }

/* ---- Split layout: brand panel | form ----------------------------------- */
.sd-auth-shell { display: grid; grid-template-columns: minmax(360px, 44%) 1fr; min-height: 100vh; }

.sd-auth-brand {
    position: relative; overflow: hidden; isolation: isolate;
    display: flex; flex-direction: column; justify-content: space-between; gap: 32px;
    padding: 40px 48px; color: #fff;
    background: var(--sd-accent);
    background: linear-gradient(150deg, var(--sd-accent) 0%, var(--sd-auth-deep, var(--sd-accent-ink)) 100%);
}
@supports (color: color-mix(in srgb, red 50%, white)) {
    .sd-auth-brand { --sd-auth-deep: color-mix(in srgb, var(--sd-accent) 45%, #0b1220); }
}
.sd-auth-brand::before,
.sd-auth-brand::after {           /* soft light blooms */
    content: ""; position: absolute; z-index: -1; border-radius: 50%; pointer-events: none;
    background: radial-gradient(closest-side, rgba(255, 255, 255, .18), rgba(255, 255, 255, 0));
}
.sd-auth-brand::before { width: 560px; height: 560px; top: -220px; right: -200px; }
.sd-auth-brand::after  { width: 420px; height: 420px; bottom: -180px; left: -140px; opacity: .6; }

.sd-auth-brand-mid { max-width: 440px; }
.sd-auth-tagline {
    margin: 0 0 14px; font-size: clamp(26px, 2.6vw, 36px); font-weight: 600; line-height: 1.15;
    letter-spacing: -.02em; color: #fff;
}
.sd-auth-pitch { margin: 0; font-size: var(--sd-text-md); line-height: 1.6; color: rgba(255, 255, 255, .82); }
.sd-auth-brand-foot { font-size: var(--sd-text-xs); color: rgba(255, 255, 255, .7); }

/* Voice waveform motif */
.sd-auth-wave { display: flex; align-items: center; gap: 5px; height: 72px; margin-top: 36px; }
.sd-auth-wave span {
    flex: 0 0 5px; border-radius: 3px; background: rgba(255, 255, 255, .55);
    height: 18%; transform-origin: center; animation: sd-auth-wave 2.4s ease-in-out infinite;
}
/* heights shaped like a spoken phrase */
.sd-auth-wave span:nth-child(1) { height: 29%; animation-delay: -0.00s; }
.sd-auth-wave span:nth-child(2) { height: 57%; animation-delay: -0.14s; }
.sd-auth-wave span:nth-child(3) { height: 29%; animation-delay: -0.27s; }
.sd-auth-wave span:nth-child(4) { height: 82%; animation-delay: -0.41s; }
.sd-auth-wave span:nth-child(5) { height: 63%; animation-delay: -0.55s; }
.sd-auth-wave span:nth-child(6) { height: 29%; animation-delay: -0.69s; }
.sd-auth-wave span:nth-child(7) { height: 84%; animation-delay: -0.82s; }
.sd-auth-wave span:nth-child(8) { height: 60%; animation-delay: -0.96s; }
.sd-auth-wave span:nth-child(9) { height: 54%; animation-delay: -1.10s; }
.sd-auth-wave span:nth-child(10) { height: 86%; animation-delay: -1.23s; }
.sd-auth-wave span:nth-child(11) { height: 36%; animation-delay: -1.37s; }
.sd-auth-wave span:nth-child(12) { height: 83%; animation-delay: -1.51s; }
.sd-auth-wave span:nth-child(13) { height: 52%; animation-delay: -1.64s; }
.sd-auth-wave span:nth-child(14) { height: 19%; animation-delay: -1.78s; }
.sd-auth-wave span:nth-child(15) { height: 46%; animation-delay: -1.92s; }
.sd-auth-wave span:nth-child(16) { height: 26%; animation-delay: -2.06s; }
.sd-auth-wave span:nth-child(17) { height: 19%; animation-delay: -2.19s; }
.sd-auth-wave span:nth-child(18) { height: 23%; animation-delay: -2.33s; }
.sd-auth-wave span:nth-child(19) { height: 12%; animation-delay: -0.07s; }
.sd-auth-wave span:nth-child(20) { height: 12%; animation-delay: -0.20s; }
.sd-auth-wave span:nth-child(21) { height: 12%; animation-delay: -0.34s; }
.sd-auth-wave span:nth-child(22) { height: 12%; animation-delay: -0.48s; }
.sd-auth-wave span:nth-child(23) { height: 12%; animation-delay: -0.61s; }
.sd-auth-wave span:nth-child(24) { height: 12%; animation-delay: -0.75s; }
.sd-auth-wave span:nth-child(25) { height: 12%; animation-delay: -0.89s; }
.sd-auth-wave span:nth-child(26) { height: 21%; animation-delay: -1.03s; }
.sd-auth-wave span:nth-child(27) { height: 13%; animation-delay: -1.16s; }
.sd-auth-wave span:nth-child(28) { height: 41%; animation-delay: -1.30s; }
.sd-auth-wave span:nth-child(29) { height: 36%; animation-delay: -1.44s; }
.sd-auth-wave span:nth-child(30) { height: 19%; animation-delay: -1.57s; }
.sd-auth-wave span:nth-child(31) { height: 61%; animation-delay: -1.71s; }
.sd-auth-wave span:nth-child(32) { height: 48%; animation-delay: -1.85s; }
@keyframes sd-auth-wave { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(.55); } }

/* Brand lockups */
.sd-auth-brandmark { display: inline-flex; align-items: center; gap: 12px; font-size: var(--sd-text-lg); font-weight: 600; color: var(--sd-ink); letter-spacing: -.01em; }
.sd-auth-brandmark .sd-brand-mark { width: 36px; height: 36px; border-radius: 10px; font-size: 16px; }
.sd-auth-brandmark.is-on-color { color: #fff; }
.sd-auth-brandmark.is-on-color .sd-brand-mark { background: rgba(255, 255, 255, .16); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .28); }
.sd-auth-logo img { display: block; max-height: 40px; max-width: 220px; object-fit: contain; }
.sd-auth-logo.is-on-color { display: inline-flex; padding: 10px 14px; border-radius: 12px; background: #fff; box-shadow: 0 6px 20px rgba(0, 0, 0, .12); }

/* Form side */
.sd-auth-main {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 48px 24px 32px; background: var(--sd-surface); min-width: 0;
}
.sd-auth-mobile-brand { display: none; }
.sd-auth-panel { width: 100%; max-width: 400px; margin: auto 0; }
.sd-auth-main > .sd-auth-legal { display: none; }

.sd-auth-head { margin-bottom: 28px; }
.sd-auth-title { margin: 0; font-size: var(--sd-text-2xl); font-weight: 600; color: var(--sd-ink); letter-spacing: -.02em; line-height: 1.2; }
.sd-auth-sub { margin: 8px 0 0; font-size: var(--sd-text-base); color: var(--sd-ink-3); line-height: 1.55; }
.sd-auth-icon {
    width: 48px; height: 48px; margin-bottom: 18px; border-radius: 14px; display: grid; place-items: center;
    background: var(--sd-accent-soft); color: var(--sd-accent); font-size: 20px;
}
.sd-auth-icon.is-good { background: var(--sd-good-bg); color: var(--sd-good); }
.sd-auth-icon.is-bad  { background: var(--sd-bad-bg);  color: var(--sd-bad); }

.sd-auth-form .sd-field + .sd-field,
.sd-auth-form .sd-auth-names + .sd-field,
.sd-auth-form .sd-field + .sd-auth-names { margin-top: 18px; }
.sd-auth-form .sd-pw-block + .sd-field { margin-top: 18px; }
.sd-auth-names { gap: 18px 12px; }
.sd-auth-names .sd-field + .sd-field { margin-top: 0; }
.sd-auth-badge { margin-bottom: 14px; }
.sd-auth-form .sd-input, .sd-auth-form .sd-select { height: 44px; }
.sd-auth-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 10px 0 0; }
.sd-auth-row .sd-label { margin: 0; }
.sd-auth-actions { margin-top: 24px; display: flex; flex-direction: column; gap: 12px; }
.sd-auth-actions .sd-btn { height: 46px; font-size: var(--sd-text-md); }
.sd-auth-alt { margin: 24px 0 0; text-align: center; font-size: var(--sd-text-sm); color: var(--sd-ink-3); }
.sd-auth-alt a, .sd-auth-link { color: var(--sd-accent); font-weight: 600; text-decoration: none; }
.sd-auth-alt a:hover, .sd-auth-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.sd-auth-link--sm { font-size: var(--sd-text-sm); }
.sd-auth-note {
    display: flex; gap: 10px; align-items: flex-start; margin-top: 28px; padding-top: 18px;
    border-top: 1px solid var(--sd-line); font-size: var(--sd-text-xs); color: var(--sd-muted); line-height: 1.5;
}
.sd-auth-note i { margin-top: 2px; }
.sd-auth-legal { margin: 24px 0 0; font-size: var(--sd-text-xs); color: var(--sd-muted); text-align: center; }

/* Read-only facts (invitation details, "resetting for …") */
.sd-auth-facts { margin: 0 0 22px; padding: 14px 16px; border-radius: var(--sd-radius); background: var(--sd-sunken); border: 1px solid var(--sd-line); }
.sd-auth-facts dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: var(--sd-text-sm); }
.sd-auth-facts dt { color: var(--sd-muted); }
.sd-auth-facts dd { margin: 0; color: var(--sd-ink); font-weight: 500; overflow-wrap: anywhere; }
.sd-auth-who { display: flex; align-items: center; gap: 12px; margin: 0 0 22px; padding: 12px 14px; border-radius: var(--sd-radius); background: var(--sd-sunken); border: 1px solid var(--sd-line); }
.sd-auth-who-text { min-width: 0; line-height: 1.3; }
.sd-auth-who-label { font-size: var(--sd-text-xs); color: var(--sd-muted); }
.sd-auth-who-name { font-size: var(--sd-text-sm); font-weight: 600; color: var(--sd-ink); overflow-wrap: anywhere; }

/* ---- Password field: show/hide, caps lock, strength, rules --------------- */
.sd-password { position: relative; }
.sd-password .sd-input { padding-right: 48px; }
.sd-password-toggle {
    position: absolute; top: 50%; right: 4px; transform: translateY(-50%);
    width: 38px; height: 38px; border: 0; border-radius: var(--sd-radius-sm); background: transparent;
    display: grid; place-items: center; color: var(--sd-muted); font-size: 15px; cursor: pointer; margin: 0; padding: 0;
}
.sd-password-toggle:hover { color: var(--sd-ink); background: var(--sd-hover); }
.sd-password-toggle:focus-visible { outline: 2px solid var(--sd-accent); outline-offset: 0; }
.sd-capslock { color: var(--sd-warn); font-weight: 500; }

.sd-pw-meter { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin: 10px 0 8px; }
.sd-pw-meter span { height: 4px; border-radius: 2px; background: var(--sd-line); transition: background-color var(--sd-med); }
.sd-pw-meter[data-score="1"] span:nth-child(-n+1),
.sd-pw-meter[data-score="2"] span:nth-child(-n+2) { background: var(--sd-bad-solid); }
.sd-pw-meter[data-score="3"] span:nth-child(-n+3),
.sd-pw-meter[data-score="4"] span:nth-child(-n+4) { background: var(--sd-warn-solid); }
.sd-pw-meter[data-score="5"] span { background: var(--sd-good-solid); }

.sd-rules { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; }
.sd-rules li { display: flex; align-items: center; gap: 7px; font-size: var(--sd-text-xs); color: var(--sd-muted); }
.sd-rules li i { color: var(--sd-line-strong); font-size: 12px; transition: color var(--sd-fast); }
.sd-rules li[data-ok="true"] { color: var(--sd-ink-2); }
.sd-rules li[data-ok="true"] i { color: var(--sd-good-solid); }
@media (max-width: 420px) { .sd-rules { grid-template-columns: 1fr; } }

/* ---- Card layout (confirm password, thanks, sign out, questionnaire) ---- */
.sd-auth-center { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 16px; }
.sd-auth-lockup { margin-bottom: 24px; }
.sd-auth-card { width: 100%; max-width: 440px; padding: 36px 36px 32px; box-shadow: var(--sd-shadow); }
.sd-auth--wide .sd-auth-card { max-width: 620px; }
.sd-auth-card-body.is-center { text-align: center; }
.sd-auth-card-body.is-center .sd-auth-icon { margin-left: auto; margin-right: auto; }
.sd-auth-card-body .sd-auth-sub { margin-bottom: 4px; }
.sd-auth-card-body form:not(.sd-auth-actions) { margin: 0; }

/* ---- Entity chooser ----------------------------------------------------- */
.sd-entity-list { display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 0; list-style: none; }
.sd-entity-list form { margin: 0; }
.sd-entity-choice {
    display: flex; align-items: center; gap: 14px; width: 100%; margin: 0; text-align: left;
    padding: 14px 16px; border: 1px solid var(--sd-line); border-radius: var(--sd-radius-lg); background: var(--sd-surface);
    font: inherit; color: var(--sd-ink-2); cursor: pointer;
    transition: border-color var(--sd-fast), box-shadow var(--sd-fast), background-color var(--sd-fast);
}
.sd-entity-choice:hover { border-color: var(--sd-accent-line); box-shadow: var(--sd-shadow-sm); background: var(--sd-sunken); }
.sd-entity-choice:focus-visible { outline: none; border-color: var(--sd-accent); box-shadow: var(--sd-ring); }
.sd-entity-choice.is-current { border-color: var(--sd-accent); background: var(--sd-accent-soft); }
.sd-entity-mono {
    width: 42px; height: 42px; flex: 0 0 auto; border-radius: 12px; display: grid; place-items: center;
    font-weight: 700; font-size: 16px; background: hsl(var(--sd-h, 215) 70% 93%); color: hsl(var(--sd-h, 215) 55% 30%);
}
.sd-entity-text { flex: 1; min-width: 0; }
.sd-entity-name-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sd-entity-title { font-size: var(--sd-text-md); font-weight: 600; color: var(--sd-ink); }
.sd-entity-meta { font-size: var(--sd-text-xs); color: var(--sd-muted); margin-top: 3px; }
.sd-entity-desc { font-size: var(--sd-text-sm); color: var(--sd-ink-3); margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sd-entity-go { color: var(--sd-faint); font-size: 14px; flex: 0 0 auto; }
.sd-entity-choice:hover .sd-entity-go { color: var(--sd-accent); }
.sd-auth-foot-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 22px; }
.sd-inline-form { display: inline; margin: 0; }

/* ---- Phones & small tablets ---------------------------------------------- */
@media (max-width: 900px) {
    .sd-auth-shell { grid-template-columns: 1fr; }
    .sd-auth-brand { display: none; }
    .sd-auth-main { justify-content: flex-start; padding: 28px 20px 24px; background: var(--sd-surface); }
    .sd-auth-mobile-brand { display: block; width: 100%; max-width: 400px; margin: 0 0 36px; }
    .sd-auth-main > .sd-auth-legal { display: block; margin-top: 36px; }
    .sd-auth-panel { margin: 0; }
}
@media (max-width: 480px) {
    .sd-auth-card { padding: 28px 20px 24px; }
    .sd-auth-title { font-size: 22px; }
    body.sd-auth--card { background: var(--sd-surface); }
    .sd-auth--card .sd-auth-card { border: 0; box-shadow: none; padding: 8px 4px; }
    .sd-auth-center { justify-content: flex-start; padding-top: 28px; }
}

@media (prefers-reduced-motion: reduce) {
    .sd-auth-wave span { animation: none; }
}
