:root {
    --bg-primary: #05070d;
    --bg-secondary: #0a1220;
    --panel: rgba(10, 18, 32, 0.90);
    --panel-soft: rgba(255, 255, 255, 0.045);
    --glass-border: rgba(255, 255, 255, 0.11);
    --text-primary: #f4f7fb;
    --text-muted: #a8b3c3;
    --accent: #22c55e;
    --accent-strong: #16a34a;
    --danger: #ff7b89;
    --shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
}

* {
    box-sizing: border-box;
}

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

body {
    margin: 0;
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow-x: hidden;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(5, 7, 13, 0.86);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--glass-border);
}

.container {
    width: min(1280px, 94%);
    margin: auto;
}

.topbar-inner {
    min-height: 66px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: #fff;
}

.logo {
    height: 30px;
    width: auto;
}

.brand span {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
}

.nav-actions .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 15px;
    border-radius: 10px;
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    text-decoration: none;
}

.auth-wrap {
    min-height: calc(100vh - 66px);
    padding: 42px 0 54px;
    background:
        radial-gradient(circle at 16% 24%, rgba(34, 197, 94, 0.12), transparent 34%),
        radial-gradient(circle at 84% 80%, rgba(34, 197, 94, 0.07), transparent 42%),
        linear-gradient(180deg, var(--bg-primary), var(--bg-secondary));
}

.auth-container {
    width: min(1280px, 94%);
    margin: auto;
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(460px, 0.95fr);
    gap: clamp(36px, 5vw, 76px);
    align-items: center;
}

.auth-left {
    display: flex;
    align-items: center;
}

.auth-left-inner {
    max-width: 570px;
}

.badge {
    margin-bottom: 14px;
    color: var(--accent);
    font-size: 11px;
    font-weight: 750;
    letter-spacing: 1.3px;
}

.auth-left h1 {
    margin: 0;
    font-size: clamp(40px, 4vw, 58px);
    line-height: 1.06;
    letter-spacing: -1.7px;
}

.lead {
    margin-top: 18px;
    max-width: 540px;
    color: var(--text-muted);
    font-size: 15px;
    line-height: 1.7;
}

.value-grid {
    margin-top: 28px;
    display: grid;
    gap: 16px;
}

.value {
    display: flex;
    gap: 12px;
    color: #c1cad7;
    line-height: 1.5;
}

.value span {
    color: var(--accent);
    font-weight: 800;
}

.info-card {
    margin-top: 36px;
    padding: 24px;
    border-radius: 18px;
    background: var(--panel-soft);
    border: 1px solid var(--glass-border);
}

.auth-right {
    display: flex;
    align-items: center;
    min-width: 0;
}

.form-card {
    width: 100%;
    padding: clamp(26px, 3vw, 38px);
    border-radius: 24px;
    background: var(--panel);
    border: 1px solid rgba(255, 255, 255, .12);
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow);
}

.form-head h2 {
    margin: 0;
    font-size: 28px;
    letter-spacing: -0.5px;
}

.form-head p {
    margin: 8px 0 4px;
    color: var(--text-muted);
    line-height: 1.55;
}

.field,
.auth-field {
    margin-top: 18px;
}

.field label,
.auth-field label {
    display: block;
    margin-bottom: 7px;
    color: #dce4ee;
    font-size: 12px;
    font-weight: 650;
}

.field input,
.auth-field input {
    width: 100%;
    min-height: 49px;
    padding: 13px 14px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, .13);
    background: rgba(255, 255, 255, .065);
    color: #fff;
    font-size: 15px;
    outline: none;
    transition: border-color .2s, box-shadow .2s, background .2s;
}

.field input::placeholder,
.auth-field input::placeholder {
    color: #7f8a99;
}

.field input:focus,
.auth-field input:focus {
    border-color: var(--accent);
    background: rgba(255, 255, 255, .08);
    box-shadow: 0 0 0 3px rgba(34, 197, 94, .15);
}

