/* ?v=212_a_3: Biometric Ergonomics, Dual Account ID, Google-Style Auto Passport Gate,
   Fullscreen 100dvh Video-KYC Recorder, and Admin KYC Comparison Desk.
   Strict CSS hygiene: 0 duplicates, Dark + Light theme, 360px+ responsive. */

/* Hide floating FAB buttons whenever Video-KYC fullscreen modal or FaceID scanner is open */
body.has-vkyc-modal-open {
    overflow: hidden;
}

body.has-vkyc-modal-open .scroll-top-fab,
body.has-vkyc-modal-open .floating-olezhka-root,
body.has-faceid-scanner-open .scroll-top-fab,
body.has-faceid-scanner-open .floating-olezhka-root {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    display: none;
}

/* 1. Dual Account ID bar in Cabinet hero header (3PAY ID + Member Reg No) */
.bkyc-dual-id-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
}

.bkyc-id-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 11px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 800;
    background: rgba(56, 189, 248, 0.14);
    border: 1px solid rgba(56, 189, 248, 0.42);
    color: #bae6fd;
}

.bkyc-id-chip.is-reg-no {
    background: rgba(16, 185, 129, 0.14);
    border-color: rgba(16, 185, 129, 0.42);
    color: #a7f3d0;
}

html[data-theme="light"] .bkyc-id-chip {
    background: #e0f2fe;
    border-color: #38bdf8;
    color: #0369a1;
}

html[data-theme="light"] .bkyc-id-chip.is-reg-no {
    background: #d1fae5;
    border-color: #10b981;
    color: #065f46;
}

.bkyc-copy-uid-btn {
    border: 1px solid rgba(56, 189, 248, 0.48);
    background: rgba(14, 165, 233, 0.22);
    color: inherit;
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 0.72rem;
    font-weight: 800;
    cursor: pointer;
    transition: filter 0.15s ease, transform 0.15s ease;
}

.bkyc-copy-uid-btn:hover {
    filter: brightness(1.12);
    transform: translateY(-1px);
}

/* 2. Mandatory Pre-Video-KYC Identity Gate Panel */
.bkyc-gate-panel {
    margin: 12px 0 14px;
    padding: 14px;
    border-radius: 16px;
    background: rgba(15, 23, 42, 0.68);
    border: 1px solid rgba(56, 189, 248, 0.34);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

html[data-theme="light"] .bkyc-gate-panel {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.bkyc-gate-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.bkyc-gate-title {
    margin: 0;
    font-size: 0.96rem;
    font-weight: 900;
    color: var(--text-primary);
}

.bkyc-gate-sub {
    margin: 0;
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.45;
}

.bkyc-gate-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.bkyc-gate-tab-btn {
    padding: 10px 10px;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.34);
    background: rgba(15, 23, 42, 0.52);
    color: var(--text-primary);
    font-size: 0.78rem;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-align: center;
    transition: border-color 0.16s ease, background 0.16s ease;
}

.bkyc-gate-tab-btn.is-active {
    border-color: #38bdf8;
    background: rgba(14, 165, 233, 0.22);
    color: #e0f2fe;
}

html[data-theme="light"] .bkyc-gate-tab-btn {
    background: #ffffff;
    border-color: #cbd5e1;
    color: #0f172a;
}

html[data-theme="light"] .bkyc-gate-tab-btn.is-active {
    background: #e0f2fe;
    border-color: #0284c7;
    color: #0369a1;
}

.bkyc-gate-pane {
    display: flex;
    flex-direction: column;
    gap: 11px;
}

/* Loyal Cooldown Notice (NO account ban) */
.bkyc-cooldown-box {
    padding: 12px 14px;
    border-radius: 13px;
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.52);
    color: #fde68a;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.82rem;
    line-height: 1.45;
}

html[data-theme="light"] .bkyc-cooldown-box {
    background: #fffbeb;
    border-color: #f59e0b;
    color: #92400e;
}

.bkyc-cooldown-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

