/* ==========================================================================
   SiosChat auth layer — login, password recovery, confirmation and verification.
   Loaded after sioschat-brand.css (fonts and --sc-* tokens). No Hyper, no Bootstrap.
   Guests have no stored theme, so dark mode follows prefers-color-scheme.
   ========================================================================== */

@media (prefers-color-scheme: dark) {
    body.sc-auth {
        --sc-ground: #0a111c;
        --sc-ground-2: #0d1523;
        --sc-panel: #111b2a;
        --sc-panel-2: #172435;
        --sc-fg: #eef3f7;
        --sc-fg-2: #aebdcb;
        --sc-fg-3: #8193a6;
        --sc-rule: rgba(174, 189, 203, 0.12);
        --sc-ring: rgba(174, 189, 203, 0.22);
        --sc-aqua-hover: #b6f3f5;
        --sc-aqua-soft: rgba(92, 225, 230, 0.1);
        --sc-aqua-ink: #5ce1e6;
        --sc-danger: #ff6b7a;
        --sc-danger-soft: rgba(255, 107, 122, 0.1);
        --sc-ok: #25d366;
        --sc-ok-soft: rgba(37, 211, 102, 0.1);
        --sc-shadow-soft: 0 1px 2px rgba(0, 0, 0, 0.25), 0 12px 28px -14px rgba(0, 0, 0, 0.55);
        --sc-shadow-pop: 0 4px 14px rgba(0, 0, 0, 0.35), 0 36px 72px -24px rgba(0, 0, 0, 0.8);
        color-scheme: dark;
    }

    .sc-auth__pane {
        background: #0d1523;
    }

    .sc-auth__brand {
        box-shadow: inset -1px 0 0 rgba(174, 189, 203, 0.1);
    }
}

body.sc-auth {
    --sc-ok-soft: #e3f4ea;
    --sc-auth-void: #0a111c;
    --sc-auth-void-panel: #111b2a;
    --sc-auth-void-panel-2: #172435;
    --sc-auth-void-fg: #eef3f7;
    --sc-auth-void-fg-2: #aebdcb;
    --sc-auth-void-fg-3: #8193a6;
    --sc-auth-void-rule: rgba(174, 189, 203, 0.12);

    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--sc-ground);
    color: var(--sc-fg);
    font-family: var(--sc-font-body);
    font-size: 0.92rem;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    color-scheme: light;
}

.sc-auth *,
.sc-auth *::before,
.sc-auth *::after {
    box-sizing: border-box;
}

.sc-auth ::selection {
    background: var(--sc-aqua);
    color: var(--sc-on-aqua);
}

.sc-auth :focus-visible {
    outline: 2px solid var(--sc-aqua);
    outline-offset: 3px;
}

:where(.sc-auth) h1,
:where(.sc-auth) h2,
:where(.sc-auth) p {
    margin: 0;
}

/* --------------------------------------------------------------------------
   Shell: brand side + form pane
   -------------------------------------------------------------------------- */
.sc-auth__shell {
    display: grid;
    grid-template-columns: minmax(420px, 46%) minmax(0, 1fr);
    min-height: 100vh;
    min-height: 100dvh;
}

.sc-auth__brand {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 48px;
    padding: 36px 48px 40px;
    overflow: hidden;
    background:
        radial-gradient(120% 70% at 30% 42%, rgba(92, 225, 230, 0.09), transparent 62%),
        var(--sc-auth-void);
    color: var(--sc-auth-void-fg);
    isolation: isolate;
}

.sc-auth__logo {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    align-self: flex-start;
    color: var(--sc-auth-void-fg);
    font-family: var(--sc-font-display);
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    text-decoration: none;
    border-radius: var(--sc-radius-sm);
}

.sc-auth__logo img {
    display: block;
    width: 38px;
    height: auto;
}

.sc-auth__stage {
    display: grid;
    flex: 1;
    align-content: center;
    gap: 36px;
    width: 100%;
    max-width: 440px;
    margin: 0 auto;
}

.sc-auth__pitch-title {
    font-family: var(--sc-font-display);
    font-size: clamp(1.7rem, 2.4vw, 2.2rem);
    font-weight: 600;
    line-height: 1.12;
    letter-spacing: -0.025em;
    text-wrap: balance;
}

