/* ==========================================
   1. 全局基础样式（PC端 & 通用）
   ========================================== */
body { 
    font-size: 0.85rem; 
}

.form-control, .form-select, .btn { 
    font-size: 0.85rem; 
    padding: 0.25rem 0.5rem; 
}

.table { 
    font-size: 0.825rem; 
}

.table th, .table td { 
    white-space: nowrap; 
}

.badge { 
    font-size: 0.75rem; 
    font-weight: normal; 
}

.modal-title { 
    font-size: 1.05rem; 
}

/* 原生日期输入框消除多余空格边距 */
input[type="date"]::-webkit-datetime-edit-year-field,
input[type="date"]::-webkit-datetime-edit-month-field,
input[type="date"]::-webkit-datetime-edit-day-field,
input[type="date"]::-webkit-datetime-edit-text {
    padding: 0;
    margin: 0;
}

/* 弹窗收付款明细表格重置 */
.payment-table th, .payment-table td {
    vertical-align: middle;
    padding: 4px 6px;
}

/* 首页表格各栏目列之间纵向虚线分隔样式 */
.table-dashed-columns th:not(:last-child),
.table-dashed-columns td:not(:last-child) {
    border-right: 1px dashed #cfd4da !important;
}

/* 首页列表中“收付款明细”内部小字段间的纵向虚线分隔样式 */
.dashed-divider {
    border-right: 1px dashed #cfd4da;
    padding-right: 6px;
    margin-right: 4px;
    display: inline-block;
}

/* ==========================================
   纯 CSS 稳定悬浮提示框 (已调大字体 + 支持选中文本/点击复制)
   ========================================== */
.custom-tooltip-wrapper {
    position: relative;
    display: inline-block;
    cursor: pointer;
}

.custom-tooltip-wrapper .custom-tooltip-box {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #212529;
    color: #fff;
    text-align: center;
    padding: 5px 10px; /* 微调内边距 */
    border-radius: 4px;
    font-size: 0.85rem; /* 字号从 0.75rem 放大至 0.85rem */
    line-height: 1.4;
    white-space: nowrap;
    z-index: 1050;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.25);
    transition: opacity 0.15s ease-in-out, visibility 0.15s ease-in-out;
    user-select: text !important;
    -webkit-user-select: text !important;
    cursor: text;
}

/* 防断层“隐形桥梁”：填补文字与悬浮框之间的物理缝隙，防止划过去时抖动 */
.custom-tooltip-wrapper .custom-tooltip-box::before {
    content: "";
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    height: 12px;
}

/* 小三角指示箭号 */
.custom-tooltip-wrapper .custom-tooltip-box::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #212529 transparent transparent transparent;
}

/* 无论鼠标悬停在文字上、还是在悬浮框本身上，都保持强制显示 */
.custom-tooltip-wrapper:hover .custom-tooltip-box,
.custom-tooltip-wrapper .custom-tooltip-box:hover {
    visibility: visible;
    opacity: 1;
}


/* ==========================================
   2. 移动端 / 手持设备专属适配 (屏幕宽度 < 768px)
   ========================================== */
@media (max-width: 768px) {
    /* 解决 iOS Safari 获得焦点时自动放大页面的问题 */
    .form-control, 
    .form-select, 
    input[type="text"],
    input[type="number"],
    input[type="date"],
    select,
    textarea {
        font-size: 16px !important; /* 强制设为 16px 防止缩放 */
    }

    /* 压缩两边外边距，充分利用手机屏幕宽度 */
    .container-fluid {
        padding-left: 8px !important;
        padding-right: 8px !important;
    }

    /* 弹窗边距自适应，防止手机端挤出屏幕 */
    .modal-dialog {
        margin: 0.5rem auto !important;
        max-width: calc(100% - 1rem) !important;
    }

    .modal-body {
        padding: 0.75rem !important;
    }

    /* 保证表格不会被挤压变重叠，支持流畅的手指左右滑动 */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .payment-table {
        min-width: 800px !important; 
    }
    
    .table-dashed-columns {
        min-width: 850px !important;
    }

    /* 搜索栏在手机端改为单列占满 */
    .d-flex.align-items-center.gap-2 {
        width: 100%;
        flex-direction: column;
        align-items: stretch !important;
    }
    
    .d-flex.align-items-center.gap-2 form,
    .d-flex.align-items-center.gap-2 form input {
        width: 100% !important;
    }
}


/* ==========================================
   合同列表移动端防挤压、防变形增强补丁
   ========================================== */

/* 1. 强制外层容器支持横向滚动 */
.table-responsive {
    width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch; /* 提升 iOS 滚动流畅度 */
}

/* 2. 强制表格拥有足够的最小宽度，确保列不被压缩 */
.table-dashed-columns {
    min-width: 1100px !important; /* 设定足够撑开所有列的宽度 */
    table-layout: auto !important;
}

/* 3. 强制所有单元格内容禁止换行 */
.table-dashed-columns th,
.table-dashed-columns td {
    white-space: nowrap !important;
}

/* 4. 关键：强制“收付款明细”内部的 Flex 布局不换行 */
.table-dashed-columns .d-flex {
    flex-wrap: nowrap !important; /* 禁用换行，防止标签堆叠 */
    white-space: nowrap !important;
}

/* 5. 防止明细中的小图标或文字被压缩变形 */
.dashed-divider,
.table-dashed-columns .badge {
    flex-shrink: 0 !important;
    white-space: nowrap !important;
}