/* CDMS custom styling — layered on top of Bootstrap 5 */

:root {
    --cdms-primary: #0b3d64;
    --cdms-accent: #c8942b;
    --cdms-sidebar-width: 260px;
}

body {
    background-color: #f4f6f9;
    user-select: none; /* deterrent only, not a security control */
}

.card-cdms {
    border: 1px solid #e2e6ea;
    border-radius: 0.65rem;
    box-shadow: 0 4px 14px rgba(11, 61, 100, 0.08);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.card-cdms:hover {
    box-shadow: 0 10px 26px rgba(11, 61, 100, 0.14);
}

/* ===================================================================
   Self-service profile photo (profile.php + sidebar avatar)
   =================================================================== */
.cdms-profile-photo-wrap {
    display: flex;
    justify-content: center;
}
.cdms-profile-photo-wrap {
    perspective: 800px;
}
.cdms-profile-photo {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid #fff;
    box-shadow:
        0 2px 0 rgba(255, 255, 255, 0.6) inset,
        0 10px 22px rgba(11, 61, 100, 0.28),
        0 2px 6px rgba(11, 61, 100, 0.16);
    background: linear-gradient(135deg, var(--cdms-primary), #1a5a8f);
}
img.cdms-profile-photo[role="button"] {
    cursor: pointer;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    transform-style: preserve-3d;
}
img.cdms-profile-photo[role="button"]:hover {
    transform: scale(1.05) rotateY(6deg) rotateX(-3deg);
    box-shadow:
        0 2px 0 rgba(255, 255, 255, 0.6) inset,
        0 16px 30px rgba(11, 61, 100, 0.38),
        0 4px 10px rgba(11, 61, 100, 0.22);
}
.cdms-profile-photo-lg {
    width: 260px;
    height: 260px;
    max-width: 80vw;
    max-height: 80vw;
    border-radius: 50%;
    object-fit: cover;
    border: 5px solid #fff;
    box-shadow:
        0 2px 0 rgba(255, 255, 255, 0.6) inset,
        0 18px 36px rgba(0, 0, 0, 0.35);
}
.cdms-profile-photo-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--cdms-primary), #123a5c);
    color: #fff;
    font-size: 2.5rem;
    font-weight: 700;
}
/* ===================================================================
   App-wide 3D card treatment — add class="cdms-3d-page" to any page's
   outer wrapper (row/container/div right after the header include) to
   get the raised-card, gradient-accent look used across the app:
   Profile, Customer Lookup, Customer Master, approval/download queues,
   reports, Admin Users, etc.
   =================================================================== */
.cdms-3d-page {
    /* No perspective: it creates a containing block/stacking context that
       traps Bootstrap modals under their backdrop (inputs unclickable). */
}
.cdms-3d-page .card-cdms,
.cdms-3d-page .card {
    position: relative;
    border: none;
    border-radius: 14px;
    background: linear-gradient(180deg, #ffffff 0%, #f7f9fb 100%);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.8) inset,
        0 14px 30px rgba(11, 61, 100, 0.10),
        0 3px 8px rgba(11, 61, 100, 0.06);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    /* Deliberately no overflow:hidden here — a wide table (Users, Audit
       Log, Customer Master, etc.) inside a narrower viewport must still
       be able to scroll horizontally via .table-responsive rather than
       having its right-hand columns silently clipped off. */
}
.cdms-3d-page .card-cdms::before,
.cdms-3d-page .card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    border-radius: 14px 14px 0 0;
    background: linear-gradient(90deg, var(--cdms-primary), var(--cdms-accent, #c8961e), var(--cdms-primary));
    background-size: 200% 100%;
    z-index: 1;
}
.cdms-3d-page .card-cdms:hover,
.cdms-3d-page .card:hover {
    transform: none; /* no moving boxes on hover */
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.8) inset,
        0 22px 40px rgba(11, 61, 100, 0.16),
        0 6px 14px rgba(11, 61, 100, 0.10);
}
.cdms-3d-page .card-body h4,
.cdms-3d-page .card-body h5,
.cdms-3d-page .card-body h6,
.cdms-3d-page > h4,
.cdms-3d-page > h5,
.cdms-3d-page > h6 {
    position: relative;
    display: inline-block;
    padding-bottom: 6px;
    font-weight: 700;
    color: var(--cdms-primary);
}
.cdms-3d-page .card-body h4::after,
.cdms-3d-page .card-body h5::after,
.cdms-3d-page .card-body h6::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 34px;
    height: 3px;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--cdms-accent, #c8961e), transparent);
}
.cdms-3d-page .form-control,
.cdms-3d-page .form-select {
    border-radius: 8px;
    border: 1px solid #dbe2e8;
    box-shadow: 0 1px 2px rgba(11, 61, 100, 0.05) inset;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}
