/* ==========================================================
   print.css —— 打印 / 导出 PDF 样式表
   用途：Ctrl/⌘+P →「另存为 PDF」即可得到带品牌抬头的 PDF 报表
   要点：① 打印时隐藏导航与所有操作按钮
        ② 顶部显示「智拓科技」Logo 抬头 + 页面标题 + 打印时间
        ③ 表格重复表头、避免行内断页
   ========================================================== */

/* 屏幕上不占位，只在打印时出现 */
.print-head{display:none}

@media print{
  @page{
    size:A4;
    margin:14mm 12mm 16mm;
  }

  html, body{
    background:#fff !important;
    font-size:11.5px;
    -webkit-print-color-adjust:exact;
    print-color-adjust:exact;
  }

  /* ---------- 隐藏所有应用外壳与交互元素 ---------- */
  .sidebar, .side-mask, .topbar,
  .toast-root, #modal-root, .modal-mask,
  .filter-card, .filter-bar, .filter-actions, .pager, table.tbl th .tbl-check,
  .page-head,
  table.tbl td.ops, .btn, .icon-btn, .seg,
  .login-page, .notice a, .help,
  [data-noprint]{display:none !important}

  .app{
    display:block !important;
    min-height:0 !important;
  }
  .view{
    overflow:visible !important;
    padding:0 !important;
    height:auto !important;
  }
  .view *{overflow:visible !important}

  /* ---------- 品牌抬头 ---------- */
  .print-head{
    display:flex;align-items:flex-end;justify-content:space-between;gap:16px;
    padding:0 0 8px;margin:0 0 12px;
    border-bottom:2px solid #1e7fc4;
  }
  .print-head .ph-left{display:flex;align-items:center;gap:10px}
  .print-head img.ph-logo{
    display:block;width:30mm;height:auto;   /* 按比例缩放，不拉伸 */
    object-fit:contain;
  }
  .print-head .ph-title{
    font-size:15px;font-weight:700;color:#0f172a;letter-spacing:.5px;
  }
  .print-head .ph-sub{font-size:10.5px;color:#64748b;margin-top:2px}
  .print-head .ph-right{
    text-align:right;font-size:10px;color:#64748b;line-height:1.6;flex:none;
  }

  /* ---------- 内容区 ---------- */
  /* 长表格允许跨页续排（否则整张表会被推到下一页，首页留大片空白） */
  .card{
    box-shadow:none !important;
    border:1px solid #dbe3ee !important;
    break-inside:auto;
    page-break-inside:auto;
  }
  .kpi, .chart-box, .notice, .rank-row{
    break-inside:avoid;
    page-break-inside:avoid;
  }
  .card-head{border-bottom:1px solid #e5eaf2 !important;break-inside:avoid}
  .page-head h2{font-size:15px}
  .page-head .desc{display:none}

  /* ---------- 表格：A4 宽度 < 820px 会命中移动端卡片样式，这里强制还原为表格 ---------- */
  table.tbl{width:100% !important;border-collapse:collapse !important;display:table !important}
  table.tbl thead{display:table-header-group !important}      /* 跨页重复表头 */
  table.tbl tbody{display:table-row-group !important}
  table.tbl tbody tr{
    display:table-row !important;
    border:0 !important;margin:0 !important;padding:0 !important;
    background:#fff !important;border-radius:0 !important;
  }
  table.tbl tbody tr:hover{background:#fff !important}
  table.tbl th, table.tbl td,
  table.tbl td.cell-main{
    display:table-cell !important;
    text-align:left !important;
    border:1px solid #dbe3ee !important;
    padding:5px 7px !important;
    font-size:10.5px !important;
    color:#0f172a !important;
    background:transparent !important;
  }
  table.tbl td::before{display:none !important;content:none !important}
  table.tbl th{background:#f1f5f9 !important;color:#334155 !important;font-weight:700 !important}
  table.tbl tbody tr{break-inside:avoid}

  /* 复选框列、操作列、批量操作条不进纸质报表 */
  table.tbl .col-check, table.tbl td.ops, table.tbl th.t-right{display:none !important}
  /* 除客户名称外一律不换行，避免「王芳」「2026-10-25」被压成竖排 */
  table.tbl th, table.tbl td{white-space:nowrap}
  table.tbl td.cell-main{white-space:normal;min-width:34mm}
  #batchBar{display:none !important}

  /* ---------- 图表：保持可见并避免断页 ---------- */
  .chart-box{break-inside:avoid;page-break-inside:avoid}
  canvas{max-width:100% !important}

  /* ---------- 页脚署名 ---------- */
  .print-foot{
    display:block !important;
    margin-top:14px;padding-top:6px;border-top:1px solid #e5eaf2;
    font-size:9.5px;color:#94a3b8;text-align:center;
  }
}

/* 屏幕上也隐藏页脚 */
.print-foot{display:none}
