
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: var(--bdrop);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.modal-backdrop.show {
    display: flex;
    opacity: 1 !important;
}

.modal {
    background: var(--form);
    color: var(--title);
    max-width: 100%;
    width: 450px;
    height: fit-content;
    border-radius: 16px;
    box-shadow: 0 2px 18px rgba(0, 0, 0, .25);
    display: flex;
    flex-direction: column;
    max-height: 80vh;
    border: 2px solid var(--modal-border);

    margin: 0 20px;

    font-size: 14px;
}
@media (min-width: 480px) {
    .modal.wide {
        width: 600px;
    }
}

.modal-header {
    padding: 14px 16px 0 16px;
    /*border-bottom: 1px solid var(--modal-border);*/
    font-weight: 700;

    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-body {
    padding: 16px;
    overflow: auto;
    flex: 1;
}

.modal-body_subtitle {
    font-size: 20px;
    margin: 8px 0;
}

.modal-body img {
    width: 100%;
}

.modal-body_subtitle p {
    margin-bottom: 4px;
}

.modal-body .dts-tools {
    margin-top: 15px;
}
.modal .dts-btn {
    padding: 13px 20px !important;
    font-size: 14px !important;
}

.modal .dts-btn.icon {
    padding: 12px 12px !important;
}

.modal .dts-btn.icon img {
    width: 16px;
    height: 16px;
}



.modal-body .dts-input:not(:last-of-type) {
    margin-bottom: 15px;
}

.modal-footer {
    padding: 14px 16px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.modal-note {
    /*color: var(--muted);*/
    font-size: .92rem;
    margin-top: 6px;
}

@media (min-width: 480px) {
    .modal-header {
        padding: 20px 20px 0px 20px;
    }

    .modal-body {
        padding: 20px;
    }

    .modal-footer {
        padding: 20px;
    }

    .modal {
        font-size: 16px;
    }
    .modal-title {
        font-size: 18px;
    }
}

/* === MODULE (QR CODE) ======================================== */
/* Smaller modal just for QR */
#qr-backdrop .modal {
    width: min(440px, 92vw);
    max-height: 75vh;
}

/* Tight header/footer for compact look */
#qr-backdrop .modal-footer {
    padding: 10px 12px;
}

/* Center body content */
#qr-backdrop .modal-body {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px;
}

/* smaller modal for QR */
#qr-backdrop .modal {
    width: min(440px, 92vw);
    max-width: min(440px, 92vw);
}

/* QR card container (white background, centered) */
.qr-card {
    margin: 0 auto 16px auto;
    padding: 16px;
    max-width: 320px;
    background: #fff;
    color: #000;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .15);
    text-align: center;
}

/* your JS still creates .qr-box — reuse it as the image wrapper */
.qr-card .qr-box {
    background: transparent;
    /* no extra white box inside white card */
    box-shadow: none;
    padding: 0;
    border-radius: 0;
    max-width: 100%;
    margin: 0 auto 10px auto;
    /* some space before captions */
}

.qr-card .qr-box img,
.qr-card .qr-box svg {
    display: block;
    width: 100%;
    height: auto;
}

/* caption + number */
.qr-caption {
    font-size: .9rem;
    color: #444;
    margin-top: 4px;
}

.qr-number {
    font-size: 1.1rem;
    font-weight: 600;
    color: #000;
    margin-top: 2px;
}

/* unlink panel looks like a separate module under the QR */
.qr-unlink {
    margin: 16px auto 0;
    padding: 14px;
    border-radius: 12px;
    background: var(--panel);
    border: 1px solid var(--border);
    max-width: 480px;
}

/* a subtle divider between QR and unlink block */
.qr-divider {
    height: 1px;
    background: var(--border);
    margin: 12px 0 16px 0;
    border: 0;
}

.qr-unlink-title {
    margin: 0 0 8px;
    font-weight: 600;
}

.qr-unlink .row {
    justify-content: center;
    margin-top: 8px;
}

.qr-unlink input {
    max-width: 140px;
    text-align: center;
}

/* === MODULE (LINK CARD PANEL) ======================================== */
.module {
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px;
}

.module-header h3 {
    margin: 0 0 6px;
    font-weight: var(--fw-semibold);
}

.module-sub {
    margin: 0 0 8px;
    color: var(--muted);
}

.module-body .row:first-child {
    margin-top: 6px;
}

.module input {
    background: var(--ghost-bg);
}

/* === MOBILE BREAKPOINTS ========================================= */

/* mobile tweaks */
@media (max-width: 450px) {
    #qr-backdrop .modal {
        width: 92vw;
        max-width: 92vw;
    }

    .qr-card {
        padding: 12px;
        border-radius: 10px;
        max-width: 84vw;
    }

    .qr-caption {
        font-size: .82rem;
    }

    .qr-number {
        font-size: 1rem;
    }

    .qr-unlink {
        padding: 12px;
        border-radius: 10px;
        max-width: 84vw;
    }

    .qr-unlink .row {
        flex-direction: column;
        gap: 10px;
    }

    #qr-unlink-code,
    #btn-qr-send-code,
    #btn-qr-confirm {
        width: 100%;
    }
}

/* pdf modal */

.pdf-modal .modal {
    max-width: 90vw;
    /* use more horizontal space if needed */
    max-height: 90vh;
    /* increase modal height */
}

.pdf-modal .pdf-body {
    flex: 1 1 auto;
    height: 85vh;
    /* was 70vh before, increase to fill more of the viewport */
    display: flex;
    align-items: stretch;
    justify-content: stretch;
}

.pdf-modal .pdf-frame {
    border: none;
    width: 100%;
    height: 100%;
}