.cdms-3d-page .form-control:focus,
.cdms-3d-page .form-select:focus {
    box-shadow: 0 0 0 0.2rem rgba(11, 61, 100, 0.15);
    border-color: var(--cdms-primary);
}
.cdms-3d-page .btn {
    border-radius: 8px;
    box-shadow: 0 3px 8px rgba(11, 61, 100, 0.15);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.cdms-3d-page .btn:hover {
    transform: none;
    box-shadow: 0 6px 14px rgba(11, 61, 100, 0.22);
}
.cdms-3d-page .btn:active {
    transform: translateY(0);
}

/* Tables — raised container, dark gradient header, hover-lift rows.
   Rounding/shadow is applied to the .table-responsive wrapper (which
   keeps overflow-x: auto so wide tables still scroll horizontally on
   narrow screens instead of losing columns) — never to the bare
   <table> itself, which would clip overflowing content outright. */
.cdms-3d-page .table-responsive {
    border-radius: 12px;
    overflow-x: auto;
    overflow-y: hidden;
    box-shadow: 0 10px 24px rgba(11, 61, 100, 0.08);
}
.cdms-3d-page .table {
    margin-bottom: 0;
}
.cdms-3d-page .table thead th {
    background: linear-gradient(135deg, var(--cdms-primary), #123a5c);
    color: #fff;
    border: none;
    font-weight: 600;
    letter-spacing: 0.02em;
    vertical-align: middle;
}
.cdms-3d-page .table tbody tr {
    transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}
.cdms-3d-page .table tbody tr:hover {
    background-color: rgba(11, 61, 100, 0.05);
}
.cdms-3d-page .badge {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}
.cdms-3d-page .nav-tabs .nav-link {
    border: none;
    border-radius: 8px 8px 0 0;
    font-weight: 600;
    color: #5c6b78;
    transition: all 0.15s ease;
}
.cdms-3d-page .nav-tabs .nav-link.active {
    color: var(--cdms-primary);
    background: #fff;
    box-shadow: 0 -4px 12px rgba(11, 61, 100, 0.08);
}
.cdms-3d-page .alert {
    border: none;
    border-radius: 10px;
    box-shadow: 0 6px 16px rgba(11, 61, 100, 0.08);
}

/* Flat, static layout for data-entry screens (e.g. Master Data tabs):
   no shadow lift, no hover motion, no accent bar. */
.cdms-flat-page .card-cdms,
.cdms-flat-page .card-cdms:hover,
.cdms-flat-page .btn,
.cdms-flat-page .btn:hover,
.cdms-flat-page .table tbody tr,
.cdms-flat-page .table tbody tr:hover,
.cdms-flat-page .nav-tabs .nav-link {
    transform: none !important;
    transition: none !important;
}
.cdms-flat-page .card-cdms,
.cdms-flat-page .card-cdms:hover {
    box-shadow: none;
    border: 1px solid #dee2e6;
    border-radius: 0 0 0.5rem 0.5rem;
    background: #fff;
}
.cdms-flat-page .table thead th {
    background: #0b3d64;
    color: #fff;
    border: none;
}

@media (prefers-reduced-motion: reduce) {
    .cdms-3d-page .card-cdms,
    .cdms-3d-page .card,
    .cdms-3d-page .table tbody tr,
    .cdms-3d-page .btn {
        transition: none !important;
        transform: none !important;
    }
}

.sidebar-user-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

/* ===================================================================
   Live in-page camera capture (getUserMedia)
   =================================================================== */
.cdms-camera-video {
    width: 100%;
    max-height: 65vh;
    border-radius: 0.4rem;
    background: #000;
}

/* ===================================================================
   Document image editor (Cropper.js) — big, responsive 16:9 preview
   on desktop; near-fullscreen on mobile so the crop/zoom controls are
   actually usable with a thumb instead of a tiny letterboxed strip.
   =================================================================== */
.cdms-editor-canvas-wrap {
    width: 100%;
    aspect-ratio: 16 / 9;
    max-height: 65vh;
    background: #222;
    overflow: hidden;
    border-radius: 0.4rem;
}
.cdms-editor-canvas-wrap img {
    display: block;
    max-width: 100%;
}
/* Cropper replaces the <img> with its own container/canvas — force it
   to fully occupy the 16:9 box instead of sizing off a stale/partial
   layout measurement. */
.cdms-editor-canvas-wrap .cropper-container {
    width: 100% !important;
    height: 100% !important;
}

@media (max-width: 767.98px) {
    .cdms-editor-canvas-wrap {
        aspect-ratio: 4 / 3;
        max-height: 45vh;
    }
    #cdmsImageEditorModal .modal-body {
        padding: 0.75rem;
    }
    #cdmsImageEditorModal .form-range {
        height: 1.75rem; /* bigger touch target on mobile */
    }
}