.sc-auth__pitch-text {
    margin-top: 12px;
    max-width: 36ch;
    color: var(--sc-auth-void-fg-2);
    font-size: 0.95rem;
    line-height: 1.55;
}

.sc-auth__channels {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
    margin-top: 22px;
    padding: 0;
    list-style: none;
    color: var(--sc-auth-void-fg-3);
    font-size: 0.8rem;
    font-weight: 500;
}

.sc-auth__channels li {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.sc-auth__channels li::before {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--sc-channel);
    content: '';
}

.sc-auth__pane {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 36px 32px 28px;
}

.sc-auth__main {
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: center;
}

.sc-auth__card {
    width: 100%;
    max-width: 384px;
    animation: sc-auth-rise 240ms var(--sc-ease) both;
}

.sc-auth__mark {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    margin-bottom: 22px;
    border-radius: 16px;
    background: var(--sc-aqua-soft);
    color: var(--sc-aqua-ink);
    font-size: 1.5rem;
}

.sc-auth__mark.is-danger {
    background: var(--sc-danger-soft);
    color: var(--sc-danger);
}

.sc-auth__mark.is-ok {
    background: var(--sc-ok-soft);
    color: var(--sc-ok);
}

.sc-auth__title {
    font-family: var(--sc-font-display);
    font-size: 1.65rem;
    font-weight: 600;
    line-height: 1.15;
    letter-spacing: -0.02em;
    text-wrap: balance;
}

.sc-auth__lead {
    margin-top: 10px;
    color: var(--sc-fg-2);
    font-size: 0.92rem;
    line-height: 1.55;
    text-wrap: pretty;
}

.sc-auth__lead strong {
    color: var(--sc-fg);
    font-weight: 600;
    overflow-wrap: anywhere;
}

.sc-auth__body {
    margin-top: 28px;
}

.sc-auth__foot {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px 14px;
    padding-top: 24px;
    color: var(--sc-fg-3);
    font-size: 0.76rem;
    font-variant-numeric: tabular-nums;
}

.sc-auth__foot a {
    color: inherit;
    text-decoration: none;
}

.sc-auth__foot a:hover {
    color: var(--sc-fg);
}

/* --------------------------------------------------------------------------
   Inbox scene (decorative): the approved card composition in miniature
   -------------------------------------------------------------------------- */
.sc-scene {
    padding: 16px;
    border-radius: var(--sc-radius-lg);
    background: var(--sc-auth-void-panel);
    box-shadow:
        inset 0 0 0 1px var(--sc-auth-void-rule),
        0 4px 14px rgba(0, 0, 0, 0.35),
        0 36px 72px -24px rgba(0, 0, 0, 0.8);
}

.sc-scene__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 2px 4px 14px;
}

