body.app-shell {
    --app-primary: var(--primary-color);
    --app-secondary: var(--secondary-color);
    --app-bg: #f8fafc;
    --app-surface: #ffffff;
    --app-surface-muted: #f8fafc;
    --app-surface-strong: #f1f5f9;
    --app-text: #1d3557;
    --app-text-soft: #64748b;
    --app-text-muted: #94a3b8;
    --app-border: #e2e8f0;
    --app-shadow: 0 14px 38px rgba(15, 23, 42, .08);
    --app-primary-faint: #fff7f7;
    --app-primary-strong: var(--app-primary);
    margin: 0;
    background: var(--app-bg);
    color: var(--app-text);
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
}

@supports (color: color-mix(in srgb, white 50%, black)) {
    body.app-shell {
        --app-primary-faint: color-mix(in srgb, var(--app-primary) 7%, #fff);
        --app-primary-strong: color-mix(in srgb, var(--app-primary) 78%, #111827);
    }
}

html[data-app-theme="dark"] body.app-shell {
    --app-bg: #0b1120;
    --app-surface: #111827;
    --app-surface-muted: #172033;
    --app-surface-strong: #1f2937;
    --app-text: #e5eefb;
    --app-text-soft: #a7b4c8;
    --app-text-muted: #7f8da3;
    --app-border: #273548;
    --app-shadow: 0 18px 44px rgba(0, 0, 0, .28);
    --app-primary-faint: rgba(230, 57, 70, .12);
    --app-primary-strong: #ff7a87;
}

@supports (color: color-mix(in srgb, white 50%, black)) {
    html[data-app-theme="dark"] body.app-shell {
        --app-primary-faint: color-mix(in srgb, var(--app-primary) 16%, #111827);
        --app-primary-strong: color-mix(in srgb, var(--app-primary) 62%, #fff);
    }
}

.auth-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 1.25rem;
}

.auth-shell {
    width: min(100%, 430px);
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: .85rem;
    margin-bottom: 1rem;
}

.auth-logo {
    width: 54px;
    height: 54px;
    flex: 0 0 54px;
    border: 1px solid var(--app-border);
    border-radius: .75rem;
    object-fit: contain;
}

.auth-logo-fallback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: linear-gradient(135deg, var(--app-primary), var(--app-secondary));
    font-size: 1.25rem;
    font-weight: 850;
}

.auth-theme-toggle {
    width: 38px;
    height: 38px;
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    border: 1px solid var(--app-border);
    border-radius: .7rem;
    background: var(--app-surface);
    color: var(--app-text-soft);
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

.auth-theme-toggle:hover,
.auth-theme-toggle:focus {
    border-color: var(--app-primary);
    background: var(--app-primary-faint);
    color: var(--app-primary-strong);
}

.auth-theme-icon {
    display: inline-flex;
}

.auth-theme-icon svg {
    width: 1.05rem;
    height: 1.05rem;
}

.auth-theme-icon-sun {
    display: none;
}

html[data-app-theme="dark"] .auth-theme-icon-moon {
    display: none;
}

html[data-app-theme="dark"] .auth-theme-icon-sun {
    display: inline-flex;
}

.auth-brand-name {
    color: var(--app-text);
    font-size: 1.05rem;
    font-weight: 850;
}

.auth-brand-subtitle,
.auth-muted {
    color: var(--app-text-soft);
    font-size: .84rem;
}

.auth-card {
    border: 1px solid var(--app-border);
    border-radius: .75rem;
    background: var(--app-surface);
    box-shadow: var(--app-shadow);
    padding: 1.1rem;
}

html[data-app-theme="dark"] body.app-shell :is(
    .form-control,
    .form-select,
    .form-check-input,
    .input-group-text,
    textarea
) {
    background-color: var(--app-surface-strong) !important;
    border-color: var(--app-border) !important;
    color: var(--app-text) !important;
}

html[data-app-theme="dark"] body.app-shell :is(
    .form-control,
    .form-select,
    textarea
)::placeholder {
    color: var(--app-text-muted) !important;
}

html[data-app-theme="dark"] body.app-shell :is(
    .form-control,
    .form-select,
    textarea
):focus {
    border-color: var(--app-primary-strong) !important;
    box-shadow: 0 0 0 .16rem rgba(255, 122, 135, .18) !important;
}

.auth-title {
    color: var(--app-text);
    font-size: 1.25rem;
    font-weight: 850;
    margin-bottom: .3rem;
}

.auth-description {
    color: var(--app-text-soft);
    font-size: .88rem;
    margin-bottom: 1rem;
}

.auth-actions {
    display: grid;
    gap: .6rem;
}

.auth-link-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin-top: .85rem;
}

.auth-legal-links {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: .35rem .65rem;
    margin-top: .85rem;
    padding-top: .75rem;
    border-top: 1px solid var(--app-border);
    color: var(--app-text-muted);
    font-size: .72rem;
}

.auth-legal-links a {
    color: inherit;
    text-decoration: none;
}

.auth-legal-links a:hover,
.auth-legal-links a:focus {
    color: var(--app-primary-strong);
}

.auth-access-actions {
    display: grid;
    gap: .55rem;
}

@media (max-width: 575.98px) {
    .auth-page {
        align-items: stretch;
        padding: 1rem;
    }

    .auth-shell {
        display: grid;
        align-content: center;
        min-height: calc(100vh - 2rem);
    }

    .auth-link-row {
        align-items: stretch;
        flex-direction: column;
    }
}