/* ===================================================================
   Left sidebar shell (authenticated pages)
   =================================================================== */
.app-shell {
    min-height: 100vh;
}

.sidebar-cdms {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--cdms-sidebar-width);
    background: linear-gradient(180deg, var(--cdms-primary) 0%, #0a3252 55%, #071f36 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    box-shadow: 6px 0 28px rgba(0, 0, 0, 0.28), 1px 0 0 rgba(255, 255, 255, 0.05) inset;
    z-index: 1030;
    transition: transform 0.25s ease;
    overflow-y: auto;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 18px;
    text-decoration: none;
    color: #fff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}
.sidebar-brand:hover {
    color: #fff;
}
.sidebar-brand-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--cdms-accent), #a97a1f);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.3);
    flex: 0 0 auto;
}
.sidebar-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}
.sidebar-brand-text strong {
    font-size: 1.05rem;
    letter-spacing: 0.04em;
}
.sidebar-brand-text small {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.6);
    letter-spacing: 0.1em;
}

.sidebar-nav {
    flex: 1 1 auto;
    padding: 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.78);
    text-decoration: none;
    font-size: 0.92rem;
    position: relative;
    transition: background 0.2s ease, transform 0.2s ease, color 0.2s ease;
}
.sidebar-link i {
    width: 18px;
    text-align: center;
    opacity: 0.9;
}
.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    transform: translateX(3px);
}
.sidebar-link.active {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2) inset;
}
.sidebar-link.active::before {
    content: '';
    position: absolute;
    left: -12px;
    top: 8px;
    bottom: 8px;
    width: 4px;
    border-radius: 0 4px 4px 0;
    background: var(--cdms-accent);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(0, 0, 0, 0.15);
}
.sidebar-user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--cdms-accent), #8a611a);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex: 0 0 auto;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}
.sidebar-user-info {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}
.sidebar-user a.d-flex,
.sidebar-user a.d-flex:hover {
    color: #fff;
}
.sidebar-user-info strong {
    font-size: 0.86rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-user-info small {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.6);
}
.sidebar-logout {
    color: rgba(255, 255, 255, 0.75);
    flex: 0 0 auto;
    font-size: 1.05rem;
    padding: 6px;
}
.sidebar-logout:hover {
    color: #fff;
}