.sc-scene__title {
    font-family: var(--sc-font-display);
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.sc-scene__count {
    padding: 3px 10px;
    border-radius: 999px;
    background: rgba(92, 225, 230, 0.1);
    color: var(--sc-aqua);
    font-size: 0.74rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.sc-scene__list {
    display: grid;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.sc-scene__card {
    --sc-card-delay: 0ms;

    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border-radius: var(--sc-radius);
    animation: sc-card-in 280ms var(--sc-ease) var(--sc-card-delay) both;
}

.sc-scene__card:nth-child(2) {
    --sc-card-delay: 90ms;
}

.sc-scene__card:nth-child(3) {
    --sc-card-delay: 180ms;
}

.sc-scene__card:nth-child(4) {
    --sc-card-delay: 270ms;
}

.sc-scene__card.is-taken {
    animation:
        sc-card-in 280ms var(--sc-ease) var(--sc-card-delay) both,
        sc-card-take 320ms var(--sc-ease) 1100ms both;
}

.sc-scene__figure {
    position: relative;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 13px;
    background: var(--sc-channel);
    color: var(--sc-auth-void);
    font-size: 0.95rem;
    font-weight: 600;
}

.sc-auth__brand [data-channel='whatsapp'] {
    --sc-channel: #25d366;
}

.sc-auth__brand [data-channel='messenger'] {
    --sc-channel: #8ea2ff;
}

.sc-auth__brand [data-channel='instagram'] {
    --sc-channel: #ff7aa6;
}

.sc-auth__brand [data-channel='webchat'] {
    --sc-channel: #5ce1e6;
}

.sc-scene__who {
    min-width: 0;
}

.sc-scene__name {
    display: block;
    overflow: hidden;
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.sc-scene__preview {
    display: block;
    overflow: hidden;
    color: var(--sc-auth-void-fg-3);
    font-size: 0.8rem;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.sc-scene__meta {
    display: grid;
    justify-items: end;
    gap: 5px;
}

.sc-scene__time {
    color: var(--sc-auth-void-fg-3);
    font-size: 0.72rem;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

.sc-scene__card.has-unread .sc-scene__time {
    color: var(--sc-aqua);
}

.sc-scene__unread {
    display: grid;
    place-items: center;
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    border-radius: 999px;
    background: var(--sc-aqua);
    box-shadow: 0 4px 10px -3px rgba(92, 225, 230, 0.8);
    color: var(--sc-auth-void);
    font-size: 0.72rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    animation: sc-token-drop 160ms var(--sc-ease) calc(var(--sc-card-delay) + 300ms) both;
}

.sc-scene__agent {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
    padding: 10px 12px;
    border-radius: 999px;
    background: var(--sc-auth-void-panel-2);
    box-shadow: inset 0 0 0 1px var(--sc-auth-void-rule);
    color: var(--sc-auth-void-fg-2);
    font-size: 0.78rem;
    font-weight: 500;
}

.sc-scene__dot {
    position: relative;
    flex: none;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #25d366;
}

.sc-scene__dot::after {
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background: rgba(37, 211, 102, 0.35);
    content: '';
    animation: sc-breathe 2.4s ease-in-out infinite;
}

.sc-scene__agent strong {
    color: var(--sc-auth-void-fg);
    font-weight: 600;
}

.sc-scene__clock {
    margin-left: auto;
    font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   Form controls
   -------------------------------------------------------------------------- */
.sc-auth-form {
    display: grid;
    gap: 18px;
}

.sc-auth-field {
    display: grid;
    gap: 7px;
}

.sc-auth-field__row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.sc-auth-label {
    color: var(--sc-fg-2);
    font-size: 0.82rem;
    font-weight: 600;
}

.sc-auth-input {
    width: 100%;
    height: 46px;
    padding: 0 15px;
    border: 0;
    border-radius: 12px;
    background: var(--sc-panel);
    box-shadow:
        inset 0 0 0 1px var(--sc-ring),
        0 1px 2px rgba(20, 24, 31, 0.04);
    color: var(--sc-fg);
    font: inherit;
    font-size: 0.95rem;
    caret-color: var(--sc-aqua-ink);
    transition: box-shadow var(--sc-fast) var(--sc-ease);
}

.sc-auth-input::placeholder {
    color: var(--sc-fg-3);
    opacity: 1;
}

.sc-auth-input:hover {
    box-shadow:
        inset 0 0 0 1px var(--sc-fg-3),
        0 1px 2px rgba(20, 24, 31, 0.04);
}

.sc-auth-input:focus,
.sc-auth-input:focus-visible {
    outline: none;
    box-shadow:
        inset 0 0 0 1px rgba(92, 225, 230, 0.7),
        0 0 0 4px rgba(92, 225, 230, 0.22);
}

.sc-auth-input[readonly] {
    background: var(--sc-panel-2);
    color: var(--sc-fg-2);
    box-shadow: inset 0 0 0 1px var(--sc-rule);
}

.sc-auth-input[aria-invalid='true'] {
    box-shadow:
        inset 0 0 0 1px var(--sc-danger),
        0 0 0 4px var(--sc-danger-soft);
}

.sc-auth-input:-webkit-autofill {
    -webkit-text-fill-color: var(--sc-fg);
    box-shadow:
        inset 0 0 0 1px var(--sc-ring),
        inset 0 0 0 60px var(--sc-panel);
}

.sc-auth-password {
    position: relative;
}

.sc-auth-password .sc-auth-input {
    padding-right: 50px;
}

.sc-auth-password__toggle {
    position: absolute;
    top: 6px;
    right: 6px;
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--sc-fg-3);
    font-size: 1.1rem;
    cursor: pointer;
    transition:
        background-color var(--sc-fast) var(--sc-ease),
        color var(--sc-fast) var(--sc-ease);
}

.sc-auth-password__toggle:hover,
.sc-auth-password__toggle[aria-pressed='true'] {
    background: var(--sc-aqua-soft);
    color: var(--sc-aqua-ink);
}

.sc-auth-error {
    color: var(--sc-danger);
    font-size: 0.8rem;
    font-weight: 500;
}

.sc-auth-hint {
    color: var(--sc-fg-3);
    font-size: 0.78rem;
}

.sc-auth-link {
    color: var(--sc-aqua-ink);
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    text-underline-offset: 3px;
    border-radius: 6px;
}

.sc-auth-link:hover {
    text-decoration: underline;
}

.sc-auth-link.is-quiet {
    color: var(--sc-fg-2);
}

/* Remember-me switch */
.sc-auth-switch {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--sc-fg-2);
    font-size: 0.86rem;
    cursor: pointer;
    user-select: none;
}

.sc-auth-switch input {
    position: relative;
    flex: none;
    width: 38px;
    height: 22px;
    margin: 0;
    border-radius: 999px;
    background: var(--sc-ground-2);
    box-shadow: inset 0 0 0 1px var(--sc-ring);
    cursor: pointer;
    appearance: none;
    transition:
        background-color var(--sc-fast) var(--sc-ease),
        box-shadow var(--sc-fast) var(--sc-ease);
}

.sc-auth-switch input::after {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--sc-panel);
    box-shadow: 0 1px 3px rgba(20, 24, 31, 0.25);
    content: '';
    transition: transform var(--sc-base) var(--sc-ease);
}

.sc-auth-switch input:checked {
    background: var(--sc-aqua);
    box-shadow: none;
}

.sc-auth-switch input:checked::after {
    background: var(--sc-auth-void);
    transform: translateX(16px);
}

/* Buttons */
.sc-auth-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 48px;
    padding: 0 22px;
    border: 0;
    border-radius: 999px;
    background: var(--sc-aqua);
    color: var(--sc-on-aqua);
    font: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition:
        background-color var(--sc-fast) var(--sc-ease),
        box-shadow var(--sc-base) var(--sc-ease),
        transform var(--sc-fast) var(--sc-ease);
}

.sc-auth-btn:hover {
    background: var(--sc-aqua-hover);
    box-shadow: 0 8px 20px -8px rgba(92, 225, 230, 0.85);
    transform: translateY(-1px);
}

.sc-auth-btn:active {
    transform: scale(0.98);
}

.sc-auth-btn:disabled {
    box-shadow: none;
    cursor: default;
    opacity: 0.6;
    transform: none;
}

.sc-auth-btn.is-secondary {
    background: var(--sc-panel);
    box-shadow: inset 0 0 0 1px var(--sc-ring);
    color: var(--sc-fg);
}

.sc-auth-btn.is-secondary:hover {
    box-shadow:
        inset 0 0 0 1px var(--sc-fg-3),
        0 6px 16px -10px rgba(20, 24, 31, 0.3);
}

.sc-auth-btn.is-busy {
    opacity: 1;
}

.sc-auth-btn.is-busy::before {
    width: 16px;
    height: 16px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    content: '';
    animation: sc-spin 700ms linear infinite;
}

.sc-auth-btn i {
    font-size: 1.1rem;
}

.sc-auth-actions {
    display: grid;
    gap: 12px;
    margin-top: 4px;
}

.sc-auth-aside {
    margin-top: 22px;
    color: var(--sc-fg-3);
    font-size: 0.84rem;
    text-align: center;
}

/* Callouts */
.sc-auth-callout {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    padding: 13px 15px;
    border-radius: var(--sc-radius);
    background: var(--sc-danger-soft);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--sc-danger) 28%, transparent);
    color: var(--sc-fg);
    font-size: 0.86rem;
    line-height: 1.45;
    animation: sc-auth-rise 200ms var(--sc-ease) both;
}

.sc-auth-callout > i {
    flex: none;
    color: var(--sc-danger);
    font-size: 1.15rem;
    line-height: 1.2;
}

.sc-auth-callout.is-ok {
    background: var(--sc-ok-soft);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--sc-ok) 28%, transparent);
}

