:root {
    --auth-primary: #007bff;
    --auth-primary-soft: rgba(0, 123, 255, .1);
    --auth-ink: #1f2d3d;
    --auth-muted: #6c757d;
    --auth-surface: #f4f6f9;
    --auth-border: #e3e6ea;
    --auth-success: #28a745;
    --auth-warning-soft: #fff8e1;
}

body.auth-page {
    min-height: 100vh;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
    font-family: "Source Sans Pro", -apple-system, "Segoe UI", Roboto, sans-serif;
    background:
        radial-gradient(circle at 15% 20%, rgba(0, 123, 255, .35) 0, transparent 45%),
        radial-gradient(circle at 85% 85%, rgba(23, 162, 184, .25) 0, transparent 40%),
        linear-gradient(160deg, #1f2d3d 0%, #111827 100%);
}

.auth-shell {
    width: 100%;
    max-width: 440px;
}

.auth-shell--wide {
    max-width: 820px;
}

.auth-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 22px;
    color: #fff;
    font-size: 1.7rem;
    font-weight: 300;
    text-decoration: none;
}

.auth-brand:hover {
    color: #fff;
    text-decoration: none;
}

.auth-brand img {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .35);
}

.auth-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
    overflow: hidden;
}

.auth-card__header {
    padding: 30px 32px 6px;
    text-align: center;
}

.auth-card__body {
    padding: 20px 32px 30px;
}

.auth-card__footer {
    padding: 14px 32px;
    background: var(--auth-surface);
    border-top: 1px solid var(--auth-border);
    text-align: center;
    font-size: .92rem;
}

.auth-icon {
    width: 64px;
    height: 64px;
    margin-bottom: 14px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: var(--auth-primary);
    background: var(--auth-primary-soft);
}

.auth-icon--success {
    color: var(--auth-success);
    background: rgba(40, 167, 69, .12);
}

.auth-title {
    margin: 0 0 6px;
    font-size: 1.45rem;
    font-weight: 700;
    color: var(--auth-ink);
}

.auth-subtitle {
    margin: 0;
    color: var(--auth-muted);
}

.auth-footer {
    margin: 18px 0 0;
    text-align: center;
    font-size: .85rem;
    color: rgba(255, 255, 255, .55);
}

.auth-card .form-group label {
    font-weight: 600;
    color: var(--auth-ink);
}

.auth-card .input-group-text {
    min-width: 44px;
    justify-content: center;
    color: var(--auth-muted);
    background: var(--auth-surface);
}

.auth-card .form-control {
    height: calc(2.5rem + 2px);
}

.btn-auth {
    padding: .6rem 1rem;
    font-weight: 600;
    border-radius: 8px;
}

.password-toggle {
    cursor: pointer;
}

.auth-alert {
    border-radius: 10px;
    font-size: .95rem;
}

.auth-alert.alert-danger {
    color: #9b1c1c;
    background: #fdecec;
    border: 1px solid #f6c6c6;
}

.auth-alert ul {
    margin: 0;
    padding-left: 0;
    list-style: none;
}

.auth-alert li + li {
    margin-top: 4px;
}

.code-input {
    height: auto !important;
    padding: .55rem .75rem;
    font-family: SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    font-size: 1.9rem;
    letter-spacing: .45em;
    text-align: center;
    border-radius: 10px;
}

.code-input::placeholder {
    color: #ced4da;
}

.setup-grid {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 28px;
    align-items: start;
}

.setup-steps {
    list-style: none;
    margin: 0;
    padding: 0;
    counter-reset: step;
}

.setup-steps > li {
    position: relative;
    counter-increment: step;
    padding-left: 46px;
    margin-bottom: 20px;
    color: var(--auth-ink);
}

.setup-steps > li::before {
    content: counter(step);
    position: absolute;
    left: 0;
    top: -2px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #fff;
    background: var(--auth-primary);
}

.setup-steps .step-title {
    display: block;
    margin-bottom: 2px;
    font-weight: 700;
}

.setup-steps .step-text {
    color: var(--auth-muted);
    font-size: .95rem;
}

.app-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.app-list span {
    padding: 3px 10px;
    border-radius: 999px;
    font-size: .82rem;
    color: var(--auth-ink);
    background: var(--auth-surface);
    border: 1px solid var(--auth-border);
}

.qr-panel {
    padding: 18px;
    border: 1px solid var(--auth-border);
    border-radius: 14px;
    background: var(--auth-surface);
    text-align: center;
}

.qr-frame {
    display: inline-block;
    padding: 10px;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .08);
}

.qr-frame img {
    display: block;
    width: 200px;
    height: 200px;
    image-rendering: pixelated;
}

.qr-account {
    margin-top: 10px;
    font-size: .85rem;
    line-height: 1.35;
    color: var(--auth-muted);
}

.qr-account span {
    display: block;
}

.qr-account__issuer {
    font-weight: 600;
    color: var(--auth-ink);
}

.qr-account__name {
    overflow-wrap: anywhere;
}

.secret-key {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 12px;
    padding: 8px 8px 8px 12px;
    border: 1px dashed #ced4da;
    border-radius: 8px;
    background: #fff;
}

.secret-key code {
    font-size: .95rem;
    color: var(--auth-ink);
    letter-spacing: .06em;
    word-break: break-all;
    text-align: left;
}

.recovery-warning {
    display: flex;
    gap: 12px;
    padding: 12px 14px;
    margin-bottom: 18px;
    border-radius: 10px;
    background: var(--auth-warning-soft);
    border: 1px solid #ffe08a;
    color: #7a5d00;
    font-size: .95rem;
}

.recovery-warning i {
    margin-top: 3px;
}

.recovery-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 18px;
}

.recovery-grid code {
    display: block;
    padding: 9px 8px;
    border-radius: 8px;
    text-align: center;
    font-size: 1.02rem;
    letter-spacing: .08em;
    color: var(--auth-ink);
    background: var(--auth-surface);
    border: 1px solid var(--auth-border);
}

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

.recovery-actions .btn {
    flex: 1 1 auto;
}

.copy-feedback {
    min-height: 1.2em;
    margin-top: 8px;
    font-size: .85rem;
    color: var(--auth-success);
    text-align: center;
}

@media (max-width: 767.98px) {
    .setup-grid {
        grid-template-columns: 1fr;
    }

    .qr-panel {
        order: -1;
    }
}

@media (max-width: 575.98px) {
    .auth-card__header,
    .auth-card__body,
    .auth-card__footer {
        padding-left: 20px;
        padding-right: 20px;
    }

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

    .code-input {
        font-size: 1.5rem;
        letter-spacing: .3em;
    }
}

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

    .auth-brand,
    .auth-footer,
    .recovery-actions,
    .auth-card__footer {
        display: none !important;
    }

    .auth-card {
        box-shadow: none;
    }
}
