/* SolarPro Unified Authentication Design System */
:root {
    --auth-bg: #f4f6f8;
    --auth-panel: #ffffff;
    --auth-surface: #f8fafc;
    --auth-text-primary: #0f172a;
    --auth-text-secondary: #64748b;
    --auth-text-muted: #94a3b8;
    --auth-border: #e2e8f0;
    --auth-danger: #dc2626;
    --auth-danger-soft: #fef2f2;
    --auth-success: #15803d;
    --auth-success-soft: #f0fdf4;
    --auth-focus: #2563eb;
    --portal-accent: #2563eb;
    --portal-accent-hover: #1d4ed8;
    --portal-accent-soft: rgba(37, 99, 235, 0.12);
    --portal-accent-text: #ffffff;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --shadow-soft: 0 1px 2px rgba(15, 23, 42, 0.05);
    --shadow-card: 0 12px 40px rgba(15, 23, 42, 0.12);
    --auth-font: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    --auth-hero-from: #0b1220;
    --auth-hero-mid: #13233d;
    --auth-hero-to: #0b1220;
}

[data-portal-accent="gold"] {
    --portal-accent: #d4a017;
    --portal-accent-hover: #b8860b;
    --portal-accent-soft: rgba(212, 160, 23, 0.16);
    --portal-accent-text: #0f172a;
    --auth-focus: #d4a017;
    --auth-hero-mid: #1e2a1a;
}
[data-portal-accent="blue"] {
    --portal-accent: #2563eb;
    --portal-accent-hover: #1d4ed8;
    --portal-accent-soft: rgba(37, 99, 235, 0.14);
    --portal-accent-text: #ffffff;
    --auth-focus: #2563eb;
    --auth-hero-mid: #132a4d;
}
[data-portal-accent="indigo"] {
    --portal-accent: #4f46e5;
    --portal-accent-hover: #4338ca;
    --portal-accent-soft: rgba(79, 70, 229, 0.14);
    --portal-accent-text: #ffffff;
    --auth-focus: #4f46e5;
    --auth-hero-mid: #1e1b4b;
}
[data-portal-accent="emerald"] {
    --portal-accent: #059669;
    --portal-accent-hover: #047857;
    --portal-accent-soft: rgba(5, 150, 105, 0.14);
    --portal-accent-text: #ffffff;
    --auth-focus: #059669;
    --auth-hero-mid: #064e3b;
}
[data-portal-accent="green"] {
    --portal-accent: #166534;
    --portal-accent-hover: #14532d;
    --portal-accent-soft: rgba(22, 101, 52, 0.14);
    --portal-accent-text: #ffffff;
    --auth-focus: #166534;
    --auth-hero-mid: #052e16;
}

@media (prefers-color-scheme: dark) {
    html.auth-theme-system {
        --auth-bg: #0b1220;
        --auth-panel: #111827;
        --auth-surface: #1e293b;
        --auth-text-primary: #f1f5f9;
        --auth-text-secondary: #94a3b8;
        --auth-text-muted: #64748b;
        --auth-border: #334155;
        --auth-danger-soft: #3f1d1d;
        --auth-success-soft: #14532d;
    }
}

*, *::before, *::after { box-sizing: border-box; }
body.auth-body {
    margin: 0;
    font-family: var(--auth-font);
    color: var(--auth-text-primary);
    background: var(--auth-bg);
    min-height: 100vh;
}

.auth-page {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    background: var(--auth-bg);
}

.auth-visual {
    display: none;
    width: 52%;
    position: relative;
    overflow: hidden;
    color: #fff;
}
.auth-visual-inner {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: clamp(2rem, 4vw, 3.5rem);
    background:
        radial-gradient(ellipse 70% 50% at 80% 15%, var(--portal-accent-soft), transparent 55%),
        linear-gradient(145deg, var(--auth-hero-from) 0%, var(--auth-hero-mid) 48%, var(--auth-hero-to) 100%);
}
.auth-visual-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(40px);
    opacity: 0.35;
    pointer-events: none;
}
.auth-visual-orb.a { width: 220px; height: 220px; background: var(--portal-accent); top: -40px; right: -30px; }
.auth-visual-orb.b { width: 180px; height: 180px; background: #38bdf8; bottom: 10%; left: -50px; opacity: 0.18; }

.auth-brand-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 2rem;
    position: relative;
    z-index: 1;
}
.auth-brand-row img {
    height: 44px;
    width: auto;
    max-width: 200px;
    object-fit: contain;
}
.auth-brand-text { font-size: 1.35rem; font-weight: 800; letter-spacing: -0.02em; }
.auth-brand-sub { font-size: 0.75rem; color: rgba(255,255,255,0.55); margin-top: 2px; }

