/* ==========================================================================
   ui-print.css — PDF / 打印版式修补层
   2026-10-18

   作用域：只在打印媒体与「导出 PDF」的离屏 iframe 里生效
   （buildQuotePdfBlob() 用 collectPrintCss() 收集 @media print 与 .print-* 规则，
     所以本文件里以 .print- 开头的选择器同样会被带进 PDF）。

   依据实测（导出实物：exports/巢小小报价单_*.pdf）：
   · 表头「序号 / 施工区域 / 单位 / 数量 / 单价」被挤成竖排两行 —— 表格没有固定列宽，
     8 列按内容自由分配，中文短标签被压到 1~2 个字宽
   · 金额列与文字列对齐方式不统一
   · 明细行高随备注长度波动很大，行与行之间疏密不均
   · 表头底色 #e9f4f2 太浅，打印后几乎看不出表头区

   注：PDF 是 html2canvas 栅格化产物（scale:2 ≈ 208DPI），文字不可选、不可搜索。
       本文件只修版式，不改"图片型 PDF"这个根本形态。
   ========================================================================== */

@media print {

  /* ------------------------------------------------------------------------
     1) 施工明细表：固定列宽 + 表头不换行
     8 列：序号 | 施工区域 | 项目名称 | 单位 | 数量 | 单价 | 合价 | 品牌/备注
     ------------------------------------------------------------------------ */
  .print-table-construction {
    table-layout: fixed;
    width: 100%;
  }

  .print-table-construction th:nth-child(1),
  .print-table-construction td:nth-child(1) { width: 5%; }

  .print-table-construction th:nth-child(2),
  .print-table-construction td:nth-child(2) { width: 10%; }

  .print-table-construction th:nth-child(3),
  .print-table-construction td:nth-child(3) { width: 25%; }

  .print-table-construction th:nth-child(4),
  .print-table-construction td:nth-child(4) { width: 5%; }

  .print-table-construction th:nth-child(5),
  .print-table-construction td:nth-child(5) { width: 6%; }

  .print-table-construction th:nth-child(6),
  .print-table-construction td:nth-child(6) { width: 9%; }

  .print-table-construction th:nth-child(7),
  .print-table-construction td:nth-child(7) { width: 9%; }

  .print-table-construction th:nth-child(8),
  .print-table-construction td:nth-child(8) { width: 31%; }

  /* 表头：一律单行，中文标签不再竖排 */
  .print-table thead th {
    white-space: nowrap;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0;
    padding: 6px 4px;
  }

  /* 表头底色加深到品牌深青，白字；打印后表头区一眼能认出 */
  .print-table-construction thead th {
    background: #0f4e55 !important;
    color: #ffffff !important;
    border-color: #0f4e55 !important;
  }

  /* 首列（序号）弱化为辅助信息，与数据列区分 */
  .print-table-construction tbody td:nth-child(1) {
    text-align: center;
    color: #7a8a8d !important;
    font-size: 11px;
  }

  /* 单位/数量居中，单价/合价右对齐并用等宽数字，纵向对齐不跳 */
  .print-table-construction tbody td:nth-child(4),
  .print-table-construction tbody td:nth-child(5) {
    text-align: center;
  }

  .print-table-construction tbody td:nth-child(6),
  .print-table-construction tbody td:nth-child(7),
  .print-table-construction tfoot td:nth-child(7) {
    text-align: right !important;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
  }

  /* 备注列：允许折行，行高统一 */
  .print-table-construction tbody td:nth-child(8) {
    white-space: normal;
    word-break: break-word;
    line-height: 1.5;
    color: #4b5c5f;
    font-size: 10.5px;
  }

  /* 行高收敛：原来随备注长度波动，看起来疏密不均 */
  .print-table-construction tbody tr {
    height: auto;
  }

  .print-table-construction tbody td {
    padding: 5px 5px;
    vertical-align: middle;
    line-height: 1.45;
    font-size: 11px;
  }

  /* 小计行加粗强调 */
  .print-table-construction tfoot .print-subtotal td {
    background: #f3f8f8 !important;
    font-weight: 700;
    color: #0f4e55 !important;
    font-variant-numeric: tabular-nums;
  }

  /* ------------------------------------------------------------------------
     2) 合计区（右下角小表）：数字右对齐 + 等宽数字
     ------------------------------------------------------------------------ */
  .print-total td {
    font-variant-numeric: tabular-nums;
  }

  .print-total td:last-child {
    text-align: right;
    white-space: nowrap;
  }

  .print-total tr.grand td {
    background: #0f4e55 !important;
    color: #ffffff !important;
    font-weight: 700;
  }

  /* ------------------------------------------------------------------------
     3) 信息网格：标签与值对齐，长地址不撑破
     ------------------------------------------------------------------------ */
  .print-info > div {
    min-width: 0;
  }

  .print-info > div > span {
    white-space: nowrap;
  }

  .print-info > div > b {
    word-break: break-word;
    line-height: 1.45;
  }

  /* ------------------------------------------------------------------------
     4) 区块标题条与正文
     ------------------------------------------------------------------------ */
  .print-band {
    font-weight: 700;
    letter-spacing: 0;
  }

  .print-note b {
    font-weight: 700;
  }

  .print-note p {
    line-height: 1.7;
    font-size: 10.5px;
    margin: 4px 0 0;
  }

  /* ------------------------------------------------------------------------
     5) 签名区：与正文留出固定间距，不被上方的合计表挤压
     ------------------------------------------------------------------------ */
  .print-sign {
    margin-top: 18px;
    padding-top: 10px;
    border-top: 1px dashed #c9d8d9;
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #4b5c5f;
  }
}
