:root {
    --bg-1: #161a23;    /* พื้นหลังหลัก */
    --bg-2: #1c2130;    /* กล่อง/ขอบ */
    --txt-1: #e9eef5;   /* ตัวอักษรหลัก */
    --txt-2: #aeb7c6;   /* ตัวอักษรรอง */
    --txt-3: #f04861;   /* ตัวอักษรคำแนะนำ */
    --accent: #0d6efd;  /* ปุ่มหลัก */
}

.totp-modal .modal-dialog {
    max-width: 520px;
}

@media (max-width: 576px) {
    .totp-modal .modal-dialog {
        max-width: calc(100% - 24px);
        margin: 12px auto;
    }
}

.totp-modal .modal-content {
    border: 0;
    border-radius: 16px;
    overflow: hidden;
    background: var(--bg-1);
    color: var(--txt-1);
}

.totp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--bg-2);
    background: linear-gradient(180deg, #1b2030 0%, #171b27 100%);
}

.totp-header h5 {
    margin: 0;
    font-weight: 800;
    color: #fff;
    font-size: 1.05rem;
}

.totp-header .text-sub {
    font-size: .85rem;
    color: var(--txt-2);
    margin-top: 2px;
}

.totp-body {
    padding: 16px;
}

.totp-help {
    font-size: .7rem;
    color: var(--txt-3);
}

.qr-box {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 10px;
    box-shadow: 0 6px 18px rgba(0,0,0,.2);
    display: inline-block;
}

.secret-chip {
    background: #1b2130;
    border: 1px dashed #2b3447;
    padding: 8px 10px;
    border-radius: 10px;
    font-family: monospace;
    color: #d5dbea;
    word-break: break-all;
}

.btn-dark-ghost {
    background: #1a2030;
    border: 1px solid #2b3447;
    color: #e6e6e6;
}

.btn-dark-ghost:hover {
    background: #20273a;
    color: #fff;
}

.totp-fullwidth .form-control {
    background: #1a2030;
    border: 1px solid #2b3447;
    color: #fff;
    text-align: center;
    font-weight: 700;
    letter-spacing: .6em;
    flex: 1;
}

.totp-fullwidth .btn {
    white-space: nowrap;
    min-width: 80px;
}

.store-badges a {
    text-decoration: none;
}

.store-badges .btn {
    height: 40px;
    display: flex;
    align-items: center;
}

.btn-close-white {
    filter: invert(1) grayscale(100%) brightness(200%);
    opacity: .9;
}

.btn-close-white:hover {
    opacity: 1;
}

.qr-secret-section {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 20px;
}

@media (max-width: 576px) {
    .qr-secret-section {
        flex-direction: column;
        align-items: center;
        gap: 15px;
    }
}

.secret-section {
    flex: 1;
    min-width: 0;
}

.download-section {
    margin-top: 15px;
}

/* === OTP 6 ช่อง: ขนาดคงที่, อยู่กึ่งกลาง, ไม่โดน Bootstrap ยืด === */
.otp-grid{
    display:flex;
    justify-content:center;
    gap:10px;
    margin: 8px auto 16px;
    max-width: 380px;             /* กันกว้างเกิน */
    flex-wrap: nowrap;
}
.otp-input{
    width: 48px !important;       /* ขนาดคงที่ */
    height: 56px;
    flex: 0 0 48px !important;    /* ห้ามขยาย/หด */
    display: inline-block !important;
    background: #1a2030;
    border: 1px solid #2b3447;
    border-radius: 12px;
    color: #fff;
    text-align: center;
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: 0;
    outline: none;
    transition: box-shadow .15s ease, border-color .15s ease;
}
.otp-input:focus{
    border-color:#3b82f6;
    box-shadow:0 0 0 4px rgba(59,130,246,.15);
}
.otp-input.is-invalid{
    border-color:#ef4444;
    box-shadow:0 0 0 4px rgba(239,68,68,.15);
}

/* มือถือ: หดให้พอดีจอ */
@media (max-width: 400px){
    .otp-input{
        width: 42px !important;
        height: 50px;
        flex: 0 0 42px !important;
        font-size: 1.1rem;
    }
    .otp-grid{ gap:8px; max-width: 320px; }
}