.auth-hero-title {
    position: relative;
    z-index: 1;
    font-size: clamp(1.75rem, 2.6vw, 2.35rem);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.03em;
    margin: 0 0 0.85rem;
    max-width: 28ch;
}
.auth-hero-sub {
    position: relative;
    z-index: 1;
    color: rgba(255,255,255,0.68);
    font-size: 1rem;
    line-height: 1.65;
    margin: 0 0 1.75rem;
    max-width: 42ch;
}

.auth-feature-list {
    position: relative;
    z-index: 1;
    display: grid;
    gap: 0.85rem;
    margin-bottom: 1.75rem;
}
.auth-feature {
    display: flex;
    gap: 0.85rem;
    align-items: flex-start;
}
.auth-feature-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: var(--portal-accent-soft);
    color: #fff;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}
.auth-feature h4 {
    margin: 0 0 0.2rem;
    font-size: 0.92rem;
    font-weight: 700;
}
.auth-feature p {
    margin: 0;
    font-size: 0.84rem;
    color: rgba(255,255,255,0.58);
    line-height: 1.45;
}

.auth-preview-grid {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}
.auth-preview-card {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-md);
    padding: 0.9rem 1rem;
    backdrop-filter: blur(8px);
    box-shadow: var(--shadow-soft);
    transition: transform 0.25s ease, border-color 0.25s ease;
}
.auth-preview-card:hover { border-color: rgba(255,255,255,0.22); }
.auth-preview-card .label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgba(255,255,255,0.5);
    margin-bottom: 0.35rem;
}
.auth-preview-card .value {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}
.auth-preview-card .meta {
    margin-top: 0.25rem;
    font-size: 0.72rem;
    color: rgba(255,255,255,0.42);
}
.auth-preview-note {
    position: relative;
    z-index: 1;
    font-size: 0.75rem;
    color: rgba(255,255,255,0.4);
    margin: 0 0 1rem;
}
.auth-trust {
    position: relative;
    z-index: 1;
    padding-top: 1.25rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    font-size: 0.82rem;
    color: rgba(255,255,255,0.45);
    line-height: 1.5;
}

.auth-form-section {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(1.25rem, 3vw, 2.5rem);
    background: var(--auth-panel);
}
.auth-card {
    width: 100%;
    max-width: 460px;
    animation: authFadeIn 0.35s ease;
}
@keyframes authFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
    .auth-card { animation: none; }
    .auth-preview-card { transition: none; }
}

.auth-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 1.5rem;
}
.auth-logo img {
    height: 42px;
    width: auto;
    max-width: 200px;
    object-fit: contain;
}
.auth-logo .brand {
    font-weight: 800;
    font-size: 1.25rem;
    color: var(--auth-text-primary);
    letter-spacing: -0.02em;
}
.auth-portal-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
    background: var(--portal-accent-soft);
    color: var(--portal-accent);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 0.85rem;
}
.auth-heading {
    font-size: clamp(1.45rem, 2vw, 1.75rem);
    font-weight: 800;
    color: var(--auth-text-primary);
    margin: 0 0 0.45rem;
    letter-spacing: -0.02em;
}
.auth-subheading {
    color: var(--auth-text-secondary);
    font-size: 0.95rem;
    margin: 0 0 1.5rem;
    line-height: 1.55;
}

.auth-label {
    display: block;
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--auth-text-primary);
    margin-bottom: 0.4rem;
}
.auth-field { margin-bottom: 1.1rem; }
.auth-input {
    width: 100%;
    min-height: 48px;
    padding: 0.75rem 1rem;
    border: 1.5px solid var(--auth-border);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    color: var(--auth-text-primary);
    background: var(--auth-panel);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.auth-input:focus {
    outline: none;
    border-color: var(--auth-focus);
    box-shadow: 0 0 0 3px var(--portal-accent-soft);
}
.auth-input.error {
    border-color: var(--auth-danger);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
}
.auth-error {
    font-size: 0.8rem;
    color: var(--auth-danger);
    margin-top: 0.3rem;
}
.password-wrapper { position: relative; }
.password-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    min-width: 44px;
    min-height: 44px;
    color: var(--auth-text-muted);
    display: grid;
    place-items: center;
}
.password-toggle:hover,
.password-toggle:focus-visible {
    color: var(--auth-text-primary);
    outline: none;
}

