* {
    box-sizing: border-box;
}

:root {
    --login-bg: #eef3fb;
    --login-surface: rgba(255, 255, 255, 0.92);
    --login-surface-strong: #ffffff;
    --login-border: rgba(148, 163, 184, 0.18);
    --login-ink: #0f172a;
    --login-muted: #64748b;
    --login-accent: #2563eb;
    --login-accent-dark: #1d4ed8;
    --login-danger: #dc2626;
    --login-success: #15803d;
    --login-shadow: 0 28px 90px rgba(15, 23, 42, 0.12);
}

html,
body {
    min-height: 100%;
}

body.login-page {
    margin: 0;
    font-family: "DM Sans", sans-serif;
    color: var(--login-ink);
    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, 0.16), transparent 28%),
        radial-gradient(circle at 82% 16%, rgba(14, 165, 233, 0.12), transparent 22%),
        radial-gradient(circle at bottom right, rgba(56, 189, 248, 0.14), transparent 30%),
        linear-gradient(145deg, #f9fbff 0%, #eef4ff 46%, #f8fbff 100%);
    overflow-x: hidden;
}

.login-shell {
    position: relative;
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 40px 20px;
    isolation: isolate;
}

.login-backdrop {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.login-backdrop::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: min(96vw, 980px);
    height: min(96vw, 980px);
    transform: translate(-50%, -50%);
    border-radius: 50%;
    border: 1px solid rgba(37, 99, 235, 0.08);
    box-shadow:
        0 0 0 110px rgba(255, 255, 255, 0.22),
        0 0 0 230px rgba(37, 99, 235, 0.025);
}

.login-backdrop::after {
    content: '';
    position: absolute;
    inset: 12% 8%;
    border-radius: 48px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.20), rgba(255, 255, 255, 0.02));
    border: 1px solid rgba(255, 255, 255, 0.28);
    opacity: 0.55;
}

.login-glow {
    position: absolute;
    border-radius: 999px;
    filter: blur(90px);
    opacity: 0.72;
}

.login-glow-a {
    width: 420px;
    height: 420px;
    top: -110px;
    left: -130px;
    background: rgba(37, 99, 235, 0.16);
}

.login-glow-b {
    width: 520px;
    height: 520px;
    right: -180px;
    bottom: -160px;
    background: rgba(14, 165, 233, 0.15);
}

.login-grid {
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(148, 163, 184, 0.28) 1px, transparent 1.2px);
    background-size: 26px 26px;
    opacity: 0.34;
    mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.18), rgba(0, 0, 0, 0.68));
    -webkit-mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.18), rgba(0, 0, 0, 0.68));
}

.login-app-cloud {
    position: absolute;
    inset: 0;
}

.login-app-mark {
    position: absolute;
    left: var(--x);
    top: var(--y);
    width: var(--size);
    height: var(--size);
    margin-left: calc(var(--size) * -0.5);
    margin-top: calc(var(--size) * -0.5);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.42);
    border: 1px solid rgba(255, 255, 255, 0.78);
    box-shadow:
        0 18px 42px rgba(148, 163, 184, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(10px);
    opacity: 0.9;
    animation: loginFloat var(--drift) ease-in-out infinite;
    animation-delay: var(--delay);
}

.login-app-mark-core {
    width: calc(100% - 12px);
    height: calc(100% - 12px);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: color-mix(in srgb, var(--accent) 12%, white);
    color: var(--accent);
}

.login-app-mark i {
    font-size: calc(var(--size) * 0.36);
    filter: saturate(1.06) contrast(1.04);
}

.login-app-mark img {
    width: calc(var(--size) * 0.46);
    height: calc(var(--size) * 0.46);
    object-fit: contain;
    filter: saturate(1.06) contrast(1.04);
}

@keyframes loginFloat {
    0%, 100% {
        transform: translate3d(0, 0, 0);
    }
    50% {
        transform: translate3d(0, -14px, 0);
    }
}

.login-stage {
    position: relative;
    z-index: 1;
    width: 100%;
    display: flex;
    justify-content: center;
}

.login-card {
    width: min(100%, 460px);
    padding: 30px;
    border-radius: 32px;
    background: var(--login-surface);
    border: 1px solid var(--login-border);
    box-shadow: var(--login-shadow);
    backdrop-filter: blur(18px);
    animation: cardEnter 0.45s ease-out;
}

@keyframes cardEnter {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.985);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.login-brand-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    margin-bottom: 22px;
}

.login-brand-badge {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.login-brand-icon {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
    color: var(--login-accent);
    font-size: 17px;
}

.login-brand-name {
    font-family: "DM Sans", sans-serif;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--login-ink);
}

.login-register-link,
.login-inline-link,
.login-footer a {
    color: var(--login-accent-dark);
    text-decoration: none;
    font-weight: 700;
}

.login-register-link:hover,
.login-inline-link:hover,
.login-footer a:hover {
    text-decoration: underline;
}

.login-copy {
    margin-bottom: 22px;
}

.login-eyebrow {
    margin: 0 0 10px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #2563eb;
}

