/**
 * Auth pages (login, register, password flows) — prefers --theme-auth-* from theme_settings, with --theme-* fallbacks (see partials/_auth_theme_head).
 */
.auth-themed {
    --auth-danger: #b42318;
}

.auth-themed,
.auth-themed * {
    box-sizing: border-box;
}

.auth-themed body,
body.auth-themed {
    margin: 0;
    font-family: var(--theme-font-stack, Inter, "Segoe UI", Tahoma, Arial, sans-serif);
    font-size: var(--theme-base-font-size, 16px);
    font-weight: var(--theme-body-font-weight, 400);
    line-height: var(--theme-line-height, 1.5);
    color: var(--theme-auth-card-fg, var(--theme-surface-fg, #333333));
    background:
        radial-gradient(1200px 500px at 10% -5%, color-mix(in srgb, var(--theme-auth-panel-fg, var(--theme-header-fg, #ebe0c0)) 18%, transparent), transparent 60%),
        radial-gradient(900px 450px at 100% 0%, color-mix(in srgb, var(--theme-auth-panel-fg, var(--theme-header-fg, #ebe0c0)) 12%, transparent), transparent 60%),
        var(--theme-auth-page-bg, var(--theme-page-outer-bg, #333333));
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.auth-themed .shell {
    width: min(980px, 100%);
    background: var(--theme-auth-card-bg, var(--theme-surface-bg, #ebe0c0));
    border: 1px solid var(--theme-auth-shell-border, color-mix(in srgb, var(--theme-header-fg, #ebe0c0) 45%, var(--theme-surface-bg)));
    border-radius: 18px;
    box-shadow: 0 30px 60px rgba(16, 24, 40, 0.14);
    overflow: hidden;
    display: grid;
    grid-template-columns: 1.1fr 1fr;
}

.auth-themed .showcase {
    background:
        radial-gradient(ellipse 130% 90% at 50% -10%, color-mix(in srgb, var(--theme-auth-panel-fg, var(--theme-header-fg, #ebe0c0)) 10%, transparent) 0%, transparent 52%),
        linear-gradient(
            168deg,
            color-mix(in srgb, var(--theme-auth-panel-bg, var(--theme-header-bg, #333)) 92%, #000) 0%,
            color-mix(in srgb, var(--theme-auth-panel-mid, var(--theme-sidebar-bg, #333)) 55%, #1a1f26) 50%,
            color-mix(in srgb, var(--theme-auth-panel-bg, var(--theme-header-bg, #333)) 88%, #000) 100%
        );
    color: var(--theme-auth-panel-fg, var(--theme-header-fg, #ebe0c0));
    padding: 40px 24px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    min-height: 420px;
}

.auth-themed .showcase-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    flex: 1;
}

.auth-themed .brand-card {
    width: 100%;
    max-width: 320px;
    margin: 0 auto;
    padding: 30px 24px 34px;
    border-radius: 20px;
    background: var(--theme-auth-brand-card-bg, #ffffff);
    border: 1px solid var(--theme-auth-brand-card-border, color-mix(in srgb, var(--theme-surface-fg, #333) 8%, transparent));
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

.auth-themed .brand-row {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    text-align: center;
}

.auth-themed .brand-row .brand-logo-itc {
    display: block;
    width: auto;
    max-width: 100%;
    max-height: var(--theme-brand-logo-max-h, 84px);
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.12));
    margin-bottom: 4px;
}

.auth-themed .brand-row .brand-logo-xoya {
    display: block;
    width: auto;
    max-width: 70%;
    max-height: 34px;
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
    margin-top: 4px;
}

.auth-themed .brand-by-rule {
    width: 100%;
    max-width: 120px;
    height: 1px;
    margin: 0 auto;
    background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--theme-auth-card-fg, var(--theme-surface-fg, #333)) 18%, transparent), transparent);
}

.auth-themed .brand-by {
    margin: 0;
    padding: 12px 6px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.62em;
    line-height: 1;
    color: color-mix(in srgb, var(--theme-auth-card-fg, var(--theme-surface-fg, #333)) 85%, #fff);
    text-transform: uppercase;
}

.auth-themed .auth {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 46px 38px;
}

.auth-themed .auth h2 {
    margin: 0;
    font-size: 24px;
    font-weight: var(--theme-heading-font-weight, 700);
    color: var(--theme-auth-heading-color, var(--theme-font-heading, var(--theme-surface-fg)));
}

.auth-themed .auth .sub {
    margin: 8px 0 24px;
    color: var(--theme-font-muted, rgba(51, 51, 51, 0.75));
    font-size: 14px;
}

.auth-themed .field {
    margin-bottom: 16px;
}

.auth-themed label {
    display: block;
    margin-bottom: 7px;
    font-size: 13px;
    font-weight: 600;
    color: var(--theme-auth-heading-color, var(--theme-font-heading, var(--theme-surface-fg)));
}

.auth-themed input[type="text"],
.auth-themed input[type="email"],
.auth-themed input[type="password"] {
    width: 100%;
    border: 1px solid var(--theme-auth-input-border, var(--theme-border-on-surface-soft, rgba(51, 51, 51, 0.22)));
    border-radius: 10px;
    padding: 11px 12px;
    font-size: 14px;
    outline: none;
    transition: 0.16s ease;
    background: color-mix(in srgb, var(--theme-auth-input-bg, var(--theme-surface-bg, #ebe0c0)) 88%, #ffffff);
    color: var(--theme-auth-card-fg, var(--theme-surface-fg, #333333));
}

.auth-themed input::placeholder {
    color: var(--theme-placeholder-muted, rgba(51, 51, 51, 0.65));
}

.auth-themed input[type="text"]:focus,
.auth-themed input[type="email"]:focus,
.auth-themed input[type="password"]:focus {
    border-color: var(--theme-border-on-surface-strong, rgba(51, 51, 51, 0.45));
    box-shadow: 0 0 0 4px var(--theme-focus-ring, rgba(51, 51, 51, 0.12));
    background: var(--theme-auth-input-bg, var(--theme-surface-bg, #ebe0c0));
}

.auth-themed .row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 2px 0 18px;
    font-size: 13px;
}

.auth-themed .remember {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    color: var(--theme-auth-card-fg, var(--theme-surface-fg, #333));
}

.auth-themed .link {
    color: var(--theme-auth-link, var(--theme-font-link, #1a365d));
    text-decoration: none;
    font-weight: 600;
}

.auth-themed .link:hover {
    color: color-mix(in srgb, var(--theme-auth-link, var(--theme-font-link, #1a365d)) 75%, #000);
    text-decoration: underline;
}

.auth-themed .btn {
    width: 100%;
    border: 0;
    border-radius: 10px;
    background: var(--theme-auth-button-bg, var(--theme-header-bg, #333333));
    color: var(--theme-auth-button-fg, var(--theme-header-fg, #ebe0c0));
    font-size: 14px;
    font-weight: 600;
    padding: 12px 14px;
    cursor: pointer;
    transition: 0.15s ease;
}

.auth-themed .btn:hover {
    background: color-mix(in srgb, var(--theme-auth-button-bg, var(--theme-header-bg, #333)) 82%, #000);
    color: var(--theme-auth-button-hover-fg, var(--theme-header-nav-hover-fg, #ffffff));
}

.auth-themed .foot {
    margin-top: 16px;
    text-align: center;
    color: var(--theme-font-muted, rgba(51, 51, 51, 0.75));
    font-size: 13px;
}

.auth-themed .error {
    margin-top: 6px;
    color: var(--auth-danger);
    font-size: 12px;
    font-weight: 500;
}

.auth-themed .alert {
    margin-bottom: 14px;
    font-size: 13px;
    border-radius: 10px;
    padding: 10px 12px;
}

.auth-themed .alert-success {
    background: color-mix(in srgb, var(--theme-muted-bg, #d9ccad) 70%, #fff);
    color: var(--theme-surface-fg, #333);
    border: 1px solid var(--theme-border-on-surface-soft, rgba(51, 51, 51, 0.25));
}

.auth-themed.auth-layout-compact .shell {
    width: min(980px, 100%);
    grid-template-columns: 1.05fr 1fr;
}

.auth-themed.auth-layout-compact .showcase {
    min-height: 0;
    padding: 42px 34px;
    justify-content: space-between;
    display: flex;
    flex-direction: column;
}

.auth-themed.auth-layout-compact .brand img,
.auth-themed.auth-layout-register .brand img {
    display: block;
    width: auto;
    max-width: 100%;
    max-height: var(--theme-brand-logo-max-h, 72px);
    height: auto;
}

.auth-themed.auth-layout-compact .tag,
.auth-themed.auth-layout-register .tag {
    display: inline-block;
    margin-top: 10px;
    background: color-mix(in srgb, var(--theme-auth-panel-fg, var(--theme-header-fg, #ebe0c0)) 14%, transparent);
    border: 1px solid color-mix(in srgb, var(--theme-auth-panel-fg, var(--theme-header-fg, #ebe0c0)) 30%, transparent);
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
}

.auth-themed.auth-layout-compact .hero h1,
.auth-themed.auth-layout-register .hero h1 {
    margin: 0 0 10px;
    font-size: 30px;
    line-height: 1.15;
    font-weight: var(--theme-heading-font-weight, 700);
}

.auth-themed.auth-layout-compact .hero p,
.auth-themed.auth-layout-register .hero p {
    margin: 0;
    color: color-mix(in srgb, var(--theme-auth-panel-fg, var(--theme-header-fg, #ebe0c0)) 84%, transparent);
    font-size: 14px;
    max-width: 34ch;
}

.auth-themed.auth-layout-compact .auth {
    padding: 40px 36px;
}

.auth-themed.auth-layout-compact .auth h2 {
    font-size: 24px;
}

.auth-themed.auth-layout-compact .sub {
    margin: 8px 0 20px;
}

.auth-themed.auth-layout-compact .field {
    margin-bottom: 14px;
}

.auth-themed.auth-layout-compact .btn-secondary {
    margin-top: 10px;
    background: var(--theme-muted-bg, #d9ccad);
    color: var(--theme-surface-fg, #333);
    border: 1px solid var(--theme-border-on-surface-soft, rgba(51, 51, 51, 0.25));
}

.auth-themed.auth-layout-compact .btn-secondary:hover {
    background: color-mix(in srgb, var(--theme-muted-bg, #d9ccad) 90%, #000);
}

.auth-themed.auth-layout-compact .alert {
    background: color-mix(in srgb, var(--theme-muted-bg, #d9ccad) 75%, #fff);
    color: var(--theme-surface-fg, #333);
    border: 1px solid var(--theme-border-on-surface-soft, rgba(51, 51, 51, 0.25));
}

.auth-themed.auth-layout-register .shell {
    width: min(1040px, 100%);
}

.auth-themed.auth-layout-register .showcase {
    padding: 46px 38px;
    justify-content: space-between;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.auth-themed.auth-layout-register .hero h1 {
    font-size: 32px;
}

@media (max-width: 920px) {
    .auth-themed .shell,
    .auth-themed.auth-layout-compact .shell,
    .auth-themed.auth-layout-register .shell {
        grid-template-columns: 1fr;
    }

    .auth-themed .showcase {
        min-height: 260px;
        padding: 32px 20px;
    }

    .auth-themed .brand-card {
        max-width: 300px;
        padding: 24px 18px 28px;
    }

    .auth-themed .brand-by {
        letter-spacing: 0.42em;
    }
}

.theme-settings-auth-preview-wrap {
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    padding: 12px;
    background: #f8f9fa;
    overflow: hidden;
}

.theme-settings-auth-preview-scale {
    transform: scale(0.5);
    transform-origin: top center;
    width: 200%;
    margin-left: -50%;
    margin-bottom: -180px;
    pointer-events: none;
}

.theme-settings-auth-preview-scale.auth-themed {
    display: block;
    min-height: 0;
    padding: 8px 0 0;
    background: transparent;
}

.theme-settings-auth-preview-scale .shell {
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.12);
}