.field input:disabled,
.auth-field input:disabled {
    opacity: .62;
    cursor: not-allowed;
}

.password-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

.password-wrap input {
    flex: 1;
}

.password-wrap button {
    flex: 0 0 auto;
    padding: 8px;
    border: 0;
    background: none;
    color: var(--accent);
    font-weight: 700;
    cursor: pointer;
}

.btsh-mfa-field {
    margin-top: 16px;
}

.btsh-mfa-field input {
    text-align: center;
    letter-spacing: .45em;
    font-size: 20px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.mfa-help {
    display: block;
    margin-top: 8px;
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.5;
}

.mfa-setup-card {
    margin-top: 18px;
    padding: 20px;
    border: 1px solid rgba(34, 197, 94, .28);
    border-radius: 18px;
    background: linear-gradient(145deg, rgba(34, 197, 94, .09), rgba(255, 255, 255, .035));
}

.mfa-setup-head {
    display: flex;
    gap: 13px;
    align-items: flex-start;
}

.mfa-shield {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    border-radius: 11px;
    display: grid;
    place-items: center;
    background: rgba(34, 197, 94, .15);
    border: 1px solid rgba(34, 197, 94, .35);
    color: var(--accent);
    font-weight: 900;
}

.mfa-eyebrow {
    color: var(--accent);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1px;
}

.mfa-setup-head h3 {
    margin: 4px 0 4px;
    font-size: 19px;
}

.mfa-setup-head p {
    margin: 0;
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.55;
}

.mfa-setup-grid {
    margin-top: 18px;
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr);
    gap: 18px;
    align-items: stretch;
}

