:root {
    --cm3-auth-navy: #17324d;
    --cm3-auth-navy-dark: #10283d;
    --cm3-auth-teal: #287d79;
    --cm3-auth-teal-dark: #1f6663;
    --cm3-auth-canvas: #f3f6f8;
    --cm3-auth-border: #d8e1e7;
    --cm3-auth-muted: #637788;
    --cm3-auth-text: #183247;
}

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

body.cm3-auth-body {
    min-height: 100vh;
    margin: 0;
    background:
        radial-gradient(circle at 15% 10%, rgba(40, 125, 121, .10), transparent 30rem),
        var(--cm3-auth-canvas);
    color: var(--cm3-auth-text);
}

.cm3-auth-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.cm3-auth-card {
    width: min(100%, 920px);
    overflow: hidden;
    border: 1px solid var(--cm3-auth-border);
    border-radius: 1rem;
    background: #fff;
    box-shadow: 0 1rem 3rem rgba(16, 40, 61, .12);
}

.cm3-auth-card.cm3-auth-card-narrow {
    width: min(100%, 620px);
}

.cm3-auth-brand {
    height: 100%;
    padding: 2.25rem;
    background: linear-gradient(150deg, var(--cm3-auth-navy), var(--cm3-auth-navy-dark));
    color: #fff;
}

.cm3-auth-brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 4rem;
    height: 2.4rem;
    padding: 0 .8rem;
    border-radius: .55rem;
    background: rgba(255,255,255,.12);
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: .02em;
}

.cm3-auth-brand h1 {
    margin: 1.4rem 0 .55rem;
    font-size: clamp(1.75rem, 3vw, 2.3rem);
    font-weight: 700;
}

.cm3-auth-brand p {
    max-width: 28rem;
    margin: 0;
    color: rgba(255,255,255,.78);
    line-height: 1.65;
}

.cm3-auth-brand-kicker {
    margin-top: 2rem;
    color: #b9d9d7;
    font-size: .85rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.cm3-auth-form-pane {
    padding: 2.25rem;
}

.cm3-auth-heading {
    margin-bottom: .45rem;
    color: var(--cm3-auth-navy-dark);
    font-size: 1.7rem;
    font-weight: 700;
}

.cm3-auth-subheading {
    margin-bottom: 1.6rem;
    color: var(--cm3-auth-muted);
    line-height: 1.55;
}

.cm3-auth-form-pane .form-label {
    color: var(--cm3-auth-navy-dark);
    font-weight: 600;
}

.cm3-auth-form-pane .form-control {
    min-height: 3rem;
    border-color: #bccbd5;
    border-radius: .6rem;
}

.cm3-auth-form-pane .form-control:focus {
    border-color: var(--cm3-auth-teal);
    box-shadow: 0 0 0 .2rem rgba(40, 125, 121, .16);
}

.cm3-auth-primary {
    min-height: 3rem;
    border-color: var(--cm3-auth-teal);
    background: var(--cm3-auth-teal);
    font-weight: 700;
}

.cm3-auth-primary:hover,
.cm3-auth-primary:focus {
    border-color: var(--cm3-auth-teal-dark);
    background: var(--cm3-auth-teal-dark);
}

.cm3-auth-help {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid #e5ebef;
    color: var(--cm3-auth-muted);
    font-size: .92rem;
}

.cm3-auth-help a {
    color: var(--cm3-auth-teal-dark);
    font-weight: 600;
}

.cm3-auth-step {
    display: flex;
    gap: .85rem;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.cm3-auth-step-number {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: #e4f1f0;
    color: var(--cm3-auth-teal-dark);
    font-weight: 800;
}

.cm3-auth-step p {
    margin: .2rem 0 0;
    line-height: 1.5;
}

.cm3-auth-qr-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 330px;
    padding: 1.25rem;
    border: 1px solid var(--cm3-auth-border);
    border-radius: .85rem;
    background: #fbfcfd;
}

.cm3-auth-qr {
    width: min(100%, 270px);
    aspect-ratio: 1;
    padding: .5rem;
    border-radius: .7rem;
    background: #fff;
    box-shadow: 0 .35rem 1.4rem rgba(16, 40, 61, .08);
}

.cm3-auth-qr-svg {
    display: block;
    width: 100%;
    height: 100%;
}

.cm3-auth-qr-loading {
    display: grid;
    place-items: center;
    color: var(--cm3-auth-muted);
}

.cm3-auth-code-input {
    max-width: 12rem;
    font-size: 1.45rem;
    font-weight: 700;
    letter-spacing: .24em;
    text-align: center;
}

.cm3-auth-manual {
    margin-top: 1.2rem;
    border: 1px solid var(--cm3-auth-border);
    border-radius: .7rem;
    background: #f8fafb;
}

.cm3-auth-manual summary {
    padding: .9rem 1rem;
    cursor: pointer;
    color: var(--cm3-auth-navy-dark);
    font-weight: 700;
}

.cm3-auth-manual-content {
    padding: 0 1rem 1rem;
}

.cm3-auth-secret {
    display: block;
    padding: .8rem;
    overflow-wrap: anywhere;
    border: 1px dashed #afbec9;
    border-radius: .55rem;
    background: #fff;
    color: var(--cm3-auth-navy-dark);
    font-size: 1rem;
    line-height: 1.55;
    letter-spacing: .05em;
}

.cm3-auth-recovery-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .65rem;
    padding: 0;
    margin: 1.25rem 0;
    list-style: none;
}

.cm3-auth-recovery-code {
    padding: .75rem .9rem;
    border: 1px solid var(--cm3-auth-border);
    border-radius: .55rem;
    background: #f8fafb;
    text-align: center;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-weight: 700;
    letter-spacing: .04em;
}

.cm3-auth-user-chip {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    margin-bottom: 1.3rem;
    padding: .45rem .7rem;
    border-radius: 999px;
    background: #edf4f6;
    color: var(--cm3-auth-navy-dark);
    font-size: .9rem;
    font-weight: 600;
}

@media (max-width: 767.98px) {
    .cm3-auth-shell {
        align-items: flex-start;
        padding: 1rem;
    }

    .cm3-auth-brand,
    .cm3-auth-form-pane {
        padding: 1.5rem;
    }

    .cm3-auth-brand {
        min-height: auto;
    }

    .cm3-auth-brand-kicker {
        margin-top: 1rem;
    }

    .cm3-auth-qr-panel {
        min-height: auto;
    }

    .cm3-auth-recovery-grid {
        grid-template-columns: 1fr;
    }
}

@media print {
    body.cm3-auth-body {
        background: #fff;
    }

    .cm3-auth-no-print,
    .cm3-auth-brand {
        display: none !important;
    }

    .cm3-auth-card {
        width: 100%;
        border: 0;
        box-shadow: none;
    }
}