.login-copy h1 {
    margin: 0;
    font-family: "DM Sans", sans-serif;
    font-size: clamp(31px, 4vw, 38px);
    line-height: 1.05;
    letter-spacing: -0.04em;
    color: var(--login-ink);
}

.login-description {
    margin: 14px 0 0;
    font-size: 14px;
    line-height: 1.75;
    color: var(--login-muted);
}

.login-feedback {
    display: none;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 18px;
    padding: 14px 16px;
    border-radius: 18px;
    border: 1px solid transparent;
    font-size: 13px;
    line-height: 1.55;
}

.login-feedback.is-visible {
    display: flex;
}

.login-feedback.is-error {
    background: #fef2f2;
    color: #991b1b;
    border-color: rgba(239, 68, 68, 0.18);
}

.login-feedback.is-success {
    background: #f0fdf4;
    color: #166534;
    border-color: rgba(34, 197, 94, 0.18);
}

.login-feedback-icon {
    flex: 0 0 auto;
    margin-top: 1px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.login-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.login-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.login-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--login-ink);
}

.login-inline-link {
    font-size: 12px;
}

.login-input-wrap {
    position: relative;
}

.login-input-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 14px;
    pointer-events: none;
}

.form-control-modern {
    width: 100%;
    min-height: 56px;
    padding: 0 52px 0 46px;
    border-radius: 18px;
    border: 1px solid #dbe1ec;
    background: rgba(255, 255, 255, 0.92);
    color: var(--login-ink);
    font-size: 15px;
    font-family: "DM Sans", sans-serif;
    outline: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.form-control-modern::placeholder {
    color: #94a3b8;
}

.form-control-modern:focus {
    border-color: rgba(37, 99, 235, 0.46);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.10);
    background: #fff;
}

.form-control-modern.is-invalid {
    border-color: rgba(220, 38, 38, 0.55);
    box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.08);
}

.toggle-password {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    transition: color 0.18s ease, background 0.18s ease;
}

.toggle-password:hover {
    color: var(--login-accent);
    background: rgba(37, 99, 235, 0.08);
}

.form-error {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--login-danger);
    padding-left: 2px;
}

.login-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    color: #475569;
    font-size: 13px;
    font-weight: 600;
    user-select: none;
}

.login-checkbox input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.login-checkbox-mark {
    position: relative;
    width: 18px;
    height: 18px;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    background: #fff;
    transition: all 0.18s ease;
}

.login-checkbox input:checked + .login-checkbox-mark {
    background: var(--login-accent);
    border-color: var(--login-accent);
}

.login-checkbox input:checked + .login-checkbox-mark::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 2px;
    width: 5px;
    height: 9px;
    border-right: 2px solid #fff;
    border-bottom: 2px solid #fff;
    transform: rotate(40deg);
}

.btn-login {
    min-height: 56px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border: 0;
    border-radius: 18px;
    background: linear-gradient(135deg, var(--login-accent), var(--login-accent-dark));
    color: #fff;
    font-family: "DM Sans", sans-serif;
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
    box-shadow: 0 16px 32px rgba(37, 99, 235, 0.20);
}

.btn-login:hover {
    transform: translateY(-1px);
    box-shadow: 0 18px 36px rgba(37, 99, 235, 0.24);
}

.btn-login:disabled {
    cursor: wait;
    opacity: 0.9;
}

.btn-login.is-loading .btn-login-spinner {
    display: inline-block;
}

.btn-login-spinner {
    display: none;
    width: 15px;
    height: 15px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: 999px;
    animation: loginSpin 0.7s linear infinite;
}

@keyframes loginSpin {
    to {
        transform: rotate(360deg);
    }
}

.login-divider {
    position: relative;
    margin: 18px 0;
    text-align: center;
}

.login-divider::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 1px;
    background: rgba(148, 163, 184, 0.28);
}

.login-divider span {
    position: relative;
    display: inline-block;
    padding: 0 14px;
    background: rgba(255, 255, 255, 0.92);
    color: var(--login-muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.login-google-btn {
    min-height: 54px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 0 18px;
    border-radius: 18px;
    border: 1px solid rgba(148, 163, 184, 0.26);
    background: rgba(255, 255, 255, 0.78);
    color: var(--login-ink);
    text-decoration: none;
    font-size: 14px;
    font-weight: 700;
    transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.login-google-btn:hover {
    transform: translateY(-1px);
    border-color: rgba(37, 99, 235, 0.24);
    background: #fff;
}

.login-google-btn i {
    color: #ea4335;
    font-size: 16px;
}

.login-footer {
    margin-top: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 13px;
    color: var(--login-muted);
}

@media (max-width: 768px) {
    .login-shell {
        padding: 24px 14px;
    }

    .login-card {
        width: min(100%, 100%);
        padding: 22px;
        border-radius: 24px;
    }

    .login-app-cloud {
    }

    .login-app-mark {
        opacity: 0.8;
    }
}

@media (max-width: 480px) {
    .login-app-mark {
        opacity: 0.72;
    }

    .login-card {
        padding: 18px;
    }

    .login-copy h1 {
        font-size: 29px;
    }

    .login-label-row {
        align-items: flex-start;
        flex-direction: column;
    }
}
