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

:root {
    font-family: Inter, system-ui, sans-serif;
    color: #172033;
    background: #f4f7f6;
}

body {
    margin: 0;
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 1.5rem;
    background:
        radial-gradient(circle at 15% 10%, rgba(34, 197, 94, .12), transparent 32%),
        #f4f7f6;
}

.auth-page.theme-red {
    width: 100%;
    min-height: calc(100vh - 3rem);
    display: grid;
    place-items: center;
    background: radial-gradient(circle at 85% 10%, rgba(220, 38, 38, .13), transparent 32%);
}

.auth-page.theme-green {
    width: 100%;
    min-height: calc(100vh - 3rem);
    display: grid;
    place-items: center;
}

.auth-card {
    width: min(100%, 430px);
    padding: clamp(1.75rem, 5vw, 2.5rem);
    background: rgba(255, 255, 255, .96);
    border: 1px solid #e5e9e7;
    border-radius: 1.25rem;
    box-shadow: 0 1.5rem 4rem rgba(15, 23, 42, .1);
}

.auth-mark {
    width: 2.75rem;
    height: 2.75rem;
    display: grid;
    place-items: center;
    margin-bottom: 1.25rem;
    border-radius: .85rem;
    color: #fff;
    font-size: 1.15rem;
    font-weight: 800;
}

.theme-green .auth-mark,
.theme-green .auth-submit { background: #16a34a; }

.theme-red .auth-mark,
.theme-red .auth-submit { background: #dc2626; }

.auth-kicker {
    margin: 0 0 .45rem;
    color: #64748b;
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.auth-card h1 {
    margin: 0;
    color: #0f172a;
    font-size: clamp(1.7rem, 5vw, 2.1rem);
    letter-spacing: -.04em;
}

.auth-description {
    margin: .65rem 0 1.75rem;
    color: #64748b;
    font-size: .92rem;
    line-height: 1.55;
}

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

.auth-field { display: grid; gap: .3rem; }

.auth-field label {
    color: #334155;
    font-size: .8rem;
    font-weight: 700;
}

.auth-field input {
    width: 100%;
    padding: .65rem .75rem;
    border: 1px solid #d5ddd9;
    border-radius: .65rem;
    color: #0f172a;
    background: #fff;
    font: inherit;
    transition: border-color .15s, box-shadow .15s;
}

.auth-field input:focus {
    outline: none;
    box-shadow: 0 0 0 4px rgba(22, 163, 74, .12);
    border-color: #16a34a;
}

.theme-red .auth-field input:focus {
    box-shadow: 0 0 0 4px rgba(220, 38, 38, .12);
    border-color: #dc2626;
}

.auth-submit {
    width: 100%;
    margin-top: .35rem;
    padding: .82rem 1rem;
    border: 0;
    border-radius: .65rem;
    color: #fff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: filter .15s, transform .15s;
}

.auth-submit:hover { filter: brightness(.93); }
.auth-submit:active { transform: translateY(1px); }

.auth-forgot-password {
    justify-self: end;
    padding: 0;
    border: 0;
    color: #15803d;
    background: transparent;
    font: inherit;
    font-size: .8rem;
    font-weight: 700;
    cursor: pointer;
}

.auth-forgot-password:hover { text-decoration: underline; }

.auth-modal {
    width: min(100% - 2rem, 390px);
    padding: 0;
    border: 1px solid #e5e9e7;
    border-radius: 1rem;
    box-shadow: 0 1.5rem 4rem rgba(15, 23, 42, .2);
}

.auth-modal::backdrop { background: rgba(15, 23, 42, .45); }

.auth-modal-form { padding: 1.5rem; }

.auth-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.auth-modal-header h2 {
    margin: 0;
    color: #0f172a;
    font-size: 1.2rem;
}

.auth-modal-header + p {
    margin: .65rem 0 1.25rem;
    color: #64748b;
    font-size: .87rem;
    line-height: 1.5;
}

.auth-modal-close,
.auth-modal-cancel {
    border: 0;
    color: #64748b;
    background: transparent;
    font: inherit;
    cursor: pointer;
}

.auth-modal-close {
    width: 2rem;
    height: 2rem;
    border-radius: .45rem;
    font-size: 1.5rem;
    line-height: 1;
}

.auth-modal-close:hover { color: #334155; background: #f1f5f9; }

.auth-modal-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: .75rem;
    margin-top: 1.25rem;
}

.auth-modal-actions .auth-submit { width: auto; margin-top: 0; }
.auth-modal-cancel:hover { color: #334155; }

.auth-alert {
    margin: 0 0 1rem;
    padding: .75rem .85rem;
    border: 1px solid #fecaca;
    border-radius: .6rem;
    color: #991b1b;
    background: #fef2f2;
    font-size: .85rem;
    line-height: 1.4;
}

.auth-alert.success {
    border-color: #bbf7d0;
    color: #166534;
    background: #f0fdf4;
}

.auth-footer {
    margin: 1.35rem 0 0;
    color: #64748b;
    font-size: .85rem;
    text-align: center;
}

.auth-footer a {
    color: #15803d;
    font-weight: 700;
    text-decoration: none;
}

.theme-red .auth-footer a { color: #b91c1c; }
.auth-footer a:hover { text-decoration: underline; }

@media (max-width: 480px) {
    body { padding: .75rem; }
    .auth-page.theme-green,
    .auth-page.theme-red { min-height: calc(100vh - 1.5rem); }
    .auth-card { border-radius: 1rem; }
}
