/* ============================================================================
   Two-Factor Authentication (self-service page)
   ----------------------------------------------------------------------------
   Written entirely against the global --mrep-* tokens, so the page follows the
   light/dark toggle without a single theme-specific rule of its own.
   ========================================================================== */

.tfa-page {
    display: flex;
    justify-content: center;
    padding: 26px 16px 40px;
}

.tfa-card {
    width: 100%;
    max-width: 560px;
    background: var(--mrep-surface);
    border: 1px solid var(--mrep-line);
    border-radius: 14px;
    box-shadow: var(--mrep-shadow-md);
    padding: 26px 26px 22px;
    color: var(--mrep-ink);
}

.tfa-head {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--mrep-line);
    margin-bottom: 18px;
}

.tfa-icon {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--mrep-brand-050);
    color: var(--mrep-brand);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
}

.tfa-title {
    margin: 0 0 4px;
    font-weight: 600;
    color: var(--mrep-ink);
}

.tfa-lead {
    margin: 0;
    font-size: .85rem;
    line-height: 1.55;
    color: var(--mrep-muted);
}

.tfa-state {
    flex: 0 0 auto;
    align-self: center;
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .4px;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--mrep-canvas-2);
    color: var(--mrep-muted);
    white-space: nowrap;
}

    .tfa-state.is-on {
        background: rgba(42,171,160,.14);
        color: #1D8C82;
    }

html.theme-dark .tfa-state.is-on {
    color: #58D6C9;
}

.tfa-steps {
    margin: 0 0 18px;
    padding-left: 20px;
    font-size: .87rem;
    line-height: 1.9;
    color: var(--mrep-ink-soft);
}

.tfa-qr {
    text-align: center;
    margin-bottom: 12px;
}

    .tfa-qr img {
        width: 200px;
        max-width: 70%;
        /* The QR must stay dark-on-white to remain scannable in dark mode. */
        background: #fff;
        padding: 10px;
        border-radius: 10px;
    }

.tfa-manual {
    text-align: center;
    font-size: .78rem;
    color: var(--mrep-muted);
    margin-bottom: 20px;
}

    .tfa-manual code {
        display: block;
        margin-top: 5px;
        font-size: .82rem;
        letter-spacing: 1.5px;
        color: var(--mrep-brand);
        word-break: break-all;
    }

.tfa-verify {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

#tfa-code {
    flex: 1 1 160px;
    min-width: 0;
    padding: 10px 14px;
    border: 1px solid var(--mrep-line);
    border-radius: 8px;
    background: var(--mrep-canvas);
    color: var(--mrep-ink);
    font-size: 1rem;
    letter-spacing: 5px;
}

    #tfa-code:focus {
        outline: none;
        border-color: var(--mrep-brand);
    }

.tfa-btn {
    flex: 0 0 auto;
    padding: 10px 22px;
    border: none;
    border-radius: 8px;
    background: var(--mrep-brand);
    color: #fff;
    font-size: .88rem;
    cursor: pointer;
}

    .tfa-btn:hover {
        filter: brightness(.94);
    }

.tfa-btn-danger {
    background: #e14b4b;
}

.tfa-note,
.tfa-disabled {
    font-size: .87rem;
    line-height: 1.6;
    color: var(--mrep-ink-soft);
    margin: 0 0 16px;
}

.tfa-disabled {
    background: var(--mrep-canvas-2);
    border-radius: 8px;
    padding: 14px 16px;
    margin-bottom: 0;
}

/* ── Standalone enrolment page (mid-login, no app shell) ──────────────────── */
.tfa-standalone {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    background: var(--bg-plain, #E8F8F7);
}

    .tfa-standalone .tfa-card {
        max-width: 460px;
        text-align: center;
        /* This page loads before the app theme, so pin the surface rather than inherit it. */
        background: #fff;
        border-color: rgba(20,50,60,.08);
        color: #1A2332;
    }

    .tfa-standalone .tfa-steps {
        text-align: left;
        color: #4A5568;
    }

    .tfa-standalone .tfa-title {
        margin-bottom: 14px;
    }

.tfa-logo {
    width: 150px;
    max-width: 55%;
    margin-bottom: 14px;
}

/* Same treatment as the login page's "Back to sign in" so the two steps feel like one flow. */
.tfa-cancel {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    margin-top: 16px;
    padding: 9px 12px;
    border: 1.5px solid rgba(42,171,160,.28);
    border-radius: 12px;
    font-size: .85rem;
    font-weight: 500;
    color: #1D8C82;
    text-decoration: none;
    transition: all .25s ease;
}

    .tfa-cancel::before {
        content: "←";
        font-size: .95rem;
        line-height: 1;
        transition: transform .25s ease;
    }

    .tfa-cancel:hover {
        background: rgba(42,171,160,.10);
        border-color: #2AABA0;
        color: #1D8C82;
    }

        .tfa-cancel:hover::before {
            transform: translateX(-3px);
        }

/* "…required by your organisation" — shown when setting 0132 makes 2FA mandatory. */
.tfa-required {
    font-size: .85rem;
    line-height: 1.6;
    color: var(--mrep-ink-soft);
    background: var(--mrep-brand-050);
    border-left: 3px solid var(--mrep-brand);
    border-radius: 6px;
    padding: 10px 14px;
    margin: 0 0 16px;
}

.tfa-msg {
    margin-top: 16px;
    font-size: .85rem;
    border-radius: 8px;
    padding: 10px 14px;
}

    .tfa-msg.ok {
        background: rgba(42,171,160,.12);
        color: #1D8C82;
    }

    .tfa-msg.err {
        background: rgba(225,75,75,.12);
        color: #e14b4b;
    }

html.theme-dark .tfa-msg.ok {
    color: #58D6C9;
}