/* Google-style Auto Passport Camera Frame (4 white corner brackets + blue round shutter) */
.bkyc-gcam-shell {
    border-radius: 16px;
    background: #070b14;
    border: 1px solid rgba(148, 163, 184, 0.3);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.bkyc-gcam-side-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.bkyc-side-toggle {
    display: inline-flex;
    gap: 6px;
}

.bkyc-side-btn {
    padding: 6px 11px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.4);
    background: rgba(30, 41, 59, 0.8);
    color: #e2e8f0;
    font-size: 0.74rem;
    font-weight: 800;
    cursor: pointer;
}

.bkyc-side-btn.is-active {
    background: #0284c7;
    border-color: #38bdf8;
    color: #ffffff;
}

.bkyc-gcam-viewport {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 10;
    max-height: 300px;
    border-radius: 13px;
    overflow: hidden;
    background: #02040a;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bkyc-gcam-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.bkyc-gcam-canvas {
    display: none;
}

/* 4 crisp white Google-style corner brackets */
.bkyc-gcam-brackets {
    position: absolute;
    inset: 10% 8%;
    pointer-events: none;
    z-index: 3;
}

.bkyc-bracket {
    position: absolute;
    width: 28px;
    height: 28px;
    border-color: #ffffff;
    border-style: solid;
    border-width: 0;
    filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.8));
}

.bkyc-bracket.is-tl {
    top: 0;
    left: 0;
    border-top-width: 4px;
    border-left-width: 4px;
    border-top-left-radius: 8px;
}

.bkyc-bracket.is-tr {
    top: 0;
    right: 0;
    border-top-width: 4px;
    border-right-width: 4px;
    border-top-right-radius: 8px;
}

.bkyc-bracket.is-bl {
    bottom: 0;
    left: 0;
    border-bottom-width: 4px;
    border-left-width: 4px;
    border-bottom-left-radius: 8px;
}

.bkyc-bracket.is-br {
    bottom: 0;
    right: 0;
    border-bottom-width: 4px;
    border-right-width: 4px;
    border-bottom-right-radius: 8px;
}

.bkyc-gcam-quality-pill {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 4;
    padding: 4px 11px;
    border-radius: 999px;
    background: rgba(2, 6, 23, 0.82);
    border: 1px solid rgba(148, 163, 184, 0.45);
    color: #f8fafc;
    font-size: 0.72rem;
    font-weight: 800;
    white-space: nowrap;
}

.bkyc-gcam-quality-pill.is-good {
    border-color: #10b981;
    color: #6ee7b7;
}

.bkyc-gcam-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.bkyc-shutter-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
}