.mfa-qr-panel {
    padding: 12px;
    min-height: 204px;
    border-radius: 15px;
    background: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.mfa-qr-image {
    display: block;
    width: 156px;
    height: 156px;
    max-width: 100%;
    object-fit: contain;
}

.mfa-qr-panel span {
    color: #263244;
    font-size: 11px;
    font-weight: 750;
}

.mfa-qr-unavailable {
    color: #5d6673;
    font-size: 12px;
}

.mfa-manual-panel {
    min-width: 0;
    padding: 15px;
    border-radius: 15px;
    background: rgba(3, 7, 15, .42);
    border: 1px solid rgba(255, 255, 255, .08);
}

.mfa-step {
    display: block;
    color: #cfd8e4;
    font-size: 12px;
    font-weight: 650;
}

.mfa-secret-row {
    margin-top: 9px;
    display: flex;
    align-items: stretch;
    gap: 8px;
    min-width: 0;
}

.mfa-secret-row code {
    flex: 1;
    min-width: 0;
    padding: 11px 12px;
    border-radius: 10px;
    background: rgba(255, 255, 255, .075);
    border: 1px solid rgba(255, 255, 255, .1);
    color: #fff;
    font-size: 13px;
    line-height: 1.5;
    overflow-wrap: anywhere;
    user-select: all;
}

.mfa-copy-btn {
    border: 1px solid rgba(34, 197, 94, .35);
    border-radius: 10px;
    padding: 0 13px;
    background: rgba(34, 197, 94, .12);
    color: #8df1af;
    font-weight: 750;
    cursor: pointer;
}

.mfa-instructions {
    margin: 13px 0 0;
    padding-left: 19px;
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.55;
}

.mfa-instructions li+li {
    margin-top: 5px;
}

.btn-primary {
    width: 100%;
    min-height: 50px;
    margin-top: 22px;
    padding: 14px 18px;
    border: none;
    border-radius: 13px;
    background: linear-gradient(135deg, #2ed466, var(--accent-strong));
    color: #031d0c;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    transition: transform .2s, box-shadow .2s, opacity .2s;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(34, 197, 94, .24);
}

.btn-primary:disabled {
    opacity: .65;
    cursor: wait;
}

.auth-row {
    margin-top: 12px;
}

.auth-link,
.alt a,
.legal a {
    color: var(--accent);
    text-decoration: none;
}

.auth-link {
    font-size: 13px;
}

.alt {
    margin-top: 14px;
    color: var(--text-muted);
    font-size: 13px;
}

.legal {
    margin-top: 20px;
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.55;
}

.error {
    display: none;
    margin-top: 13px;
    padding: 11px 13px;
    border-radius: 10px;
    border: 1px solid rgba(255, 123, 137, .28);
    background: rgba(255, 123, 137, .08);
    color: var(--danger);
    font-size: 13px;
    line-height: 1.45;
}

.demo-login {
    margin-top: 24px;
}

.demo-title {
    margin-bottom: 10px;
    color: var(--text-muted);
    font-size: 13px;
}

.demo-buttons {
    display: flex;
    gap: 8px;
}

.btn.demo {
    flex: 1;
    padding: 10px;
    border-radius: 10px;
    border: 1px solid var(--glass-border);
    background: transparent;
    color: #fff;
    cursor: pointer;
}

@media (max-width: 1050px) {
    .auth-container {
        grid-template-columns: minmax(0, .9fr) minmax(440px, 1.1fr);
        gap: 34px;
    }

    .auth-left h1 {
        font-size: 42px;
    }
}

@media (max-width: 900px) {
    .auth-wrap {
        padding-top: 24px;
    }

    .auth-container {
        grid-template-columns: 1fr;
        width: min(620px, 92%);
    }

    .auth-left {
        display: none;
    }
}

@media (max-width: 620px) {
    .topbar-inner {
        min-height: 60px;
    }

    .auth-wrap {
        min-height: calc(100vh - 60px);
        padding: 16px 0 28px;
    }

    .auth-container {
        width: min(100% - 24px, 540px);
    }

    .form-card {
        padding: 22px 17px;
        border-radius: 18px;
    }

    .mfa-setup-card {
        padding: 16px;
    }

    .mfa-setup-grid {
        grid-template-columns: 1fr;
    }

    .mfa-qr-panel {
        width: min(230px, 100%);
        margin: 0 auto;
    }

    .mfa-secret-row {
        flex-direction: column;
    }

    .mfa-copy-btn {
        min-height: 42px;
    }

    .btsh-mfa-field input {
        letter-spacing: .32em;
    }
}

/* =========================================
   MFA RECOVERY CODES
========================================= */
.recovery-card {
    margin-top: 18px;
}

.recovery-warning {
    margin: 16px 0;
    padding: 13px 14px;
    border: 1px solid rgba(245, 158, 11, .32);
    background: rgba(245, 158, 11, .09);
    color: #fde68a;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.5;
}

.recovery-code-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
    margin: 14px 0;
}

.recovery-code-grid code {
    display: block;
    padding: 11px 12px;
    text-align: center;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, .11);
    background: rgba(255, 255, 255, .045);
    color: #f8fafc;
    font-size: 13px;
    letter-spacing: .7px;
    user-select: all;
}

.recovery-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.recovery-confirm {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    margin-top: 18px;
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.45;
}

.recovery-confirm input {
    margin-top: 2px;
    accent-color: var(--accent);
}

.recovery-card .btn-primary:disabled {
    opacity: .5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

@media (max-width: 520px) {
    .recovery-code-grid {
        grid-template-columns: 1fr;
    }
}


/* =========================================
   LOGIN RATE-LIMIT COUNTDOWN
========================================= */
.login-lockout {
    display: grid;
    gap: 5px;
}

.login-lockout strong {
    color: #ffd5da;
    font-size: 13px;
    font-weight: 800;
}

.login-lockout span {
    color: #ffb7c0;
    font-size: 12px;
    line-height: 1.5;
}

.login-retry-time {
    display: inline-block;
    min-width: 44px;
    margin-left: 3px;
    color: #fff;
    font-variant-numeric: tabular-nums;
    font-weight: 900;
    letter-spacing: .03em;
}

.btn-primary[data-rate-limited="true"] {
    cursor: not-allowed;
    opacity: .72;
    transform: none;
    box-shadow: none;
}