:root {
    --auth-shell-bg: #f4f7fb;
    --auth-surface: #ffffff;
    --auth-surface-muted: #f8fafc;
    --auth-border: rgba(148, 163, 184, 0.28);
    --auth-shadow: 0 24px 52px rgba(15, 23, 42, 0.12);
    --auth-text: #0f172a;
    --auth-muted: #64748b;
    --auth-primary: #1d4ed8;
    --auth-primary-strong: #0f3ea8;
    --auth-primary-soft: rgba(29, 78, 216, 0.1);
    --auth-accent: #2dd4bf;
    --auth-success: #15803d;
    --auth-danger: #b91c1c;
    --auth-warning: #b45309;
}

body.auth-body {
    min-height: 100vh;
    margin: 0;
    font-family: 'Inter', sans-serif;
    color: var(--auth-text);
    background: linear-gradient(180deg, #eef3f8 0%, #f8fafc 46%, #eef4f9 100%);
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(320px, 1fr) minmax(360px, 0.92fr);
}

.auth-brand-panel {
    position: relative;
    overflow: hidden;
    padding: 3rem;
    background:
        linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px),
        linear-gradient(180deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px),
        linear-gradient(150deg, #0f172a 0%, #173766 58%, #0f4c81 100%);
    background-size: 44px 44px, 44px 44px, auto;
    color: #f8fafc;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 2rem;
}

.auth-brand-content,
.auth-brand-footer {
    position: relative;
    z-index: 1;
}

.auth-brand-topline {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    width: fit-content;
    padding: 0.52rem 0.82rem;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.22);
    border: 1px solid rgba(226, 232, 240, 0.16);
    color: rgba(248, 250, 252, 0.88);
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.auth-brand-header {
    margin-top: 1.75rem;
    display: grid;
    gap: 1.1rem;
}

.auth-brand-logo {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.auth-brand-logo img {
    width: 4.9rem;
    height: 4.9rem;
    object-fit: contain;
    border-radius: 12px;
    background: #ffffff;
    padding: 0.62rem;
    box-shadow: 0 16px 34px rgba(15, 23, 42, 0.2);
}

.auth-brand-copy strong {
    display: block;
    font-size: 1.28rem;
    font-weight: 800;
}

.auth-brand-copy span {
    display: block;
    margin-top: 0.25rem;
    color: rgba(226, 232, 240, 0.78);
    font-size: 0.92rem;
}

.auth-brand-title {
    margin: 0;
    max-width: 44rem;
    font-size: clamp(2rem, 4vw, 3.35rem);
    line-height: 1.06;
    letter-spacing: 0;
}

.auth-brand-text {
    margin: 0;
    max-width: 42rem;
    color: rgba(226, 232, 240, 0.84);
    line-height: 1.72;
    font-size: 1rem;
}

.auth-brand-grid {
    margin-top: 2rem;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
}

.auth-brand-card {
    display: grid;
    grid-template-columns: auto 1fr;
    column-gap: 0.8rem;
    row-gap: 0.25rem;
    padding: 1rem;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.3);
    border: 1px solid rgba(226, 232, 240, 0.13);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.auth-brand-card::before {
    content: "";
    width: 0.55rem;
    height: 0.55rem;
    margin-top: 0.28rem;
    border-radius: 999px;
    background: var(--auth-accent);
    box-shadow: 0 0 0 4px rgba(45, 212, 191, 0.14);
}

.auth-brand-card strong {
    display: block;
    font-size: 0.92rem;
}

.auth-brand-card span {
    grid-column: 2;
    color: rgba(226, 232, 240, 0.72);
    font-size: 0.85rem;
    line-height: 1.5;
}

.auth-brand-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding-top: 1.15rem;
    border-top: 1px solid rgba(226, 232, 240, 0.13);
    color: rgba(226, 232, 240, 0.72);
    font-size: 0.84rem;
}

.auth-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    gap: 1rem;
}

.auth-card {
    width: min(100%, 31.5rem);
    padding: 2rem;
    border-radius: 8px;
    background: var(--auth-surface);
    border: 1px solid var(--auth-border);
    box-shadow: var(--auth-shadow);
}

.auth-copyright {
    width: min(100%, 31.5rem);
    color: #64748b;
    font-size: 0.82rem;
    line-height: 1.5;
    text-align: center;
}

.auth-copyright a {
    color: #1d4ed8;
    font-weight: 750;
    text-decoration: none;
}

.auth-copyright a:hover,
.auth-copyright a:focus-visible {
    text-decoration: underline;
}

.auth-card-header {
    display: grid;
    gap: 0.72rem;
    margin-bottom: 1.45rem;
}