.auth-row-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.4rem;
}
.auth-check {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--auth-text-secondary);
    min-height: 44px;
}
.auth-check input {
    width: 1.05rem;
    height: 1.05rem;
    accent-color: var(--portal-accent);
}

.auth-btn {
    width: 100%;
    min-height: 48px;
    padding: 0.85rem 1.5rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    background: var(--portal-accent);
    color: var(--portal-accent-text);
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
    box-shadow: 0 8px 20px var(--portal-accent-soft);
}
.auth-btn:hover { background: var(--portal-accent-hover); transform: translateY(-1px); }
.auth-btn:active { transform: translateY(0); }
.auth-btn:disabled,
.auth-btn.is-loading {
    opacity: 0.75;
    cursor: not-allowed;
    transform: none;
}
.auth-btn:focus-visible {
    outline: 2px solid var(--portal-accent);
    outline-offset: 2px;
}

.auth-alert {
    padding: 0.9rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
}
.auth-alert.error {
    background: var(--auth-danger-soft);
    border: 1px solid rgba(220, 38, 38, 0.25);
    color: #991b1b;
}
.auth-alert.success {
    background: var(--auth-success-soft);
    border: 1px solid rgba(21, 128, 61, 0.25);
    color: var(--auth-success);
}

.auth-link {
    color: var(--portal-accent);
    font-weight: 600;
    text-decoration: none;
}
.auth-link:hover { text-decoration: underline; }

.auth-switch-portal {
    background: var(--auth-surface);
    border: 1px solid var(--auth-border);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-top: 1.35rem;
}
.auth-switch-portal p {
    font-size: 0.78rem;
    color: var(--auth-text-secondary);
    margin: 0 0 0.65rem;
}
.auth-portal-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}
.auth-portal-chip {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    border: 1px solid var(--auth-border);
    background: var(--auth-panel);
    color: var(--auth-text-secondary);
    font-size: 0.78rem;
    font-weight: 600;
    text-decoration: none;
    transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.auth-portal-chip:hover {
    border-color: var(--portal-accent);
    color: var(--portal-accent);
}
.auth-portal-chip.is-current {
    background: var(--portal-accent-soft);
    border-color: transparent;
    color: var(--portal-accent);
    pointer-events: none;
}

.auth-security {
    margin-top: 1.35rem;
    display: grid;
    gap: 0.35rem;
}
.auth-security-item {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.78rem;
    color: var(--auth-text-muted);
}
.auth-footer-links {
    margin-top: 1.25rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem 1rem;
    justify-content: center;
    font-size: 0.78rem;
}
.auth-footer-links a {
    color: var(--auth-text-muted);
    text-decoration: none;
}
.auth-footer-links a:hover { color: var(--auth-text-secondary); }
.auth-version {
    margin-top: 0.75rem;
    text-align: center;
    font-size: 0.72rem;
    color: var(--auth-text-muted);
}
.auth-powered-by a {
    color: var(--auth-text-secondary);
    text-decoration: none;
}
.auth-powered-by a:hover {
    color: var(--auth-accent, #3b82f6);
    text-decoration: underline;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.25rem 0;
    color: var(--auth-text-muted);
    font-size: 0.78rem;
}
.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--auth-border);
}

.auth-mobile-hero {
    display: none;
    margin-bottom: 1.25rem;
    padding: 1rem 1.1rem;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, var(--auth-hero-from), var(--auth-hero-mid));
    color: #fff;
}
.auth-mobile-hero h2 {
    margin: 0 0 0.35rem;
    font-size: 1.1rem;
    font-weight: 800;
}
.auth-mobile-hero p {
    margin: 0;
    font-size: 0.84rem;
    color: rgba(255,255,255,0.68);
    line-height: 1.45;
}

@media (min-width: 1024px) {
    .auth-visual { display: block; }
    .auth-form-section { width: 48%; }
}
@media (max-width: 1023px) {
    .auth-mobile-hero { display: block; }
    .auth-form-section { width: 100%; background: var(--auth-bg); }
    .auth-card {
        background: var(--auth-panel);
        border: 1px solid var(--auth-border);
        border-radius: var(--radius-lg);
        padding: 1.35rem 1.25rem 1.5rem;
        box-shadow: var(--shadow-card);
    }
}
@media (max-width: 480px) {
    .auth-form-section { padding: 1rem; padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px)); }
    .auth-preview-grid { grid-template-columns: 1fr; }
}