.sc-auth-callout.is-ok > i {
    color: var(--sc-ok);
}

.sc-auth-callout strong {
    display: block;
    margin-bottom: 2px;
    font-weight: 600;
}

.sc-auth-callout ul {
    margin: 0;
    padding-left: 18px;
}

/* Password requirement checklist */
.sc-auth-rules {
    display: grid;
    gap: 5px;
    margin: 2px 0 0;
    padding: 0;
    list-style: none;
}

.sc-auth-rules li {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--sc-fg-3);
    font-size: 0.8rem;
    transition: color var(--sc-fast) var(--sc-ease);
}

.sc-auth-rules li::before {
    display: grid;
    place-items: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    box-shadow: inset 0 0 0 1.5px var(--sc-ring);
    content: '';
    transition:
        background-color var(--sc-fast) var(--sc-ease),
        box-shadow var(--sc-fast) var(--sc-ease);
}

.sc-auth-rules li.is-met {
    color: var(--sc-fg);
}

.sc-auth-rules li.is-met::before {
    background:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4.5 8.2l2.3 2.3 4.7-4.9' fill='none' stroke='%230a111c' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
            center / 16px no-repeat,
        var(--sc-aqua);
    box-shadow: none;
}

/* Resend countdown */
.sc-auth-resend {
    margin-top: 6px;
    text-align: center;
}

