/* Xem trước / in chứng từ khấu trừ thuế TNCN — mẫu 03/TNCN */
.tx-tncn-preview,
.tx-tncn-preview * {
    box-sizing: border-box;
}

.tx-tncn-preview {
    width: 100%;
    font-size: 13pt;
    font-family: "Times New Roman", Times, serif;
    color: #000;
}

.tx-tncn-preview .print-page {
    width: 210mm;
    min-height: 297mm;
    margin: 0 auto;
    position: relative;
}

.tx-tncn-preview .bg-container {
    position: absolute;
    inset: 0;
    z-index: 0;
    background-image: url('../img/viewinvoice-bg.jpg');
    background-image: var(--tx-tncn-preview-bg, url('../img/viewinvoice-bg.jpg'));
    background-repeat: no-repeat;
    background-position: center;
    background-size: 250%;
    border: 3px double rgba(145, 87, 21, 0.69);
    pointer-events: none;
}

.tx-tncn-preview .main-page {
    min-height: 900px;
    margin-bottom: 5px;
    padding: 20px;
    line-height: 1.5;
    position: relative;
    z-index: 1;
    border: 3px double rgba(145, 87, 21, 0.69);
    background: transparent;
}

.tx-tncn-preview .code-content {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 12pt;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    z-index: 2;
}

.tx-tncn-preview .code-row {
    white-space: nowrap;
}

.tx-tncn-preview .header-nation {
    text-align: center;
    font-weight: bold;
    margin-bottom: 10px;
    font-size: 13pt;
}

.tx-tncn-preview .vn-header p {
    margin: 0;
}

.tx-tncn-preview .vn-header hr {
    width: 35%;
    margin: 4px auto 0;
    border: 0;
    border-top: 1px solid #000;
}

.tx-tncn-preview .heading-content .main-title {
    font-size: 20pt;
    text-align: center;
    display: block;
    font-weight: bold;
    margin: 0 0 13px;
}

.tx-tncn-preview .heading-content .day {
    font-size: 13pt;
    text-align: center;
    margin: 0;
}

.tx-tncn-preview .heading-content .tx-preview-magddt {
    text-align: center;
    margin: 4px 0 10px;
    font-size: 11pt;
    word-break: break-all;
}

.tx-tncn-preview .vip-divide {
    width: 100%;
    height: 0;
    border-bottom: 1px solid rgba(145, 87, 21, 0.69);
    margin: 8px 0;
}

.tx-tncn-preview .content-info {
    padding-top: 5px;
}

.tx-tncn-preview .list-fill-out {
    list-style: none;
    padding: 0;
    margin: 5px 0;
}

.tx-tncn-preview .list-fill-out > h3 {
    font-size: 13pt;
    font-weight: bold;
    margin: 8px 0;
}

.tx-tncn-preview .tx-lq-preview {
    margin: 8px 0 12px;
}

.tx-tncn-preview .tx-lq-preview > h3 {
    font-size: 13pt;
    font-weight: bold;
    margin: 8px 0;
    text-transform: uppercase;
}

.tx-tncn-preview .tx-lq-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11pt;
    margin-bottom: 4px;
}

.tx-tncn-preview .tx-lq-table th,
.tx-tncn-preview .tx-lq-table td {
    border: 1px solid #000;
    padding: 4px 6px;
    text-align: center;
    vertical-align: middle;
}

.tx-tncn-preview .tx-lq-table th {
    font-weight: bold;
    background: rgba(255, 193, 7, 0.25);
}

.tx-tncn-preview .di-gr {
    width: 100%;
    display: flex;
    justify-content: flex-start;
    align-items: baseline;
    font-size: 13pt;
    color: rgba(0, 0, 0, 0.85);
    margin-bottom: 10px;
    gap: 4px;
}

.tx-tncn-preview .di-label {
    min-height: 25px;
    display: flex;
    align-items: flex-start;
    flex-shrink: 0;
}

.tx-tncn-preview .di-value {
    box-sizing: border-box;
    flex: 1;
    min-height: 25px;
    display: flex;
    align-items: flex-start;
    padding-left: 5px;
    border-bottom: 1px dashed #bbb;
    word-break: break-all;
}