.sidebar-toggle-btn {
    position: fixed;
    top: 18px;
    left: calc(var(--cdms-sidebar-width) + 16px);
    z-index: 1040;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: #fff;
    color: var(--cdms-primary);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: left 0.25s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.sidebar-toggle-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.22);
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(4, 16, 27, 0.55);
    z-index: 1020;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.main-content {
    margin-left: var(--cdms-sidebar-width);
    min-height: 100vh;
    transition: margin-left 0.25s ease;
}

/* Extra top clearance so page content (including per-page sub-nav tabs,
   e.g. admin_nav.php) never renders underneath the floating, fixed-position
   sidebar-toggle button. */
.cdms-main-pad {
    padding-top: 76px;
    padding-bottom: 1.5rem;
}

/* ---- Desktop: collapse slides the sidebar fully off-screen ---- */
@media (min-width: 992px) {
    html.sidebar-collapsed-pre .sidebar-cdms,
    body.sidebar-collapsed .sidebar-cdms {
        transform: translateX(-100%);
    }
    html.sidebar-collapsed-pre .main-content,
    body.sidebar-collapsed .main-content {
        margin-left: 0;
    }
    html.sidebar-collapsed-pre .sidebar-toggle-btn,
    body.sidebar-collapsed .sidebar-toggle-btn {
        left: 16px;
    }
}

/* ---- Mobile/tablet: sidebar starts off-canvas, opens as an overlay ---- */
@media (max-width: 991.98px) {
    .sidebar-cdms {
        transform: translateX(-100%);
    }
    .main-content {
        margin-left: 0;
    }
    .sidebar-toggle-btn {
        left: 16px;
    }
    body.sidebar-open .sidebar-cdms {
        transform: translateX(0);
    }
    body.sidebar-open .sidebar-backdrop {
        display: block;
        opacity: 1;
    }
}

.doc-tab-pane {
    min-height: 320px;
}

.watermark-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    display: flex;
    flex-wrap: wrap;
    align-content: space-around;
    justify-content: space-around;
    opacity: 0.25;
    transform: rotate(-30deg);
    font-size: 0.75rem;
    color: #ff0000;
    text-align: center;
}