.sc-auth-resend button {
    padding: 4px 8px;
    border: 0;
    background: none;
    color: var(--sc-aqua-ink);
    font: inherit;
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 6px;
}

.sc-auth-resend button:disabled {
    color: var(--sc-fg-3);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    cursor: default;
}

/* --------------------------------------------------------------------------
   Motion
   -------------------------------------------------------------------------- */
@keyframes sc-auth-rise {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
}

@keyframes sc-card-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
}

@keyframes sc-token-drop {
    from {
        opacity: 0;
        transform: translateY(-7px) scale(0.6);
    }
}

@keyframes sc-card-take {
    to {
        background: rgba(92, 225, 230, 0.1);
        box-shadow:
            inset 0 0 0 1px rgba(92, 225, 230, 0.45),
            0 2px 6px rgba(0, 0, 0, 0.3),
            0 18px 36px -16px rgba(0, 0, 0, 0.65);
    }
}

@keyframes sc-breathe {
    0%,
    100% {
        opacity: 0;
        transform: scale(0.6);
    }

    50% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes sc-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .sc-auth *,
    .sc-auth *::before,
    .sc-auth *::after {
        animation-duration: 1ms !important;
        animation-iteration-count: 1 !important;
        animation-delay: 0ms !important;
        transition-duration: 1ms !important;
    }

    .sc-scene__dot::after {
        display: none;
    }
}

@media (min-width: 901px) {
    .sc-auth__mini {
        display: none;
    }
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1100px) {
    .sc-auth__brand {
        padding: 32px 36px 36px;
    }
}

@media (max-width: 900px) {
    .sc-auth__shell {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto 1fr;
    }

    .sc-auth__brand {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 16px;
        padding: 18px 22px;
        border-radius: 0 0 24px 24px;
    }

    .sc-auth__stage {
        display: none;
    }

    .sc-auth__logo img {
        width: 32px;
    }

    .sc-auth__mini {
        display: flex;
    }

    .sc-auth__pane {
        padding: 32px 22px 24px;
    }

    .sc-auth__main {
        align-items: flex-start;
    }
}

.sc-auth__mini {
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.sc-auth__mini li {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 10px;
    background: var(--sc-channel);
    color: var(--sc-auth-void);
    font-size: 0.95rem;
}

@media (max-width: 420px) {
    .sc-auth__title {
        font-size: 1.45rem;
    }

    .sc-auth__mini li:nth-child(n + 3) {
        display: none;
    }
}