.tx-tncn-preview .flex-center {
    display: flex;
    align-items: center;
}

.tx-tncn-preview .flex-center-gap10 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 8px 0 12px;
    font-size: 13pt;
}

.tx-tncn-preview .checkbox-custom {
    appearance: none;
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border: 1px solid rgba(145, 87, 21, 0.69);
    border-radius: 4px;
    background-color: #fff;
    position: relative;
    margin: 0 6px 0 0;
    flex-shrink: 0;
}

.tx-tncn-preview .checkbox-custom:checked {
    background-color: rgba(145, 87, 21, 0.69);
}

.tx-tncn-preview .checkbox-custom:checked::after {
    content: "";
    position: absolute;
    top: 0;
    left: 4px;
    width: 4px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.tx-tncn-preview .ft-sign {
    padding-top: 20px;
}

.tx-tncn-preview .sign-dx-end {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: flex-start;
}

.tx-tncn-preview .sign-dx-end h3 {
    text-align: center;
    font-size: 13pt;
    font-weight: 100;
    margin: 0;
}

.tx-tncn-preview .sign-dx-end h3 p {
    margin: 0 0 4px;
}

.tx-tncn-preview .sign-dx-end h3 p:nth-child(2) {
    font-size: var(--tx-fs-md);
    font-weight: normal;
}

.tx-tncn-preview .sign-box {
    width: 260px;
    padding: 5px;
    border: 2px solid #23b709;
    background-image: var(--tx-tncn-sign-bg, none);
    background-repeat: no-repeat;
    background-position: right 45px bottom 10px;
    background-size: 70px 60px;
    margin-top: 10px;
    font-weight: 500;
    text-align: left;
}

.tx-tncn-preview .sign-box span {
    color: #23b709;
    font-size: 13pt;
    display: block;
}

.tx-tncn-preview .fd-end {
    padding-top: 40px;
    text-align: center;
    font-size: 13pt;
}

.tx-tncn-preview .preview-watermark {
    position: absolute;
    top: 45%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-25deg);
    font-size: 3rem;
    font-weight: bold;
    color: rgba(220, 53, 69, 0.12);
    white-space: nowrap;
    pointer-events: none;
    z-index: 3;
    text-transform: uppercase;
}

#reportModal .modal-body.tx-tncn-preview-body {
    padding: 12px;
    background: #e9ecef;
    max-height: 78vh;
    overflow: auto;
}

/* Scale preview A4 trên mobile / tablet */
@media (max-width: 991.98px) {
    #reportModal .modal-body.tx-tncn-preview-body,
    .tc-tncn-preview-wrap {
        padding: 8px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .tx-tncn-preview {
        font-size: 11pt;
    }

    .tx-tncn-preview .print-page {
        width: 210mm;
        max-width: none;
        transform: scale(min(1, calc((100vw - 48px) / 794)));
        transform-origin: top center;
        margin-left: auto;
        margin-right: auto;
    }

    .tx-tncn-preview .heading-content .main-title {
        font-size: 16pt;
    }

    .tx-tncn-preview .main-page {
        min-height: auto;
        padding: 14px;
    }

    .tx-tncn-preview .code-content {
        font-size: 10pt;
        position: relative;
        top: auto;
        right: auto;
        margin-bottom: 8px;
    }
}

@media (max-width: 575.98px) {
    .tx-tncn-preview {
        font-size: 10pt;
    }

    .tx-tncn-preview .print-page {
        transform: scale(min(1, calc((100vw - 32px) / 794)));
    }
}

@media print {
    html,
    body,
    .tx-tncn-preview,
    .tx-tncn-preview .bg-container,
    .tx-tncn-preview .sign-box {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .tx-tncn-preview .bg-container {
        background-image: var(--tx-tncn-preview-bg, url('../img/viewinvoice-bg.jpg')) !important;
        background-repeat: no-repeat !important;
        background-position: center !important;
        background-size: 250% !important;
    }

    .tx-tncn-preview .main-page {
        margin: 0;
        width: initial;
        min-height: 296mm;
        background: transparent;
        border: none;
    }

    .tx-tncn-preview .preview-watermark {
        display: none;
    }
}
