/* ==========================================================
   建设银行网上银行电子回执 —— 1:1 真实样式
   参考图：浅蓝色标题边框 + 付款人/收款人左右分栏 + 圆形红章
   ========================================================== */

/* ========== 弹窗蒙层 ========== */
.voucher-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.voucher-modal-overlay.active {
    display: flex;
}

.voucher-modal {
    background: #fff;
    border-radius: 4px;
    width: 100%;
    max-width: 1080px;
    max-height: 94vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    font-family: "Microsoft YaHei", "PingFang SC", -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ========== 弹窗标题栏 ========== */
.voucher-modal-header {
    position: relative;
    padding: 14px 20px;
    background: #f2f5f9;
    border-bottom: 1px solid #e2e8f0;
    text-align: center;
}

.voucher-modal-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin: 0;
    letter-spacing: 1px;
}

.voucher-modal-header .close-btn {
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 22px;
    color: #94a3b8;
    cursor: pointer;
    width: 32px;
    height: 32px;
    line-height: 1;
    border-radius: 4px;
    font-weight: 300;
    padding: 0;
}

.voucher-modal-header .close-btn:hover {
    background: #e2e8f0;
    color: #475569;
}

/* ========== 凭证主体 ========== */
.voucher-modal-body {
    background: #fff;
    padding: 36px 56px 30px;
    overflow-y: auto;
    flex: 1;
}

/* ========== 凭证外框 ========== */
.voucher-paper {
    width: 100%;
    background: #fff;
    position: relative;
}

/* ========== 标题（浅蓝色边框的深色标题） ========== */
.voucher-ccb-title {
    border: 1px solid #a3c8e8;
    padding: 14px 0;
    text-align: center;
    font-size: 22px;
    font-weight: 700;
    color: #000;
    letter-spacing: 3px;
    margin-bottom: 0;
    font-family: "SimSun", "宋体", serif;
    background: #fff;
}

/* ========== 表头行（币别/日期/凭证号/账户明细编号） ========== */
.voucher-header-row {
    display: grid;
    grid-template-columns: 1fr 1.3fr 1.3fr 1.6fr;
    border: 1px solid #a3c8e8;
    border-top: none;
    font-size: 13px;
}

.voucher-header-row .hcol {
    display: flex;
    align-items: stretch;
    border-right: 1px solid #a3c8e8;
    min-height: 38px;
}

.voucher-header-row .hcol:last-child {
    border-right: none;
}

.voucher-header-row .hcol .hk {
    background: #f0f6fb;
    padding: 10px 12px;
    color: #333;
    font-weight: 400;
    border-right: 1px solid #a3c8e8;
    white-space: nowrap;
    display: flex;
    align-items: center;
}

.voucher-header-row .hcol .hv {
    padding: 10px 14px;
    color: #222;
    flex: 1;
    display: flex;
    align-items: center;
    word-break: break-all;
    font-size: 13px;
}

/* ========== 付款人 / 收款人 左右分栏 ========== */
.voucher-party-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border: 1px solid #a3c8e8;
    border-top: none;
}

.voucher-party {
    display: grid;
    grid-template-columns: 36px 72px 1fr;
    border-right: 1px solid #a3c8e8;
    min-height: 130px;
}

.voucher-party:last-child {
    border-right: none;
}

/* 竖排"付款人"/"收款人"标签 */
.voucher-party-label {
    background: #f0f6fb;
    border-right: 1px solid #a3c8e8;
    display: flex;
    align-items: center;
    justify-content: center;
    writing-mode: vertical-rl;
    text-orientation: upright;
    letter-spacing: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    padding: 6px 0;
}

/* 字段名列 */
.voucher-party-keys {
    display: flex;
    flex-direction: column;
    background: #fafcfe;
    border-right: 1px solid #a3c8e8;
}

.voucher-party-keys div {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 6px 10px;
    color: #333;
    font-size: 13px;
    border-bottom: 1px solid #a3c8e8;
}

.voucher-party-keys div:last-child {
    border-bottom: none;
}

/* 字段值列 */
.voucher-party-vals {
    display: flex;
    flex-direction: column;
}

.voucher-party-vals div {
    flex: 1;
    display: flex;
    align-items: center;
    padding: 6px 14px;
    color: #222;
    font-size: 13px;
    border-bottom: 1px solid #a3c8e8;
    word-break: break-all;
    min-height: 40px;
}

.voucher-party-vals div:last-child {
    border-bottom: none;
}

/* ========== 金额行 ========== */
.voucher-amount-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border: 1px solid #a3c8e8;
    border-top: none;
}

.voucher-amount-cell {
    display: grid;
    grid-template-columns: 108px 1fr;
    border-right: 1px solid #a3c8e8;
    min-height: 42px;
}

.voucher-amount-cell:last-child {
    border-right: none;
}

.voucher-amount-cell .ak {
    background: #f0f6fb;
    border-right: 1px solid #a3c8e8;
    padding: 10px 14px;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    white-space: nowrap;
}

.voucher-amount-cell .av {
    padding: 10px 16px;
    display: flex;
    align-items: center;
    font-weight: 600;
    color: #111;
    font-size: 14px;
    word-break: break-all;
}

.voucher-amount-cell .av.num {
    font-family: "Consolas", "Microsoft YaHei", monospace;
    letter-spacing: 0.5px;
}

