:root {
    --auth-ink: #122033;
    --auth-muted: #6d7f96;
    --auth-line: rgba(18, 32, 51, 0.1);
    --auth-panel: rgba(255, 255, 255, 0.92);
    --auth-panel-strong: rgba(255, 255, 255, 0.98);
    --auth-brand-a: #0f766e;
    --auth-brand-b: #0891b2;
    --auth-brand-c: #f59e0b;
    --auth-shadow: 0 28px 70px rgba(15, 23, 42, 0.18);
}

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

body.login-page {
    position: relative;
    overflow-x: hidden;
    background:
        radial-gradient(circle at top left, rgba(8, 145, 178, 0.22), transparent 32%),
        radial-gradient(circle at bottom right, rgba(245, 158, 11, 0.22), transparent 28%),
        linear-gradient(135deg, #edf6f7 0%, #f7fafc 46%, #eef4ff 100%);
    color: var(--auth-ink);
}

body.login-page::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.18)),
        repeating-linear-gradient(
            90deg,
            transparent 0,
            transparent 76px,
            rgba(15, 118, 110, 0.04) 76px,
            rgba(15, 118, 110, 0.04) 77px
        ),
        repeating-linear-gradient(
            0deg,
            transparent 0,
            transparent 76px,
            rgba(8, 145, 178, 0.04) 76px,
            rgba(8, 145, 178, 0.04) 77px
        );
    opacity: 0.85;
}

body.login-page::after {
    content: "";
    position: fixed;
    inset: auto auto 8% -6%;
    width: min(46vw, 560px);
    height: min(46vw, 560px);
    border-radius: 50%;
    background: radial-gradient(circle, rgba(15, 118, 110, 0.11) 0%, rgba(15, 118, 110, 0) 68%);
    pointer-events: none;
    filter: blur(8px);
}

#bg-canvas {
    position: fixed;
    inset: 0;
    z-index: 0;
    display: block;
    opacity: 0.34;
    mix-blend-mode: multiply;
    background: transparent;
}

.alert {
    position: relative;
    z-index: 2;
    width: min(92vw, 460px);
    margin: 1.25rem auto 0;
    border-radius: 0.75rem;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.1);
}

.login-box,
.register-box {
    position: relative;
    z-index: 2;
    width: min(92vw, 520px);
    margin: 4.5rem auto;
}

.register-box {
    width: min(92vw, 560px);
}

.auth-legal-box {
    width: min(94vw, 860px);
}

.auth-terms-modal {
    max-width: min(92vw, 860px);
}

.login-box .card,
.register-box .card {
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 1.25rem;
    overflow: hidden;
    background: linear-gradient(180deg, var(--auth-panel-strong) 0%, var(--auth-panel) 100%);
    box-shadow: var(--auth-shadow);
    backdrop-filter: blur(16px);
}

.login-box .card::before,
.register-box .card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 6px;
    background: linear-gradient(90deg, var(--auth-brand-a), var(--auth-brand-b), var(--auth-brand-c));
}

.login-box .card-header,
.register-box .card-header {
    position: relative;
    border-bottom: 1px solid var(--auth-line);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(255, 255, 255, 0.8)),
        radial-gradient(circle at top right, rgba(8, 145, 178, 0.09), transparent 34%);
    padding: 1.75rem 1.75rem 1.1rem;
}

.login-box .card-body,
.register-box .card-body {
    padding: 1.5rem 1.75rem 1.75rem;
}

.login-box .login-box-msg,
.register-box .login-box-msg {
    color: var(--auth-muted);
    font-size: 0.98rem;
    margin-bottom: 1.2rem;
}

.login-box .h1 svg,
.register-box .h1 svg {
    width: 100%;
    max-width: 320px;
    margin: 0 auto;
}

.login-box .h1,
.register-box .h1 {
    display: block;
    margin: 0 auto;
}

.input-group-text {
    border-color: rgba(8, 145, 178, 0.18);
    background: rgba(8, 145, 178, 0.08);
    color: #0f5f74;
}

.form-control {
    border-color: rgba(18, 32, 51, 0.12);
    border-radius: 0.65rem;
    min-height: 2.85rem;
    box-shadow: none;
}

.input-group > .form-control:not(:last-child) {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.input-group-append .input-group-text {
    border-top-right-radius: 0.65rem;
    border-bottom-right-radius: 0.65rem;
}

.form-control:focus {
    border-color: rgba(8, 145, 178, 0.42);
    box-shadow: 0 0 0 0.2rem rgba(8, 145, 178, 0.12);
}

.btn-primary {
    border: none;
    border-radius: 0.75rem;
    background: linear-gradient(135deg, var(--auth-brand-a) 0%, var(--auth-brand-b) 65%, #38bdf8 100%);
    box-shadow: 0 12px 24px rgba(8, 145, 178, 0.18);
    font-weight: 700;
}

.btn-primary:hover,
.btn-primary:focus {
    background: linear-gradient(135deg, #0d6d66 0%, #0b82a1 65%, #22aee8 100%);
}

.icheck-primary > input:first-child:checked + label::before {
    background-color: var(--auth-brand-b);
    border-color: var(--auth-brand-b);
}

.login-box a,
.register-box a {
    color: #0f5f74;
    font-weight: 600;
}

.login-box a:hover,
.register-box a:hover {
    color: #0c4d5f;
    text-decoration: none;
}

#auth-login .login-box,
#auth-forgot-password .login-box,
#auth-reset-password .login-box,
#auth-twofa-verify .login-box {
    max-width: 470px;
}

#auth-terms .auth-legal-box .card-body {
    max-height: min(78vh, 860px);
    overflow-y: auto;
}

.auth-terms-modal .modal-content {
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 1.25rem;
    overflow: hidden;
    background: linear-gradient(180deg, var(--auth-panel-strong) 0%, var(--auth-panel) 100%);
    box-shadow: var(--auth-shadow);
    backdrop-filter: blur(16px);
}

.auth-terms-modal .modal-header,
.auth-terms-modal .modal-footer {
    border-color: var(--auth-line);
    background: rgba(255, 255, 255, 0.9);
}

.auth-terms-modal .modal-body {
    max-height: min(70vh, 760px);
    overflow-y: auto;
    color: var(--auth-ink);
}

@media (max-width: 767px) {
    .login-box,
    .register-box {
        margin: 2rem auto;
        width: min(94vw, 520px);
    }

    .login-box .card-header,
    .register-box .card-header,
    .login-box .card-body,
    .register-box .card-body {
        padding-left: 1.1rem;
        padding-right: 1.1rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    #bg-canvas {
        opacity: 0.18;
    }
}