.bkyc-blue-shutter-btn {
    width: 62px;
    height: 62px;
    border-radius: 50%;
    border: 4px solid #ffffff;
    background: linear-gradient(135deg, #1d4ed8, #2563eb);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.45), 0 8px 20px rgba(37, 99, 235, 0.42);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    transition: transform 0.14s ease, filter 0.14s ease;
}

.bkyc-blue-shutter-btn:hover:not(:disabled) {
    filter: brightness(1.12);
    transform: scale(1.04);
}

.bkyc-blue-shutter-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.bkyc-file-link-lbl {
    font-size: 0.8rem;
    font-weight: 800;
    color: #38bdf8;
    cursor: pointer;
    text-decoration: underline;
}

.bkyc-file-input-hidden {
    display: none;
}

/* Google-style "ID Document Under Review" screen */
.bkyc-review-screen {
    padding: 18px 16px;
    border-radius: 14px;
    background: rgba(14, 165, 233, 0.1);
    border: 1px solid rgba(56, 189, 248, 0.42);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

html[data-theme="light"] .bkyc-review-screen {
    background: #f0f9ff;
    border-color: #7dd3fc;
}

.bkyc-review-icon {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: rgba(14, 165, 233, 0.2);
    border: 2px solid #38bdf8;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #38bdf8;
}

.bkyc-mrz-complete-box {
    padding: 13px;
    border-radius: 13px;
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.48);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

html[data-theme="light"] .bkyc-mrz-complete-box {
    background: #ecfdf5;
    border-color: #10b981;
}

.bkyc-gate-confirmed-bar {
    padding: 11px 14px;
    border-radius: 12px;
    background: rgba(16, 185, 129, 0.14);
    border: 1px solid rgba(16, 185, 129, 0.5);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

html[data-theme="light"] .bkyc-gate-confirmed-bar {
    background: #ecfdf5;
    border-color: #10b981;
}

.bkyc-gate-confirmed-copy {
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-size: 0.83rem;
}

.bkyc-manual-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

/* 3. Fullscreen 100dvh Video-KYC Recorder Modal (Top HD viewfinder 58% + Bottom teleprompter & pinned CTA) */
.bkyc-vrec-modal {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    z-index: 4200;
    background: #030712;
    color: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 0;
    overflow: hidden;
}

html[data-theme="light"] .bkyc-vrec-modal {
    background: #0b1120;
    color: #f8fafc;
}

.bkyc-vrec-topbar {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(15, 23, 42, 0.94);
    border-bottom: 1px solid rgba(148, 163, 184, 0.25);
}

.bkyc-vrec-topbar-pills {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.bkyc-vrec-stage-wrap {
    flex: 1 1 56%;
    min-height: 44%;
    max-height: 60%;
    position: relative;
    background: #000000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.bkyc-vrec-stage-wrap .cab-pvkyc-stage {
    width: 100%;
    height: 100%;
    max-height: none;
    aspect-ratio: auto;
    border-radius: 0;
    border-width: 0;
}

.bkyc-vrec-focus-banner {
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 7;
    max-width: calc(100% - 20px);
    padding: 5px 12px;
    border-radius: 999px;
    background: rgba(2, 6, 23, 0.86);
    border: 1px solid rgba(56, 189, 248, 0.58);
    color: #e0f2fe;
    font-size: 0.74rem;
    font-weight: 800;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bkyc-vrec-focus-banner.is-doc-ok {
    border-color: #10b981;
    color: #6ee7b7;
}

.bkyc-vrec-focus-banner.is-doc-warn {
    border-color: #f59e0b;
    color: #fde68a;
}

.bkyc-vrec-bottom-dock {
    flex: 0 1 42%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
    background: #0f172a;
    border-top: 1px solid rgba(56, 189, 248, 0.35);
}

.bkyc-vrec-script-scroll {
    flex: 1 1 auto;
    min-height: 54px;
    max-height: 130px;
    overflow-y: auto;
    padding: 9px 11px;
    border-radius: 11px;
    background: rgba(2, 6, 23, 0.85);
    border: 1px solid rgba(56, 189, 248, 0.42);
    font-size: 0.84rem;
    font-weight: 700;
    line-height: 1.42;
    color: #ffffff;
}

.bkyc-vrec-mic-line {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.bkyc-vrec-actions-bar {
    flex: 0 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.bkyc-vrec-actions-bar > button,
.bkyc-vrec-actions-bar > a {
    flex: 1 1 140px;
    min-height: 44px;
}

/* Honest 2-phase submit progress bar (no 99% freeze, no label clipping) */
.bkyc-phase-progress-wrap {
    flex: 0 0 auto;
    padding: 9px 11px;
    border-radius: 10px;
    background: rgba(16, 185, 129, 0.14);
    border: 1px solid rgba(52, 211, 153, 0.45);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.bkyc-phase-progress-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    font-size: 0.78rem;
    font-weight: 800;
    color: #ecfdf5;
    line-height: 1.32;
}

.bkyc-phase-progress-lbl {
    flex: 1 1 auto;
    min-width: 0;
    white-space: normal;
    word-break: break-word;
}

.bkyc-phase-progress-bar {
    width: 100%;
    height: 8px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.28);
    overflow: hidden;
    position: relative;
}

.bkyc-phase-progress-wrap.is-phase2 .bkyc-phase-progress-bar::after {
    content: "";
    position: absolute;
    inset: 0;
    width: 45%;
    background: linear-gradient(90deg, transparent, #34d399, #38bdf8, transparent);
    animation: bkycPhasePulse 1.15s ease-in-out infinite;
}

@keyframes bkycPhasePulse {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(260%);
    }
}

/* 4. Admin KYC Comparison Desk: 2x Zoom + Mirror + Focus Origin + Doc Preview Modal */
.bkyc-adm-player-wrap {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    background: #020617;
}

.bkyc-adm-player-wrap .adm-vkyc-player {
    transition: transform 0.2s ease, transform-origin 0.2s ease;
    transform-origin: center center;
}

.bkyc-adm-player-wrap .adm-vkyc-player.is-origin-left {
    transform-origin: 20% 52%;
}

.bkyc-adm-player-wrap .adm-vkyc-player.is-origin-center {
    transform-origin: 50% 50%;
}

.bkyc-adm-player-wrap .adm-vkyc-player.is-origin-right {
    transform-origin: 80% 52%;
}

.bkyc-adm-player-wrap .adm-vkyc-player.is-zoom-2x {
    transform: scale(2);
}

.bkyc-adm-player-wrap .adm-vkyc-player.is-mirrored {
    transform: scaleX(-1);
}

.bkyc-adm-player-wrap .adm-vkyc-player.is-zoom-2x.is-mirrored {
    transform: scale(-2, 2);
}

.bkyc-adm-video-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.bkyc-adm-tool-btn {
    padding: 5px 10px;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.36);
    background: rgba(15, 23, 42, 0.72);
    color: #e2e8f0;
    font-size: 0.74rem;
    font-weight: 800;
    cursor: pointer;
}

.bkyc-adm-tool-btn.is-active {
    background: #0284c7;
    border-color: #38bdf8;
    color: #ffffff;
}

html[data-theme="light"] .bkyc-adm-tool-btn {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #0f172a;
}

html[data-theme="light"] .bkyc-adm-tool-btn.is-active {
    background: #0284c7;
    border-color: #0284c7;
    color: #ffffff;
}

.bkyc-adm-compare-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 8px;
}

.bkyc-adm-meta-cell {
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.56);
    border: 1px solid rgba(148, 163, 184, 0.24);
    font-size: 0.78rem;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

html[data-theme="light"] .bkyc-adm-meta-cell {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.bkyc-adm-attention-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.6);
    color: #fecaca;
    font-size: 0.74rem;
    font-weight: 900;
}

html[data-theme="light"] .bkyc-adm-attention-pill {
    background: #fee2e2;
    color: #991b1b;
}

.bkyc-adm-doc-modal {
    position: fixed;
    inset: 0;
    z-index: 5200;
    background: rgba(2, 6, 23, 0.84);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px;
}

.bkyc-adm-doc-modal-card {
    width: 100%;
    max-width: 760px;
    max-height: 92vh;
    overflow: auto;
    border-radius: 16px;
    background: #0f172a;
    border: 1px solid rgba(56, 189, 248, 0.45);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

html[data-theme="light"] .bkyc-adm-doc-modal-card {
    background: #ffffff;
    border-color: #94a3b8;
}

.bkyc-adm-doc-preview-img {
    width: 100%;
    max-height: 68vh;
    object-fit: contain;
    border-radius: 10px;
    background: #020617;
}

/* Mobile adaptation 360px+ */
@media (max-width: 640px) {
    .bkyc-gate-tabs {
        grid-template-columns: 1fr;
    }
    .bkyc-manual-grid,
    .bkyc-adm-compare-grid {
        grid-template-columns: 1fr;
    }
    .bkyc-vrec-stage-wrap {
        flex: 1 1 50%;
        min-height: 44%;
        max-height: 55%;
    }
    .bkyc-vrec-bottom-dock {
        flex: 0 1 48%;
        padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px));
    }
    .bkyc-vrec-script-scroll {
        font-size: 0.78rem;
        max-height: 108px;
    }
    .bkyc-vrec-topbar {
        padding: 6px 8px;
    }
}