.auth-card-kicker {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    width: fit-content;
    padding: 0.48rem 0.78rem;
    border-radius: 999px;
    background: var(--auth-primary-soft);
    color: var(--auth-primary);
    font-weight: 800;
    font-size: 0.76rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.auth-card-header h1 {
    margin: 0;
    font-size: clamp(1.8rem, 3vw, 2.25rem);
    line-height: 1.1;
    letter-spacing: 0;
}

.auth-card-header p,
.auth-page-tagline {
    margin: 0;
    color: var(--auth-muted);
    line-height: 1.65;
}

.auth-page-tagline {
    font-size: 0.9rem;
    line-height: 1.55;
}

.auth-form {
    display: grid;
    gap: 1rem;
}

.auth-form .form-group {
    margin: 0;
}

.auth-form label {
    display: flex;
    align-items: center;
    gap: 0.52rem;
    margin-bottom: 0.5rem;
    color: var(--auth-text);
    font-size: 0.9rem;
    font-weight: 750;
}

.auth-form input,
.auth-form textarea {
    width: 100%;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.32);
    background: var(--auth-surface-muted);
    color: var(--auth-text);
    font-size: 0.96rem;
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.auth-form input {
    height: 3.1rem;
    padding: 0 0.95rem;
}

.auth-form textarea {
    min-height: 7rem;
    padding: 0.9rem 0.95rem;
    resize: vertical;
}

.auth-form input:focus,
.auth-form textarea:focus,
.auth-form input:focus-visible,
.auth-form textarea:focus-visible {
    outline: none;
    border-color: rgba(29, 78, 216, 0.62);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.13);
    background: #ffffff;
}

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

.auth-password-field input {
    padding-right: 3.25rem;
}

.auth-password-toggle {
    position: absolute;
    top: 50%;
    right: 0.65rem;
    transform: translateY(-50%);
    width: 2.1rem;
    height: 2.1rem;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: #64748b;
    cursor: pointer;
}

.auth-password-toggle:hover,
.auth-password-toggle:focus-visible {
    outline: none;
    background: rgba(148, 163, 184, 0.14);
    color: #0f172a;
}

.auth-submit {
    margin-top: 0.25rem;
    height: 3.2rem;
    border: 0;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--auth-primary), #2563eb);
    color: #ffffff;
    font-size: 0.97rem;
    font-weight: 750;
    letter-spacing: 0.01em;
    cursor: pointer;
    box-shadow: 0 14px 24px rgba(37, 99, 235, 0.18);
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.auth-submit:hover {
    transform: translateY(-1px);
    background: linear-gradient(135deg, var(--auth-primary-strong), #1d4ed8);
    box-shadow: 0 18px 28px rgba(37, 99, 235, 0.22);
}

.auth-submit:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.18), 0 14px 24px rgba(37, 99, 235, 0.18);
}

.auth-submit:disabled {
    opacity: 0.75;
    cursor: wait;
    transform: none;
}

.auth-helper-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 0.1rem;
}

.auth-link,
.auth-helper-text a,
.auth-card-actions a {
    color: var(--auth-primary);
    text-decoration: none;
    font-weight: 700;
}

.auth-link:hover,
.auth-helper-text a:hover,
.auth-card-actions a:hover {
    text-decoration: underline;
}

.auth-card-actions {
    margin-top: 1rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem 0.7rem;
    color: var(--auth-muted);
    font-size: 0.92rem;
    line-height: 1.5;
}

.auth-helper-text {
    margin: 0;
    color: var(--auth-muted);
    font-size: 0.92rem;
    line-height: 1.6;
}

.auth-note {
    margin-top: 1rem;
    padding: 0.95rem 1rem;
    border-radius: 8px;
    background: #f8fafc;
    border: 1px solid rgba(226, 232, 240, 0.95);
    color: var(--auth-muted);
    font-size: 0.88rem;
    line-height: 1.6;
}

.auth-note strong {
    color: var(--auth-text);
}

.auth-status {
    margin-top: 1rem;
    padding: 0.9rem 1rem;
    border-radius: 8px;
    font-size: 0.92rem;
    line-height: 1.6;
    display: none;
}

.auth-status.is-visible {
    display: block;
}

.auth-status.is-success {
    background: rgba(34, 197, 94, 0.12);
    border: 1px solid rgba(34, 197, 94, 0.2);
    color: var(--auth-success);
}

.auth-status.is-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.18);
    color: var(--auth-danger);
}

.auth-status.is-warning {
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.18);
    color: var(--auth-warning);
}

.auth-debug-link {
    margin-top: 0.75rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--auth-primary);
    font-weight: 700;
    text-decoration: none;
}

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

#toast-container {
    position: fixed;
    right: 1.2rem;
    bottom: 1.2rem;
    z-index: 1200;
}

@media (max-width: 1040px) {
    .auth-shell {
        grid-template-columns: 1fr;
    }

    .auth-brand-panel {
        min-height: auto;
        padding: 2.2rem 1.6rem;
    }

    .auth-brand-title {
        font-size: clamp(1.9rem, 6vw, 2.7rem);
    }

    .auth-panel {
        padding: 1.35rem 1rem 2rem;
    }
}

@media (max-width: 640px) {
    .auth-brand-panel {
        padding: 1.45rem 1rem;
    }

    .auth-brand-logo img {
        width: 4rem;
        height: 4rem;
    }

    .auth-brand-grid {
        grid-template-columns: 1fr;
        margin-top: 1.25rem;
    }

    .auth-brand-footer,
    .auth-helper-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .auth-card {
        padding: 1.25rem;
        border-radius: 8px;
    }

    .auth-card-actions {
        flex-direction: column;
        align-items: flex-start;
    }
}