.status-badge-PENDING  { background-color: #f0ad4e; }
.status-badge-APPROVED { background-color: #28a745; }
.status-badge-REJECTED { background-color: #dc3545; }

.login-card {
    max-width: 420px;
    margin: 8vh auto;
}

/* ===================================================================
   Shared footer — appears on every page (login, TOTP, and inside-app)
   =================================================================== */
.footer-cdms {
    color: #6c757d;
}
.footer-cdms .footer-credit {
    font-size: 0.78rem;
    opacity: 0.85;
    margin-top: 2px;
}
.footer-cdms .footer-tagline {
    font-size: 0.78rem;
    font-style: italic;
    margin-top: 2px;
    color: var(--cdms-primary);
}
body.page-auth3d .footer-cdms .footer-tagline {
    color: rgba(255, 255, 255, 0.8);
}
body.page-auth3d .footer-cdms {
    color: rgba(255, 255, 255, 0.85);
    position: relative;
    z-index: 2;
}
body.page-auth3d .footer-cdms .footer-credit {
    color: rgba(255, 255, 255, 0.65);
}

/* ===================================================================
   3D login / auth page
   =================================================================== */
body.page-auth3d {
    min-height: 100vh;
    margin: 0;
    background: linear-gradient(135deg, var(--cdms-primary) 0%, #14243a 45%, #071b2e 100%);
    background-size: 200% 200%;
    animation: authGradientShift 14s ease infinite;
    display: flex;
    flex-direction: column;
}
body.page-auth3d .container-fluid {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px !important;
}

@keyframes authGradientShift {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.auth3d-wrap {
    width: 100%;
    display: flex;
    justify-content: center;
    perspective: 1400px;
}

.auth3d-card {
    width: 100%;
    max-width: 420px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.97);
    box-shadow:
        0 25px 50px -12px rgba(0, 0, 0, 0.55),
        0 8px 20px rgba(0, 0, 0, 0.25),
        0 0 0 1px rgba(255, 255, 255, 0.08) inset;
    transform-style: preserve-3d;
    transition: transform 0.15s ease-out, box-shadow 0.3s ease;
    will-change: transform;
    position: relative;
    overflow: hidden;
}

.auth3d-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, transparent 30%, rgba(200, 148, 43, 0.18) 48%, transparent 66%);
    background-size: 250% 250%;
    animation: authCardShine 5s ease-in-out infinite;
    pointer-events: none;
}

@keyframes authCardShine {
    0%   { background-position: 200% 0%; }
    100% { background-position: -50% 0%; }
}

.auth3d-card-inner {
    position: relative;
    z-index: 1;
    padding: 36px 34px 28px;
    transform: translateZ(40px);
}

.auth3d-header {
    text-align: center;
    margin-bottom: 22px;
}

.auth3d-logo {
    width: 64px;
    height: 64px;
    margin: 0 auto 14px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.7rem;
    color: #fff;
    background: linear-gradient(135deg, var(--cdms-primary), #1a5a8f);
    box-shadow: 0 10px 22px rgba(11, 61, 100, 0.45);
}

.auth3d-bank {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--cdms-primary);
    margin: 0 0 4px;
}

.auth3d-tagline {
    font-size: 0.88rem;
    color: #6c757d;
    margin: 0;
}

.auth3d-alert {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 0.88rem;
    margin-bottom: 16px;
}
.auth3d-alert-error {
    background: rgba(220, 53, 69, 0.1);
    color: #b02a37;
    border: 1px solid rgba(220, 53, 69, 0.2);
}
.auth3d-alert-warning {
    background: rgba(240, 173, 78, 0.15);
    color: #8a5a00;
    border: 1px solid rgba(240, 173, 78, 0.3);
}

.auth3d-field {
    margin-bottom: 18px;
}

.auth3d-label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #33404d;
}

.auth3d-input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.auth3d-input-icon {
    position: absolute;
    left: 15px;
    color: #93a1ae;
    font-size: 0.9rem;
    pointer-events: none;
}

.auth3d-input {
    width: 100%;
    padding: 12px 44px 12px 42px;
    border: 2px solid #e6eaee;
    border-radius: 10px;
    font-size: 0.98rem;
    background-color: #f7f9fb;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.auth3d-input:focus {
    outline: none;
    border-color: var(--cdms-primary);
    background-color: #fff;
    box-shadow: 0 0 0 3px rgba(11, 61, 100, 0.15);
}

.auth3d-toggle-pass {
    position: absolute;
    right: 12px;
    border: none;
    background: none;
    color: #93a1ae;
    cursor: pointer;
    padding: 4px 6px;
}
.auth3d-toggle-pass:hover {
    color: var(--cdms-primary);
}

.auth3d-submit {
    width: 100%;
    padding: 13px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(135deg, var(--cdms-primary), #175b8f);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
    margin-top: 4px;
}
.auth3d-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 22px rgba(11, 61, 100, 0.4);
}
.auth3d-submit:active {
    transform: translateY(0);
}
.auth3d-submit.is-loading {
    pointer-events: none;
    opacity: 0.85;
}
.auth3d-submit .fa-spinner {
    animation: authSpin 0.8s linear infinite;
}
@keyframes authSpin {
    to { transform: rotate(360deg); }
}

.auth3d-footnote {
    text-align: center;
    font-size: 0.78rem;
    color: #93a1ae;
    margin: 18px 0 0;
}

@media (max-width: 480px) {
    .auth3d-card-inner {
        padding: 28px 22px 22px;
    }
}

@media (prefers-reduced-motion: reduce) {
    body.page-auth3d,
    .auth3d-card::before {
        animation: none;
    }
    .auth3d-card {
        transition: none;
    }
}

/* ===================================================================
   TOTP enroll / verify — wider variant of the auth3d card, QR frame,
   manual-key chip, generic spinner util
   =================================================================== */
.auth3d-card-wide {
    max-width: 480px;
}

.fa-spin-custom {
    animation: authSpin 0.9s linear infinite;
}

.auth3d-qr-frame {
    background: #fff;
    border: 1px solid #e6eaee;
    border-radius: 14px;
    padding: 16px;
    display: flex;
    justify-content: center;
    box-shadow:
        0 12px 24px rgba(11, 61, 100, 0.12),
        0 0 0 1px rgba(11, 61, 100, 0.03) inset;
    margin-bottom: 14px;
}

.auth3d-qr-box {
    width: 220px;
    height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth3d-qr-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: #93a1ae;
    font-size: 0.85rem;
}
.auth3d-qr-loading i {
    font-size: 1.4rem;
    color: var(--cdms-primary);
}

.auth3d-qr-fallback {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
    color: #8a5a00;
    font-size: 0.85rem;
    padding: 0 10px;
}
.auth3d-qr-fallback i {
    font-size: 1.3rem;
}

.auth3d-key-label {
    text-align: center;
    font-size: 0.82rem;
    color: #6c757d;
    margin: 0 0 6px;
}

.auth3d-key-chip {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: #f7f9fb;
    border: 1px solid #e6eaee;
    border-radius: 10px;
    padding: 10px 14px;
    margin-bottom: 8px;
}
.auth3d-key-chip code {
    font-size: 0.95rem;
    letter-spacing: 0.06em;
    color: var(--cdms-primary);
}
.auth3d-copy-btn {
    border: none;
    background: none;
    color: #93a1ae;
    cursor: pointer;
    padding: 2px 6px;
}
.auth3d-copy-btn:hover {
    color: var(--cdms-primary);
}

.auth3d-input-code {
    text-align: center;
    letter-spacing: 0.4em;
    font-size: 1.3rem;
    font-weight: 600;
    padding-left: 12px;
    padding-right: 12px;
}

/* ===================================================================
   2FA method choice cards (choose_2fa_setup.php / choose_2fa_login.php)
   =================================================================== */
.auth3d-choice-btn {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    text-align: left;
    background: #f7f9fb;
    border: 2px solid #e6eaee;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 14px;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    font: inherit;
    transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.auth3d-choice-btn:hover {
    border-color: var(--cdms-primary);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(11, 61, 100, 0.12);
    color: inherit;
}
.auth3d-choice-btn-submit {
    display: flex;
}

.auth3d-choice-icon {
    flex: 0 0 auto;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--cdms-primary), #1a5a8f);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
}

.auth3d-choice-text {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.auth3d-choice-text strong {
    font-size: 0.98rem;
    color: #1e293b;
}
.auth3d-choice-text small {
    font-size: 0.8rem;
    color: #6c757d;
    line-height: 1.35;
}

.auth3d-choice-arrow {
    flex: 0 0 auto;
    color: #93a1ae;
}

.auth3d-resend-link {
    background: none;
    border: none;
    color: var(--cdms-primary);
    font-size: 0.85rem;
    text-decoration: underline;
    cursor: pointer;
    padding: 4px 8px;
}
.auth3d-resend-link:hover {
    color: #175b8f;
}

/* ---- User + Logout: fixed at the top-right of every authenticated page ---- */
.topbar-user {
    position: fixed;
    top: 14px;
    right: 20px;
    z-index: 1040;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px 5px 6px;
    background: #fff;
    border-radius: 999px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
}
.topbar-user-link {
    display: flex;
    align-items: center;
    gap: 9px;
    text-decoration: none;
    color: var(--cdms-primary);
    min-width: 0;
}
.topbar-user-info {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    max-width: 180px;
}
.topbar-user-info strong {
    font-size: 0.84rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.topbar-user-info small {
    font-size: 0.7rem;
    color: #6c757d;
}
.topbar-logout {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    background: #f1f3f5;
    color: #b02a37;
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
}
.topbar-logout:hover {
    background: #b02a37;
    color: #fff;
}
@media (max-width: 575.98px) {
    .topbar-user-info, .topbar-logout span { display: none; }
    .topbar-user { right: 10px; }
}