/* ========== 用途 / 汇兑标志行 ========== */
.voucher-purpose-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border: 1px solid #a3c8e8;
    border-top: none;
}

.voucher-purpose-cell {
    display: grid;
    grid-template-columns: 108px 1fr;
    border-right: 1px solid #a3c8e8;
    min-height: 40px;
}

.voucher-purpose-cell:last-child {
    border-right: none;
}

.voucher-purpose-cell .pk {
    background: #f0f6fb;
    border-right: 1px solid #a3c8e8;
    padding: 9px 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: #333;
}

.voucher-purpose-cell .pv {
    padding: 9px 16px;
    display: flex;
    align-items: center;
    font-size: 13px;
    color: #222;
}

/* ========== 摘要 整行 ========== */
.voucher-summary-row {
    display: grid;
    grid-template-columns: 108px 1fr;
    border: 1px solid #a3c8e8;
    border-top: none;
    min-height: 48px;
}

.voucher-summary-row .sk {
    background: #f0f6fb;
    border-right: 1px solid #a3c8e8;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: #333;
}

.voucher-summary-row .sv {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    font-size: 13px;
    color: #222;
    word-break: break-all;
}

/* ========== 底部红色提示 ========== */
.voucher-bottom-tip {
    margin-top: 14px;
    font-size: 12px;
    color: #c8102e;
    line-height: 1.8;
    letter-spacing: 0.3px;
}

/* ========== 红色电子印章 —— 用户提供原图 + 实时像素抠图 ========== */
/* 原图：images/stamps/ccb-stamp-original.png（用户上传的真实建行印章）
   运行时由 js/stamp-processor.js 实时抠图：
   - 像素级去除所有灰色棋盘格/白色背景（alpha=0）
   - 只保留红色印章像素
   - 输出透明 data URL 供 <img> 使用
   优势：严格使用用户提供的原图，不使用 AI 生成、不使用 SVG，
         每次页面加载都会重新抠图，永远干净透明 */
.voucher-stamp-wrap {
    position: absolute;
    right: 40px;
    bottom: 20px;
    width: 160px;
    height: 160px;
    pointer-events: none;
    z-index: 10;
    transform: rotate(-8deg);
    transform-origin: center;
}

.voucher-stamp-wrap img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    /* 不使用 mix-blend-mode —— 抠图后的印章本身就是纯红+完全透明，直接盖即可 */
    opacity: 0.92;
    /* 轻微红色投影，增强墨迹真实感 */
    filter: drop-shadow(0 1px 1px rgba(180, 10, 30, 0.2));
    background: transparent;
}

/* ========== 底部按钮 ========== */
.voucher-modal-footer {
    padding: 22px 20px 28px;
    background: #fff;
    display: flex;
    justify-content: center;
    gap: 20px;
    border-top: 1px solid #e5e7eb;
}

.voucher-btn {
    min-width: 128px;
    padding: 9px 28px;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
    font-weight: 500;
    letter-spacing: 3px;
    border: 1px solid transparent;
}

.voucher-btn-cancel {
    background: #fff;
    color: #0066b3;
    border: 1px solid #0066b3;
}

.voucher-btn-cancel:hover {
    background: #f0f6fb;
}

.voucher-btn-print {
    background: linear-gradient(to bottom, #0076c0 0%, #005b9a 100%);
    color: #fff;
    border: 1px solid #005080;
    box-shadow: 0 2px 4px rgba(0, 102, 179, 0.25);
}

.voucher-btn-print:hover {
    background: linear-gradient(to bottom, #0086d0, #006baa);
}

/* ========== 打印样式 ========== */
@media print {
    body * {
        visibility: hidden;
    }
    .voucher-modal-overlay,
    .voucher-modal-overlay * {
        visibility: visible;
    }
    .voucher-modal-overlay {
        position: static;
        background: #fff;
        padding: 0;
        display: block !important;
    }
    .voucher-modal {
        box-shadow: none;
        max-width: 100%;
        max-height: none;
    }
    .voucher-modal-header,
    .voucher-modal-footer,
    .no-print {
        display: none !important;
    }
    .voucher-modal-body {
        padding: 20px 40px;
    }
    .voucher-stamp-wrap img {
        /* 打印时保留实体印章效果 */
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }
}

/* ========== 响应式 ========== */
@media (max-width: 900px) {
    .voucher-modal-body {
        padding: 24px 20px 16px;
    }
    .voucher-ccb-title {
        font-size: 17px;
        letter-spacing: 1.5px;
    }
    .voucher-header-row {
        grid-template-columns: 1fr 1fr;
    }
    .voucher-header-row .hcol:nth-child(2),
    .voucher-header-row .hcol:nth-child(4) {
        border-right: none;
    }
    .voucher-header-row .hcol:nth-child(1),
    .voucher-header-row .hcol:nth-child(2) {
        border-bottom: 1px solid #a3c8e8;
    }
    .voucher-party-row {
        grid-template-columns: 1fr;
    }
    .voucher-party {
        border-right: none;
        border-bottom: 1px solid #a3c8e8;
    }
    .voucher-party:last-child {
        border-bottom: none;
    }
    .voucher-stamp-wrap {
        width: 130px;
        height: 130px;
        right: 20px;
        bottom: 30px;
    }
}
