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

body {
    background: #0b0f1a;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    padding: 20px;
}

/* subtle dot-grid background */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(79,110,242,.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(79,110,242,.05) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
    z-index: 0;
}

.login-wrap {
    width: 100%;
    max-width: 400px;
    position: relative;
    z-index: 1;
}

/* ── Card ───────────────────────────────────────────────────────────────────── */
.login-card {
    background: #131929;
    border: 1px solid #222d48;
    border-radius: 18px;
    padding: 44px 40px 36px;
    box-shadow: 0 24px 64px rgba(0,0,0,.55), 0 0 0 1px rgba(79,110,242,.06);
}

/* ── Logo ───────────────────────────────────────────────────────────────────── */
.login-logo {
    width: 54px;
    height: 54px;
    background: linear-gradient(135deg, #4f6ef2 0%, #7c4dff 100%);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    color: #fff;
    margin: 0 auto 20px;
    box-shadow: 0 8px 24px rgba(79,110,242,.35);
}
.login-title {
    text-align: center;
    color: #e2e8f4;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -.02em;
    margin-bottom: 5px;
}
.login-sub {
    text-align: center;
    color: #4a5574;
    font-size: .8rem;
    margin-bottom: 32px;
}

/* ── Fields ─────────────────────────────────────────────────────────────────── */
.field-group { margin-bottom: 18px; }
.field-label {
    display: block;
    color: #6b7fa8;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    margin-bottom: 7px;
}
.input-wrap { position: relative; }

.input-wrap .i-icon {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: #3a4563;
    font-size: .95rem;
    pointer-events: none;
    transition: color .15s;
}
.input-wrap:focus-within .i-icon { color: #4f6ef2; }

.input-wrap input[type="text"],
.input-wrap input[type="password"] {
    width: 100%;
    background: #0d1320;
    border: 1.5px solid #1e2b47;
    border-radius: 10px;
    color: #e2e8f4;
    padding: 12px 42px;
    font-size: .875rem;
    font-family: inherit;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}
.input-wrap input::placeholder { color: #2e3e60; }
.input-wrap input:focus {
    border-color: #4f6ef2;
    box-shadow: 0 0 0 3px rgba(79,110,242,.18);
}
.input-wrap input.input-error { border-color: #7f1d1d; }

/* ── Toggle password visibility ─────────────────────────────────────────────── */
.toggle-pass {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: #3a4563;
    font-size: .95rem;
    padding: 4px;
    line-height: 1;
    transition: color .15s;
}
.toggle-pass:hover { color: #8899bb; }

/* ── Login button ───────────────────────────────────────────────────────────── */
#loginButton {
    width: 100%;
    background: linear-gradient(135deg, #4f6ef2 0%, #7c4dff 100%);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 13px;
    font-size: .9rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 6px;
    transition: opacity .15s, transform .1s, box-shadow .15s;
    box-shadow: 0 4px 16px rgba(79,110,242,.3);
}
#loginButton:hover:not(:disabled) {
    opacity: .9;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(79,110,242,.4);
}
#loginButton:active:not(:disabled) { transform: translateY(0); }
#loginButton:disabled {
    opacity: .55;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

#btnSpinner {
    width: 15px;
    height: 15px;
    border: 2px solid rgba(255,255,255,.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: lspin .65s linear infinite;
    display: none;
    flex-shrink: 0;
}
@keyframes lspin { to { transform: rotate(360deg); } }
/* ── Message box ────────────────────────────────────────────────────────────── */
.msg-box {
    margin-top: 18px;
    padding: 11px 14px;
    border-radius: 9px;
    font-size: .82rem;
    line-height: 1.5;
    display: none;
    align-items: flex-start;
    gap: 8px;
}
.msg-box.show   { display: flex; }
.msg-box.error  { background: #1e0d0d; border: 1px solid #5c1a1a; color: #fc9f9f; }
.msg-box.success{ background: #0c1e10; border: 1px solid #1a5c2b; color: #86efac; }
.msg-box .bi    { flex-shrink: 0; margin-top: 1px; }

/* ── Footer ─────────────────────────────────────────────────────────────────── */
.login-footer {
    text-align: center;
    margin-top: 24px;
    color: #232d46;
    font-size: .75rem;
    letter-spacing: .02em;
}
