/* 大猫工具箱 · 共享样式（由 index.html 拆分）*/

/* ---- CJK 字体回退（离线 / 中文 PDF 缺字修复）---- */
  @font-face { font-family: "DengXian";       src: local("DengXian"), local("Microsoft YaHei"), local("微软雅黑"), local("SimSun"), local("宋体"); }
  @font-face { font-family: "DengXian Light"; src: local("DengXian"), local("Dengl"), local("Microsoft YaHei"), local("SimSun"); }
  @font-face { font-family: "DengXian Bold";  src: local("DengXian"), local("Dengb"), local("Microsoft YaHei"), local("SimSun"); }
  @font-face { font-family: "DengXian-Italic";src: local("DengXian"), local("Dengi"), local("Microsoft YaHei"), local("SimSun"); }
  @font-face { font-family: "SimSun";         src: local("SimSun"), local("宋体"), local("NSimSun"), local("STSong-Light"), local("Microsoft YaHei"); }
  @font-face { font-family: "NSimSun";        src: local("NSimSun"), local("SimSun"), local("宋体"); }
  @font-face { font-family: "SimSun-ExtB";    src: local("SimSun-ExtB"), local("SimSun"), local("宋体"); }
  @font-face { font-family: "STSong-Light";   src: local("STSong-Light"), local("STSong"), local("STSongStd-Light"), local("SimSun"), local("宋体"), local("Microsoft YaHei"); }
  @font-face { font-family: "STSong";         src: local("STSong"), local("STSong-Light"), local("SimSun"), local("宋体"); }
  @font-face { font-family: "STSong-Light-UniGB-UCS2-H"; src: local("STSong-Light"), local("SimSun"), local("宋体"); }
  @font-face { font-family: "STSongStd-Light";src: local("STSongStd-Light"), local("STSong-Light"), local("SimSun"); }
  @font-face { font-family: "MSung-Light";    src: local("MSung-Light"), local("SimSun"), local("宋体"); }
  @font-face { font-family: "MSung-Medium";   src: local("MSung-Medium"), local("SimSun"), local("宋体"); }
  @font-face { font-family: "HeiseiMin-W3";   src: local("HeiseiMin-W3"), local("SimSun"), local("宋体"); }
  @font-face { font-family: "HeiseiMin-W6";   src: local("HeiseiMin-W6"), local("SimSun"), local("宋体"); }
  @font-face { font-family: "Hiragino Mincho";src: local("Hiragino Mincho"), local("MS Mincho"), local("SimSun"), local("宋体"); }
  @font-face { font-family: "KaiTi";          src: local("KaiTi"), local("楷体"), local("STKaiti"), local("华文楷体"), local("SimSun"); }
  @font-face { font-family: "KaiTi_GB2312";   src: local("KaiTi"), local("楷体"), local("KaiTi_GB2312"), local("STKaiti"), local("SimSun"); }
  @font-face { font-family: "KaiTi-GB2312";   src: local("KaiTi"), local("楷体"), local("KaiTi_GB2312"), local("STKaiti"), local("SimSun"); }
  @font-face { font-family: "STKaiti";        src: local("STKaiti"), local("KaiTi"), local("楷体"), local("SimSun"); }
  @font-face { font-family: "FangSong";       src: local("FangSong"), local("仿宋"), local("STFangsong"), local("华文仿宋"), local("SimSun"); }
  @font-face { font-family: "STFangsong";     src: local("STFangsong"), local("FangSong"), local("仿宋"), local("SimSun"); }
  @font-face { font-family: "SimHei";         src: local("SimHei"), local("黑体"), local("STHeiti"), local("华文黑体"), local("Microsoft YaHei"); }
  @font-face { font-family: "STHeiti";        src: local("STHeiti"), local("SimHei"), local("黑体"), local("Microsoft YaHei"); }
  @font-face { font-family: "HeiseiKakuGo-W5";src: local("HeiseiKakuGo-W5"), local("SimHei"), local("黑体"); }
  @font-face { font-family: "Hiragino Sans";  src: local("Hiragino Sans"), local("Hiragino Kaku Gothic"), local("Microsoft YaHei"), local("微软雅黑"); }
  @font-face { font-family: "Microsoft YaHei";src: local("Microsoft YaHei"), local("微软雅黑"), local("SimSun"); }
  @font-face { font-family: "MicrosoftYaHei"; src: local("Microsoft YaHei"), local("微软雅黑"), local("SimSun"); }
  @font-face { font-family: "AdobeSongStd-Light";     src: local("SimSun"), local("宋体"); }
  @font-face { font-family: "AdobeKaitiStd-Regular";  src: local("KaiTi"), local("楷体"); }
  @font-face { font-family: "AdobeHeitiStd-Regular";  src: local("SimHei"), local("黑体"); }
  @font-face { font-family: "AdobeFangsongStd-Regular"; src: local("FangSong"), local("仿宋"); }

/* ---- 主样式 ---- */
  * { margin: 0; padding: 0; box-sizing: border-box; }
  :root {
    --primary: #4A90D9;
    --primary-hover: #3A7BC8;
    --success: #27AE60;
    --bg: #F5F7FA;
    --card: #FFFFFF;
    --text: #2C3E50;
    --text-light: #7F8C8D;
    --border: #E0E4E8;
    --shadow: 0 2px 12px rgba(0,0,0,0.08);
    --radius: 8px;
  }
  body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
  }
  header {
    width: 100%;
    background: linear-gradient(135deg, var(--primary), #6C5CE7);
    padding: 16px 20px 0;
    color: #fff;
  }
  .header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    flex-wrap: wrap;
    gap: 8px;
  }
  .brand-block { text-align: left; }
  header h1 { font-size: 22px; font-weight: 700; margin-bottom: 2px; }
  header .subtitle { font-size: 12px; opacity: 0.85; }

  /* ===== Tab 切换栏 ===== */
  .tabs {
    display: flex;
    justify-content: center;
    gap: 4px;
    padding: 0 20px;
  }
  .tab {
    padding: 10px 20px;
    background: rgba(255,255,255,0.15);
    border: none;
    color: #fff;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
  }
  .tab:hover { background: rgba(255,255,255,0.25); }
  .tab.active { background: var(--bg); color: var(--primary); }
  .tab-bar-spacer { height: 0; }

  .container {
    width: 100%;
    max-width: none;
    padding: 20px;
    flex: 1;
  }
  .tab-content { display: none; }
  .tab-content.active { display: block; }

  .card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
  }
  .card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .card-title .icon {
    width: 20px;
    height: 20px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
  }

  /* ===== 统一输入区（凑数求和） ===== */
  .input-wrapper { position: relative; }
  textarea {
    width: 100%;
    padding: 12px 14px;
    padding-right: 48px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    background: #FAFBFC;
    transition: border-color 0.2s;
    outline: none;
    resize: vertical;
    min-height: 100px;
  }
  textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(74,144,217,0.15);
  }
  textarea.dragging-over {
    border-color: var(--success);
    background: rgba(39,174,96,0.06);
  }
  .upload-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 2;
  }
  .upload-btn:hover { background: var(--primary-hover); transform: scale(1.05); }
  .upload-btn:active { transform: scale(0.95); }
  .upload-btn input[type="file"] {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    top: 0; left: 0;
  }
  .hint {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 6px;
  }
  .image-strip {
    display: none;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    padding: 10px 14px;
    background: #FAFBFC;
    border: 1px solid var(--border);
    border-radius: var(--radius);
  }
  .image-strip.visible { display: flex; }
  .image-strip img {
    width: 60px; height: 60px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid var(--border);
    flex-shrink: 0;
  }
  .image-strip .strip-info { flex: 1; font-size: 13px; color: var(--text-light); }
  .image-strip .strip-info .fname {
    font-weight: 600; color: var(--text);
    display: block; margin-bottom: 2px;
    max-width: 300px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .strip-actions { display: flex; gap: 8px; flex-shrink: 0; }
  .btn-sm {
    padding: 6px 14px;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
  }
  .btn-sm.remove { background: #E74C3C; color: #fff; }
  .btn-sm.remove:hover { background: #C0392B; }

  .ocr-bar { display: none; margin-top: 8px; }
  .ocr-bar.visible { display: block; }
  .progress-track {
    height: 5px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
  }
  .progress-track .fill {
    height: 100%;
    background: var(--success);
    border-radius: 3px;
    transition: width 0.3s;
    width: 0%;
  }
  .ocr-bar .ocr-status { font-size: 12px; color: var(--text-light); margin-top: 4px; }

  /* ===== 目标值区 ===== */
  .target-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
  }
  .target-row .input-group { flex: 1; }
  .input-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text);
  }
  input[type="number"] {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    background: #FAFBFC;
    transition: border-color 0.2s;
    outline: none;
  }
  input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(74,144,217,0.15);
  }

  /* ===== 通用按钮 ===== */
  .btn {
    padding: 10px 24px;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }
  .btn-primary { background: var(--primary); color: #fff; }
  .btn-primary:hover { background: var(--primary-hover); }
  .btn-primary:active { transform: scale(0.98); }
  .btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
  .btn:disabled { opacity: 0.5; cursor: not-allowed; background: #ECEFF3; color: #9aa3ad; }

  /* file:// 协议下的 OCR 资源加载限制提示 */
  .file-protocol-warn {
    background: #FFF0F0;
    color: #D9363E;
    padding: 10px 16px;
    text-align: center;
    font-size: 13px;
    border-bottom: 1px solid #FFD6D6;
  }

  /* ===== 结果区 ===== */
  .result-card { display: none; }
  .result-card.visible { display: block; }
  .result-summary {
    background: linear-gradient(135deg, rgba(74,144,217,0.08), rgba(108,92,231,0.08));
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 16px;
    font-size: 14px;
  }
  .result-summary .count {
    font-size: 24px; font-weight: 700; color: var(--primary);
  }
  .result-list { display: flex; flex-direction: column; gap: 8px; }
  .result-item {
    background: #FAFBFC;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s;
  }
  .result-item:hover {
    border-color: var(--primary);
    background: rgba(74,144,217,0.04);
  }
  .result-item .idx {
    width: 28px; height: 28px;
    background: var(--primary); color: #fff;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700; flex-shrink: 0;
  }
  .result-item .nums { font-size: 14px; flex: 1; }
  .result-item .nums .number {
    display: inline-block;
    background: rgba(74,144,217,0.12);
    color: var(--primary);
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
    margin: 2px;
  }
  .result-item .nums .plus { color: var(--text-light); margin: 2px; }
  .result-item .sum-display {
    font-size: 14px; font-weight: 700; color: var(--success); white-space: nowrap;
  }
  .no-result {
    text-align: center; padding: 32px; color: var(--text-light);
  }
  .no-result .icon { font-size: 48px; margin-bottom: 12px; }

  /* toast */
  .toast {
    position: fixed;
    top: 20px; left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: var(--text); color: #fff;
    padding: 12px 24px;
    border-radius: var(--radius);
    font-size: 14px; z-index: 9999;
    transition: transform 0.3s;
    opacity: 0.95;
  }
  .toast.show { transform: translateX(-50%) translateY(0); }
  .toast.error { background: #E74C3C; }
  .toast.success { background: var(--success); }

  /* 发票缩略图点击放大查看原图 */
  .img-modal {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.85);
    display: none;
    align-items: center; justify-content: center;
    z-index: 10000; padding: 24px;
  }
  .img-modal.show { display: flex; }
  .img-modal img {
    max-width: 92vw; max-height: 92vh;
    border-radius: 8px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.5);
    background: #fff;
  }
  .img-modal .img-modal-close {
    position: absolute; top: 18px; right: 24px;
    width: 40px; height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    color: #fff; font-size: 22px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
  }
  .img-modal .img-modal-close:hover { background: rgba(255,255,255,0.3); }

  /* 自定义确认弹窗 */
  .confirm-modal {
    position: fixed; inset: 0;
    background: rgba(20, 28, 38, 0.55);
    display: none;
    align-items: center; justify-content: center;
    z-index: 11000; padding: 24px;
    backdrop-filter: blur(2px);
  }
  .confirm-modal.show { display: flex; animation: confirmFade 0.15s ease; }
  @keyframes confirmFade { from { opacity: 0; } to { opacity: 1; } }
  .confirm-card {
    width: 100%; max-width: 360px;
    background: var(--card);
    border-radius: 14px;
    box-shadow: 0 12px 48px rgba(0,0,0,0.28);
    padding: 26px 24px 20px;
    text-align: center;
    animation: confirmPop 0.18s ease;
  }
  @keyframes confirmPop { from { transform: translateY(8px) scale(0.96); opacity: 0; } to { transform: none; opacity: 1; } }
  .confirm-icon {
    width: 48px; height: 48px; margin: 0 auto 14px;
    border-radius: 50%;
    background: #FFF3E0;
    font-size: 26px; line-height: 48px;
  }
  .confirm-message {
    font-size: 16px; font-weight: 600; color: var(--text);
    line-height: 1.5; margin-bottom: 22px;
  }
  .confirm-actions {
    display: flex; gap: 12px; justify-content: center;
  }
  .confirm-actions .btn {
    flex: 1; padding: 10px 0; border-radius: 10px;
    font-size: 14px; cursor: pointer; border: none;
    text-align: center;
    display: flex; align-items: center; justify-content: center;
    transition: filter 0.15s, transform 0.05s;
  }
  .confirm-actions .btn:active { transform: scale(0.98); }
  .confirm-cancel { background: #EDF1F5; color: var(--text-light); }
  .confirm-cancel:hover { filter: brightness(0.96); }
  .confirm-ok { background: #E5484D; color: #fff; }
  .confirm-ok:hover { filter: brightness(1.05); }

  /* ============================================================ */
  /* ===== 发票打印 Tab 样式 =====                                  */
  /* ============================================================ */

  /* 左右两栏布局：左=上传，右=布局+预览打印 */
  .invoice-split {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    flex-wrap: wrap;
  }
  .invoice-left {
    flex: 0 0 566px;
    max-width: 566px;
    min-width: 280px;
  }
  .invoice-right {
    flex: 1 1 0;
    min-width: 0;
  }
  /* 内容页统一尽可能宽：.container 与各工具外壳默认 max-width:none，此处不再单独限宽 */
  @media (max-width: 760px) {
    .invoice-split { flex-direction: column; }
    .invoice-left,
    .invoice-right { flex: 1 1 auto; max-width: 100%; width: 100%; }
  }

  /* 上传区 */
  .invoice-upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 32px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: #FAFBFC;
    position: relative;
  }
  .invoice-upload-zone:hover {
    border-color: var(--primary);
    background: rgba(74,144,217,0.04);
  }
  .invoice-upload-zone.dragging {
    border-color: var(--success);
    background: rgba(39,174,96,0.06);
  }
  .invoice-upload-zone .uz-icon { font-size: 40px; margin-bottom: 8px; }
  .invoice-upload-zone .uz-text { font-size: 14px; color: var(--text-light); }
  .invoice-upload-zone .uz-text strong { color: var(--primary); }
  .invoice-upload-zone input[type="file"] {
    position: absolute;
    width: 100%; height: 100%;
    opacity: 0; cursor: pointer;
    top: 0; left: 0;
  }

  /* 已上传发票文件列表 */
  .invoice-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 16px;
  }
  .invoice-list-footer {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    min-height: 0;
  }
  .invoice-count {
    font-size: 13px;
    font-weight: 600;
    color: #555;
  }
  .btn-clear-all {
    padding: 4px 10px;
    font-size: 12px;
    color: #c0392b;
    background: #fff;
    border: 1px solid #e3b7b1;
    border-radius: 6px;
    cursor: pointer;
  }
  .btn-clear-all:hover:not(:disabled) { background: #fdecea; }
  .btn-clear-all:disabled { opacity: .45; cursor: not-allowed; }
  .ocr-tip-warn {
    margin-top: 6px;
    color: #c0392b;
    font-size: 13px;
    line-height: 1.5;
  }
  .invoice-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    transition: box-shadow 0.15s;
  }
  .invoice-item.dragging {
    opacity: 0.5;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  }
  .item-drag {
    color: var(--text-light);
    cursor: grab;
    font-size: 18px;
    line-height: 1;
    padding: 0 2px;
    user-select: none;
  }
  .item-drag:active { cursor: grabbing; }
  .item-thumb {
    width: 100px;
    height: 76px;
    object-fit: contain;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: #fff;
    flex-shrink: 0;
  }
  .item-info {
    flex: 1;
    min-width: 0;
  }
  .item-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .item-meta {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 3px;
  }
  .item-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-shrink: 0;
  }
  /* 「解析中」占位卡片：转圈占住缩略图的位置，尺寸与 .item-thumb 完全一致（100×76），
     这样解析完成替换成真实缩略图时不会有任何布局跳动 */
  .invoice-item-loading {
    border-style: dashed;
    background: #FCFDFF;
  }
  .item-spinner {
    width: 100px;
    height: 76px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #fff;
  }
  .item-spinner::after {
    content: '';
    width: 24px;
    height: 24px;
    border: 3px solid #E3E8EF;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: invoice-spin 0.8s linear infinite;
  }
  @keyframes invoice-spin { to { transform: rotate(360deg); } }
  .item-actions button {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #FAFBFC;
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    transition: all 0.15s;
  }
  .item-actions button:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
    background: #F0F7FF;
  }
  .item-actions button:disabled {
    opacity: 0.35;
    cursor: not-allowed;
  }
  .item-actions .item-remove {
    width: auto;
    padding: 0 12px;
    color: #E74C3C;
    border-color: #F5B7B1;
    background: #FDF2F2;
    font-size: 13px;
  }
  .item-actions .item-remove:hover:not(:disabled) {
    background: #FADBD8;
    border-color: #E74C3C;
    color: #C0392B;
  }

  /* 布局 */
  .layout-row {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 18px;
    flex-wrap: wrap;
  }
  .layout-row:last-of-type { margin-bottom: 0; }
  .layout-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    min-width: 52px;
  }
  /* 发票处理开关（去灰底 / 发票扶正）：与布局控件同排的胶囊式复选框 */
  .inv-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border: 2px solid var(--border);
    border-radius: 22px;
    background: #FAFBFC;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
    user-select: none;
    transition: all 0.15s;
  }
  .inv-toggle:hover { border-color: var(--primary); }
  .inv-toggle input {
    width: 15px; height: 15px; margin: 0;
    accent-color: var(--primary);
    cursor: pointer;
  }
  .inv-toggle:has(input:checked) {
    border-color: var(--primary);
    background: #EAF2FC;
    color: var(--primary);
  }
  .layout-options, .orientation-options {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
  }
  .layout-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 10px 16px;
    border: 2px solid var(--border);
    border-radius: 10px;
    background: #FAFBFC;
    color: var(--text);
    cursor: pointer;
    font-size: 13px;
    transition: all 0.15s;
  }
  .layout-btn .lb-icon { width: 22px; height: 22px; }
  .layout-btn:hover { border-color: var(--primary); }
  .layout-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(74,144,217,0.3);
  }
  .orient-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border: 2px solid var(--border);
    border-radius: 22px;
    background: #FAFBFC;
    color: var(--text);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s;
  }
  .orient-btn .ob-icon { width: 16px; height: 16px; }
  .orient-btn:hover { border-color: var(--primary); }
  .orient-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(74,144,217,0.3);
  }
  .margin-select, .custom-input {
    padding: 8px 12px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
    color: var(--text);
    outline: none;
  }
  .margin-select:focus, .custom-input:focus { border-color: var(--primary); }
  .margin-select { cursor: pointer; display: inline-flex; align-items: center; gap: 6px; font-family: inherit; }
  .margin-select .caret { font-size: 10px; opacity: .6; }
  .margin-dropdown { position: relative; display: inline-block; }
  .margin-menu {
    position: absolute; top: calc(100% + 4px); left: 0; min-width: 210px;
    background: #fff; border: 1px solid var(--border); border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0,0,0,.14); padding: 4px; z-index: 60; display: none;
  }
  .margin-menu.open { display: block; }
  .margin-opt {
    padding: 8px 12px; border-radius: 6px; cursor: pointer; font-size: 14px;
    display: flex; flex-direction: column; gap: 2px; transition: background .12s;
  }
  .margin-opt:hover { background: #F0F6FF; }
  .margin-opt.active { background: #EAF2FC; }
  .margin-opt .mo-hint { font-size: 12px; color: var(--text-light); display: none; }
  .margin-opt:hover .mo-hint { display: block; }
  .custom-input { width: 68px; }
  .custom-margin-box {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    margin-top: 10px;
  }
  .cm-field {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: var(--text-light);
  }
  .cm-input {
    width: 56px;
    padding: 5px 8px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    text-align: center;
    outline: none;
  }
  .cm-input:focus { border-color: var(--primary); }
  .cm-unit { font-size: 12px; color: var(--text-light); }
  .custom-grid-inputs {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 6px 12px;
    border: 2px solid var(--border);
    border-radius: 10px;
    background: #FAFBFC;
  }
  .grid-input-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: var(--text);
    cursor: text;
  }
  .grid-input {
    width: 60px;
    text-align: center;
    padding: 6px 8px;
    border-radius: 8px;
  }

  /* ===== 发票信息统计 ===== */
  .card-title.collapsible {
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .collapse-icon {
    margin-left: auto;
    font-size: 14px;
    color: var(--text-light);
    transition: transform .2s;
  }
  .card-title.collapsed .collapse-icon { transform: rotate(-90deg); }
  .stats-body { padding-top: 14px; }
  .stats-body.collapsed { display: none; }
  .stats-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px;
    margin-bottom: 12px;
  }
  .stats-field-mode {
    display: flex;
    align-items: center;
    gap: 10px;
  }
  .stats-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    flex: 1 1 auto;
    justify-content: flex-end;
  }
  .stats-actions .btn { padding: 8px 14px; font-size: 13px; }
  .stats-custom-fields {
    margin-bottom: 12px;
    padding: 12px;
    background: #F6F8FA;
    border-radius: 10px;
    border: 1px dashed var(--border);
  }
  .stats-cf-title { font-size: 13px; color: var(--text-light); margin-bottom: 10px; }
  .stats-cf-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px 14px;
  }
  .stats-cf-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text);
    cursor: pointer;
  }
  .stats-cf-item input { cursor: pointer; }
  .stats-progress {
    font-size: 13px;
    color: var(--primary);
    margin-bottom: 10px;
    min-height: 20px;
  }
  /* OCR 阶段颜色：准备=灰 / PDF文字层=青 / 快检=蓝 / 命中=绿 / 高清兜底=橙黄 */
  .ocr-stage { font-weight: 600; }
  .ocr-ready { color: #8A94A6; }
  .ocr-pdf   { color: #0A8F8F; }
  .ocr-quick { color: #1565C0; }
  .ocr-hit   { color: #2E7D32; }
  .ocr-hd    { color: #E65100; }
  .ocr-dup   { color: #C0392B; }
  .stats-table-wrap {
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
    max-height: 520px;
  }
  .stats-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    white-space: nowrap;
  }
  .stats-table th, .stats-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
  }
  .stats-table th {
    background: #F6F8FA;
    font-weight: 600;
    color: var(--text);
    position: sticky;
    top: 0;
    z-index: 2;
  }
  .stats-table tr:hover { background: #FAFBFC; }
  .stats-table tr.duplicate { background: #FFF4F4; }
  .stats-table tr.duplicate td:first-child { border-left: 3px solid #FF4D4F; }
  .stats-table tr.stats-total { font-weight: 700; background: #F2F7FF; }
  .stats-table tr.stats-total td { border-top: 2px solid var(--primary); }
  .stats-empty { color: var(--text-light); font-size: 13px; padding: 16px; text-align: center; }

  .switch-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text);
    cursor: pointer;
  }
  .switch-label input { width: 16px; height: 16px; cursor: pointer; }

  /* 预览区 */
  .preview-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 8px;
  }
  .preview-toolbar .page-count {
    font-size: 13px;
    color: var(--text-light);
  }
  .preview-toolbar .page-count strong { color: var(--primary); }

  .a4-preview-area {
    background: #E8ECF0;
    border-radius: var(--radius);
    padding: 20px;
    max-height: 700px;
    overflow: auto;
  }
  .a4-preview-area .empty-hint {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-light);
  }
  .a4-preview-area .empty-hint .icon { font-size: 48px; margin-bottom: 12px; }

  /* A4 页面（预览用） */
  .a4-page {
    width: 100%;
    max-width: 460px;
    aspect-ratio: 210 / 297;
    margin: 0 auto 16px;
    background: #fff;
    border: 1px solid #ccc;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
    padding: var(--a4-pad-top, 28.57%) var(--a4-pad-right, 7.14%) var(--a4-pad-bottom, 4.76%) var(--a4-pad-left, 7.14%);
    display: grid;
    gap: 6px;
    box-sizing: border-box;
  }
  /* 纸张方向：决定 A4 预览比例（打印时由动态 @page 规则控制） */
  .a4-page.orient-portrait { aspect-ratio: 210 / 297; }
  .a4-page.orient-landscape { aspect-ratio: 297 / 210; }
  .a4-page .invoice-cell {
    position: relative;
    border: 1px solid #eee;
    border-radius: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    min-width: 0;
    min-height: 0;
  }
  .a4-page .invoice-cell img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    /* crisp-edges 保留文字边缘，防止打印/预览时小字被插值抹掉 */
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }
  .a4-page .empty-cell {
    border: 1px dashed #ddd;
    background: repeating-linear-gradient(45deg, #fafafa, #fafafa 8px, #f0f0f0 8px, #f0f0f0 16px);
  }
  .a4-page .page-label {
    position: absolute;
    bottom: 4px; right: 8px;
    font-size: 10px;
    color: #bbb;
  }
  .a4-page-wrap { position: relative; }

  /* ===== 打印专用容器（屏幕隐藏） ===== */
  .print-container { display: none; }

  @media print {
    /* 关键修复：之前用 visibility:hidden 隐藏整页内容，但隐藏元素仍占据文档高度，
       会生成大量"隐形空白页"。改为 display:none 彻底移出打印流，仅保留打印容器。 */
    header, .topbar, .sidebar, .page-head, .tabs, .tb-menu, #fileProtocolWarn, .feedback-fab, .img-modal { display: none !important; }
    .layout, .main { display: block !important; padding: 0 !important; margin: 0 !important; max-width: none !important; }
    /* 关键：重置 .container 的 padding/margin/max-width。基础样式里 .container 有 padding:20px，
       打印时不重置会让 210mm 的 A4 页被往下推 ~5.3mm，导致 297mm 高的页面溢出到第二张空白页 */
    .container { display: block !important; max-width: none !important; padding: 0 !important; margin: 0 !important; }
    .container > *:not(.print-container) { display: none !important; }
    html, body { margin: 0 !important; padding: 0 !important; background: #fff; }
    .print-container {
      display: block !important;
      position: static;
      width: auto;
      margin: 0;
      padding: 0;
    }
    /* 每个 a4-page 包一层 wrap，分页由 wrap 控制，最后一页不强制分页（避免 trailing 空白页） */
    .print-container .a4-page-wrap {
      display: block;
      margin: 0;
      page-break-after: always;
    }
    .print-container .a4-page-wrap:last-child { page-break-after: auto; }
    /* 打印页复用与预览相同的盒模型（padding 变量=边距、grid 布局=排版比例）；
       box-sizing:border-box + 固定高度 + overflow:hidden，确保单页绝不溢出到第二张空白页 */
    .print-container .a4-page {
      width: 210mm;
      max-width: none;
      margin: 0 auto;
      box-sizing: border-box;
      padding: var(--a4-pad-top, 28.57%) var(--a4-pad-right, 7.14%) var(--a4-pad-bottom, 4.76%) var(--a4-pad-left, 7.14%);
      gap: 3mm;
      border: none;
      box-shadow: none;
      overflow: hidden;
      page-break-inside: avoid;
      break-inside: avoid;
    }
    .print-container .page-label { display: none; }
    .print-container img { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  }

  /* ============================================================ */
  /* ===== 首页（导航页）样式 =====                                  */
  /* ============================================================ */
  .home-hero {
    text-align: center;
    padding: 48px 20px 20px;
  }
  .home-hero h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
  }
  .home-hero p {
    font-size: 14px;
    color: var(--text-light);
    line-height: 1.6;
  }
  .home-cards {
    display: flex;
    gap: 20px;
    margin-top: 12px;
    flex-wrap: wrap;
    justify-content: center;
  }
  .home-card {
    flex: 1;
    min-width: 240px;
    max-width: 320px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 36px 28px;
    cursor: pointer;
    transition: all 0.25s;
    text-align: center;
    box-shadow: var(--shadow);
    text-decoration: none;
    color: var(--text);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
  }
  .home-card:hover {
    border-color: var(--primary);
    box-shadow: 0 6px 24px rgba(74,144,217,0.18);
    transform: translateY(-4px);
  }
  .home-card .hc-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    line-height: 1;
  }
  .home-card.solver .hc-icon { background: rgba(74,144,217,0.12); }
  .home-card.invoice .hc-icon { background: rgba(39,174,96,0.12); }
  .home-card .hc-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
  }
  .home-card .hc-desc {
    font-size: 13px;
    color: var(--text-light);
    line-height: 1.6;
  }
  .home-card .hc-arrow {
    margin-top: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
  }

  /* 返回首页按钮（位于 tabs 栏最左侧） */
  .back-home {
    display: none;
    align-items: center;
    gap: 4px;
    padding: 10px 14px;
    background: rgba(255,255,255,0.2);
    border: none;
    color: #fff;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s;
    margin-right: 8px;
  }
  .back-home.visible { display: inline-flex; }
  .back-home:hover { background: rgba(255,255,255,0.35); }

  /* ============================================================ */
  /* ===== 意见反馈区样式 =====                                      */
  /* ============================================================ */
  .feedback-card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
  }
  .feedback-card .card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .feedback-card .card-title .icon {
    width: 20px;
    height: 20px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
  }
  .feedback-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 8px;
  }
  .feedback-textarea {
    width: 100%;
    min-height: 100px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    line-height: 1.7;
    font-family: inherit;
    background: #FAFBFC;
    resize: vertical;
    outline: none;
    transition: border-color 0.2s;
  }
  .feedback-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(74,144,217,0.15);
  }
  .feedback-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
    gap: 10px;
    flex-wrap: wrap;
  }
  .feedback-row .hint {
    flex: 1;
    min-width: 200px;
    font-size: 13px;
    color: var(--text-light);
  }
  .view-feedback-link {
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
    white-space: nowrap;
    padding: 8px 12px;
    border: 1px solid var(--primary);
    border-radius: var(--radius);
    transition: all 0.2s;
  }
  .view-feedback-link:hover {
    background: rgba(74,144,217,0.08);
  }

  /* ============================================================ */
  /* ===== 意见反馈区（右下角固定卡片） =====                        */
  /* ============================================================ */
  .feedback-fab {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 9000;
    font-family: inherit;
    width: 280px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
    overflow: hidden;
  }
  .fab-toggle { display: none; }
  .feedback-panel {
    display: block;
  }
  .feedback-fab.open .fab-toggle { display: none; }
  .feedback-fab.open .feedback-panel { display: block; }
  .fp-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: linear-gradient(135deg, var(--primary), #6C5CE7);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
  }
  .fp-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
  }
  .fp-source {
    padding: 6px 12px;
    font-size: 12px;
    color: var(--text-light);
    background: #FAFBFC;
    border-bottom: 1px solid var(--border);
  }
  #globalFeedback {
    width: 100%;
    min-height: 70px;
    max-height: 160px;
    padding: 10px 12px;
    border: none;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    font-family: inherit;
    background: #fff;
    color: var(--text);
    outline: none;
    resize: vertical;
    box-sizing: border-box;
  }
  #globalFeedback:focus { background: #F5FAFF; }
  .fp-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    gap: 8px;
  }
  .btn-sm {
    padding: 5px 14px;
    font-size: 13px;
    border-radius: 6px;
  }
  .fp-view {
    font-size: 12px;
    color: var(--primary);
    text-decoration: none;
    padding: 4px 8px;
    border: 1px solid var(--primary);
    border-radius: 6px;
  }
  .fp-view:hover { background: rgba(74,144,217,0.08); }

  @media (max-width: 600px) {
    .feedback-fab { width: calc(100vw - 24px); max-width: 300px; right: 12px; bottom: 12px; }
  }
  @media print {
    .feedback-fab { display: none !important; }
  }

  /* ============================================================ */
  /* ===== 响应式 =====                                            */
  /* ============================================================ */
  @media (max-width: 600px) {
    header h1 { font-size: 18px; }
    header .subtitle { font-size: 11px; }
    .container { padding: 12px; }
    .card { padding: 16px; }
    .feedback-card { padding: 16px; }
    .target-row { flex-direction: column; gap: 0; }
    .image-strip { flex-wrap: wrap; }
    .tab { padding: 8px 14px; font-size: 13px; }
    .a4-page { max-width: 100%; }
    .home-hero { padding: 28px 16px 12px; }
    .home-hero h2 { font-size: 18px; }
    .home-cards { flex-direction: column; align-items: center; }
    .home-card { min-width: auto; width: 100%; max-width: 360px; padding: 28px 20px; }
    .home-card .hc-icon { width: 56px; height: 56px; font-size: 28px; }
  }

  /* ===== A3 试卷分切 Tab 样式 ===== */
  .split-tool { max-width: none; margin: 0 auto; padding: 8px 4px 40px; }
  .split-tool h2 { font-size: 20px; margin: 6px 0 18px; }   /* 下间距 18px：与其它 tab 的 .tool-desc 底边距对齐（说明段已删，间距由标题承担） */
  .tool-desc { color: #667; font-size: 13px; margin: 0 0 18px; line-height: 1.6; }
  .split-drop {
    border: 2px dashed #c8d2e0; border-radius: 12px; padding: 28px 18px;
    text-align: center; cursor: pointer; background: #fafcff; transition: .15s;
    color: #556; font-size: 14px;
  }
  .split-drop:hover, .split-drop.drag { border-color: #4a90e2; background: #f0f6ff; color: #2a6bd0; }
  .split-drop .dz-icon { font-size: 30px; margin-bottom: 6px; }
  .split-filelist { margin: 10px 2px; font-size: 13px; color: #445; }
  .split-filelist div { padding: 3px 0; border-bottom: 1px dashed #eef; }
  .split-opts { display: flex; flex-wrap: wrap; gap: 14px 22px; margin: 18px 0; align-items: center; }
  .split-opts label { font-size: 13px; color: #445; display: flex; gap: 6px; align-items: center; }
  .split-opts select { padding: 5px 8px; border: 1px solid #ccd; border-radius: 6px; background: #fff; font-size: 13px; }
  .split-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 6px 0 4px; }
  .split-btn-primary, .split-btn-secondary {
    border: none; border-radius: 8px; padding: 10px 18px; font-size: 14px; cursor: pointer; transition: .15s;
  }
  .split-btn-primary { background: #4a90e2; color: #fff; }
  .split-btn-primary:hover { background: #3a7bc8; }
  .split-btn-primary:disabled { background: #b9cde6; cursor: not-allowed; }
  .split-btn-secondary { background: #eef2f7; color: #445; border: 1px solid #dce3ec; }
  .split-btn-secondary:hover { background: #e4eaf2; }
  .split-btn-secondary:disabled { opacity: .5; cursor: not-allowed; }
  .split-status { margin: 14px 0; font-size: 13px; color: #356; min-height: 18px; }
  .split-status.err { color: #c0392b; }
  .split-preview { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 14px; }
  .split-page { width: 150px; text-align: center; position: relative; }
  .split-page canvas { width: 150px; height: auto; border: 1px solid #e2e8f0; border-radius: 4px; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
  .split-page .pn { font-size: 11px; color: #889; margin-top: 4px; }
  .split-pagebar { display: flex; align-items: center; gap: 12px; margin-top: 14px; padding: 8px 12px; background: #f4f7fb; border: 1px solid #e4e9f1; border-radius: 8px; font-size: 13px; color: #445; }
  .split-pagebar label { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; user-select: none; }
  .split-pagebar .split-pageinfo { font-weight: 600; color: #2b4c7e; }
  .split-pagebtn { font-size: 12px; padding: 4px 10px; border-radius: 6px; border: 1px solid #dce3ec; background: #fff; color: #445; cursor: pointer; }
  .split-pagebtn:hover { background: #eef2f7; }
  .split-pagebtn.danger { color: #c0392b; border-color: #f0c5bf; }
  .split-pagebtn.danger:hover { background: #fdecea; }
  .split-page .pdel { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; line-height: 20px; border-radius: 50%; border: none; background: rgba(192,57,43,.92); color: #fff; font-size: 13px; cursor: pointer; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
  .split-page .pdel:hover { background: #a93226; }
  .split-page .pchk { position: absolute; top: 6px; left: 6px; width: 16px; height: 16px; cursor: pointer; }
  .split-page.removed { opacity: .35; }
  .split-page.removed canvas { border-color: #c0392b; }

  /* A3 切割线编辑器 */
  .split-cutarea { margin: 16px 0; border: 1px solid #e4e9f1; border-radius: 12px; padding: 14px; background: #fbfcfe; }
  .split-cutbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
  .split-cutbtn { border: 1px solid #cdd6e4; background: #fff; color: #3a4a5e; border-radius: 7px; padding: 7px 12px; font-size: 13px; cursor: pointer; transition: .12s; }
  .split-cutbtn:hover { border-color: #4a90e2; color: #2a6bd0; }
  .split-cutbtn.active { background: #4a90e2; border-color: #4a90e2; color: #fff; }
  .split-cutbtn.danger { color: #c0392b; border-color: #eccfca; }
  .split-cutbtn.danger:hover { background: #fdecea; }
  .split-cutinfo { font-size: 12px; color: #8a98aa; margin-left: 6px; }
  .split-cutstage { position: relative; display: inline-block; max-width: 100%; line-height: 0; user-select: none; touch-action: none; border: 1px solid #d8e0ec; background: #fff; }
  .split-cutstage img { display: block; max-width: 100%; height: auto; }
  .cut-line { position: absolute; background: #e23a5e; box-shadow: 0 0 0 1px rgba(255,255,255,.7); z-index: 5; }
  .cut-line.cut-v { top: 0; bottom: 0; width: 2px; margin-left: -1px; cursor: ew-resize; }
  .cut-line.cut-h { left: 0; right: 0; height: 2px; margin-top: -1px; cursor: ns-resize; }
  .cut-line.sel { background: #1f9d55; box-shadow: 0 0 0 2px rgba(31,157,85,.4); }
  .cut-line.cut-v::after { content: ''; position: absolute; left: -8px; right: -8px; top: 0; bottom: 0; }
  .cut-line.cut-h::after { content: ''; position: absolute; top: -8px; bottom: -8px; left: 0; right: 0; }
  .split-empty-cut { color: #99a; font-size: 13px; padding: 8px 0; }

  /* ===== 网页转Word/PDF Tab 样式 ===== */
  .web2doc-tool { max-width: none; margin: 0 auto; padding: 8px 4px 40px; }
  .web2doc-tool h2 { font-size: 20px; margin: 6px 0 4px; }
  .web2doc-input { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0 10px; }
  .web2doc-input input[type="text"] { flex: 1; padding: 12px 16px; border: 1px solid #ccd; border-radius: 10px; font-size: 14px; }
  .web2doc-input textarea { width: 100%; min-height: 160px; padding: 12px 14px; border: 1px solid #ccd; border-radius: 8px; font-size: 13px; font-family: monospace; line-height: 1.5; resize: vertical; }
  /* 粘贴区：contenteditable（不是 textarea）—— textarea 只能收文本，剪贴板里的图片是二进制、根本进不来，
     所以这里必须用可编辑富文本容器，才能在 paste 事件里把图片转成 dataURL 插进来。 */
  .web2doc-paste { width: 100%; min-height: 160px; max-height: 420px; overflow: auto; padding: 12px 14px; border: 1px solid #ccd; border-radius: 8px; background: #fff; font-size: 14px; line-height: 1.7; color: #222; outline: none; white-space: pre-wrap; word-break: break-word; transition: .15s; }
  .web2doc-paste:focus { border-color: #4a90e2; box-shadow: 0 0 0 3px rgba(74, 144, 226, .12); }
  .web2doc-paste:empty::before { content: attr(data-ph); color: #9aa3ad; pointer-events: none; }
  .web2doc-paste img { max-width: 100%; height: auto; margin: 6px 0; border-radius: 4px; vertical-align: bottom; }
  .web2doc-paste p { margin: 0 0 4px; }
  .web2doc-paste table { border-collapse: collapse; margin: 6px 0; font-size: 13px; }
  .web2doc-paste td, .web2doc-paste th { border: 1px solid #ccd; padding: 4px 8px; }
  .web2doc-paste h1, .web2doc-paste h2, .web2doc-paste h3 { margin: 8px 0 4px; font-size: 1.05em; }
  .web2doc-pastebox { display: block; margin: 10px 0 10px; }
  /* 「清除内容」在文本框外面、右上角（框上方一行，右对齐）；框收起或无内容时整条隐藏 */
  .web2doc-paste-bar { display: flex; justify-content: flex-end; align-items: center; margin: 0 0 6px; }
  .web2doc-clear { padding: 4px 11px; font-size: 12px; line-height: 1.4; color: #667; background: #fff; border: 1px solid #dce3ec; border-radius: 999px; cursor: pointer; transition: .15s; }
  .web2doc-clear:hover { color: #c0392b; border-color: #f0c4bc; background: #fff6f4; }
  .web2doc-inline-btn { padding: 5px 14px; font-size: 13px; margin: 0 4px; vertical-align: middle; border-radius: 999px; }
  .web2doc-opts { display: flex; gap: 12px; margin: 4px 0 6px; font-size: 14px; color: #445; }
  .web2doc-pill { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; user-select: none; padding: 8px 16px; border: 1px solid #cdd6e2; border-radius: 999px; background: #f6f9fc; transition: .15s; }
  .web2doc-pill:hover { background: #eef4fb; }
  .web2doc-pill input { accent-color: #4a90e2; }
  .web2doc-extra { margin: 6px 0 2px; font-size: 13px; color: #445; cursor: pointer; }
  .web2doc-extra:hover span:not(.web2doc-arrow) { text-decoration: underline; text-decoration-color: #b9c6d6; }
  /* 展开 / 收起指示箭头（文本框收起时 ▾，展开时 ▴） */
  .web2doc-arrow { display: inline-block; margin-left: 5px; font-size: 12px; color: #7d8894; line-height: 1; }
  .web2doc-extra a { color: #4a90e2; text-decoration: none; }
  .web2doc-extra a:hover { text-decoration: underline; }
  .web2doc-actions { display: flex; gap: 12px; margin: 12px 0 4px; }
  .web2doc-btn { border: none; border-radius: 8px; padding: 10px 20px; font-size: 14px; cursor: pointer; transition: .15s; background: #eef2f7; color: #445; border: 1px solid #dce3ec; }
  .web2doc-btn:hover { background: #e4eaf2; }
  .web2doc-btn.primary { background: #4a90e2; color: #fff; border-color: transparent; }
  .web2doc-btn.primary:hover { background: #3a7bc8; }
  .web2doc-btn:disabled { opacity: .55; cursor: not-allowed; }
  .web2doc-hint { margin: 14px 0; padding: 12px 14px; background: #fff9e6; border: 1px solid #f0e2b6; border-radius: 8px; font-size: 13px; color: #665; line-height: 1.6; }
  .web2doc-status { margin: 12px 0; font-size: 13px; color: #356; min-height: 18px; }
  .web2doc-status.err { color: #c0392b; }
  .web2doc-preview { margin-top: 18px; border: 1px solid #e2e8f0; border-radius: 10px; background: #fff; overflow: hidden; }
  .web2doc-preview-title { padding: 10px 14px; background: #f4f7fb; border-bottom: 1px solid #e2e8f0; font-size: 13px; font-weight: 600; color: #445; }
  .web2doc-preview-body { max-height: 420px; overflow: auto; padding: 16px 18px; font-size: 14px; line-height: 1.7; color: #333; }
  .web2doc-preview-body h1, .web2doc-preview-body h2, .web2doc-preview-body h3 { color: #222; margin: 18px 0 10px; line-height: 1.3; }
  .web2doc-preview-body p { margin: 10px 0; }
  .web2doc-preview-body img { max-width: 100%; height: auto; }
  .web2doc-preview-body a { color: #4a90e2; }
  .home-card.web2doc .hc-icon { background: rgba(155,89,182,.12); }

  /* ===== 页脚（版权 + 备案号） ===== */
  .site-footer {
    width: 100%;
    margin-top: auto;          /* 页面内容不足一屏时，页脚贴到浏览器最底部 */
    padding: 16px 20px 20px;
    border-top: 1px solid var(--border);
    color: #8a94a6;
    font-size: 12px;
    line-height: 1.9;
    text-align: center;
    flex: none;
  }
  .site-footer a { color: #8a94a6; text-decoration: none; }
  .site-footer a:hover { color: var(--primary); text-decoration: underline; }
  /* 右下角有常驻的「意见反馈」卡片（宽 280px、高约 150px）：
     宽屏时页脚文字居中显示，卡片在更右下方不会压到文字；
     窗口较窄时给右侧留白，避免文字被卡片压住；
     手机端卡片几乎占满底部，页脚整体上移一段让出空间。 */
  @media (min-width: 901px) { .site-footer { padding-right: 20px; } }
  @media (min-width: 601px) and (max-width: 900px) { .site-footer { padding-right: 300px; } }
  @media (max-width: 600px) { .site-footer { padding-bottom: 186px; } }
  @media print { .site-footer { display: none; } }
  /* ===== Word 疑难修复 ===== */
  .wf-tool { max-width: none; margin: 0 auto; padding: 8px 4px 40px; }
  .wf-tool h2 { font-size: 22px; margin: 0 0 6px; }

  .wf-drop {
    border: 2px dashed #cfd8e3; border-radius: 12px; background: #fbfcfe;
    padding: 28px 16px; text-align: center; cursor: pointer; transition: .15s;
  }
  .wf-drop:hover, .wf-drop.wf-drag { border-color: var(--primary, #4a7dff); background: #f4f8ff; }
  .wf-drop-icon { font-size: 30px; line-height: 1; margin-bottom: 8px; }
  .wf-drop-main { font-size: 15px; color: #364152; }
  .wf-drop-sub { font-size: 12px; color: #9aa4b2; margin-top: 6px; }

  .wf-file {
    display: flex; align-items: center; gap: 8px;
    border: 1px solid #dce3ec; border-radius: 10px; background: #fff;
    padding: 10px 12px; margin-top: 12px;
  }
  .wf-file-icon { font-size: 16px; }
  .wf-file-name { font-size: 13px; color: #2b3444; flex: 1; word-break: break-all; }
  .wf-file-size { font-size: 12px; color: #98a2b3; white-space: nowrap; }
  .wf-file-clear { border: none; background: transparent; color: #98a2b3; cursor: pointer; font-size: 14px; padding: 2px 6px; }
  .wf-file-clear:hover { color: #e5484d; }

  .wf-ops { margin-top: 18px; }
  .wf-ops-head {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 13px; color: #6b7480; margin-bottom: 8px;
  }
  .wf-ops-actions button {
    border: 1px solid #dce3ec; background: #fff; color: #4a5568;
    border-radius: 6px; font-size: 12px; padding: 3px 10px; cursor: pointer; margin-left: 6px;
  }
  .wf-ops-actions button:hover { border-color: var(--primary, #4a7dff); color: var(--primary, #4a7dff); }

  .wf-group {
    font-size: 12px; color: #8a94a6; font-weight: 600;
    margin: 16px 0 6px; padding-left: 2px; letter-spacing: .5px;
  }
  .wf-op {
    border: 1px solid #e6ebf2; border-radius: 10px; background: #fff;
    padding: 10px 12px; margin-bottom: 8px;
  }
  .wf-op-check { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; color: #2b3444; }
  .wf-op-check input { width: 16px; height: 16px; accent-color: var(--primary, #4a7dff); cursor: pointer; }
  .wf-op-ctl {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
    margin: 8px 0 0 24px; font-size: 12px; color: #6b7480;
  }
  .wf-op-ctl select, .wf-op-ctl input[type=number], .wf-op-ctl input[type=text] {
    border: 1px solid #dce3ec; border-radius: 6px; padding: 4px 8px;
    font-size: 12px; color: #364152; background: #fff; max-width: 100%;
  }
  .wf-op-ctl select { max-width: 340px; }
  .wf-op-ctl .wf-num { width: 62px; }
  .wf-op-ctl .wf-mini { width: 90px; }
  .wf-op-hint { color: #9aa4b2; }
  .wf-op-sub { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
  .wf-op-sub input { accent-color: var(--primary, #4a7dff); }

  .wf-actions { display: flex; gap: 10px; margin-top: 18px; }
  .wf-btn {
    border: 1px solid #dce3ec; background: #fff; color: #364152;
    border-radius: 8px; padding: 10px 20px; font-size: 14px; cursor: pointer; transition: .15s;
  }
  .wf-btn:hover { border-color: var(--primary, #4a7dff); color: var(--primary, #4a7dff); }
  .wf-btn.primary { background: var(--primary, #4a7dff); border-color: var(--primary, #4a7dff); color: #fff; }
  .wf-btn.primary:hover { opacity: .9; color: #fff; }
  .wf-btn:disabled { opacity: .55; cursor: not-allowed; }

  .wf-status { font-size: 13px; color: #6b7480; margin-top: 14px; min-height: 18px; }
  .wf-status.err { color: #e5484d; }

  .wf-report { margin-top: 16px; border: 1px solid #e6ebf2; border-radius: 10px; overflow: hidden; }
  .wf-after { margin-top: 16px; border: 1px solid #e6ebf2; border-radius: 10px; overflow: hidden; padding: 12px 14px; background: #fbfdff; }
  .wf-after-cap { font-size: 13px; color: #3a6ea5; font-weight: 600; margin-bottom: 8px; }
  .wf-report-head {
    background: #f6f9fc; padding: 10px 14px; font-size: 13px; color: #364152; font-weight: 600;
    border-bottom: 1px solid #e6ebf2;
  }
    .wf-save-bar { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: #f2f7ff; border-bottom: 1px solid #e0eaff; }
  .wf-save-btn { flex: none; padding: 8px 16px; font-size: 14px; font-weight: 600; color: #fff; background: var(--primary, #4a7dff); border: none; border-radius: 8px; cursor: pointer; }
  .wf-save-btn:hover { filter: brightness(1.06); }
  .wf-save-name { font-size: 12px; color: #6b7480; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  @media (max-width: 600px) {
    .wf-op-ctl { margin-left: 0; }
    .wf-op-ctl select { max-width: 100%; }
  }
  .wf-scope { border: 1px solid #dcdfe6; border-radius: 8px; background: #eef1f6; padding: 14px; margin: 14px 0 4px; }
  .wf-scope-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; margin-bottom: 8px; }
  .wf-scope-list { max-height: 460px; overflow-y: auto; border: 1px solid #d0d5dd; border-radius: 4px; background: #fff; padding: 18px 22px; box-shadow: inset 0 1px 4px rgba(0,0,0,0.05); font-family: "Songti SC","SimSun","宋体",serif; }
  .wf-scope-row { display: flex; align-items: flex-start; gap: 6px; padding: 3px 6px; border-radius: 4px; cursor: pointer; font-size: 14px; color: #1f2733; user-select: text; line-height: 1.8; }
  .wf-scope-row:hover { background: #f3f7fd; }
  .wf-scope-row.selected { background: #eef4ff; box-shadow: inset 3px 0 0 var(--primary, #4a7dff); }
  .wf-scope-row:not(.selected) { color: #aab2bf; background: #fafbfd; }
  .wf-scope-row:not(.selected) .wf-scope-t { opacity: 0.75; }
  .wf-scope-list.wf-dragging { user-select: none; cursor: default; }
  .wf-scope-t { flex: 1 1 auto; white-space: normal; word-break: break-word; user-select: text; line-height: 1.8; }
.wf-scope-t-p { text-indent: 2em; }
.wf-scope-num { color: #8a94a6; margin-right: 0.15em; }
.wf-scope-t-tbl { display: block; }
  .wf-tbl-cap { display: block; font-size: 12px; color: #8a94a6; margin-bottom: 3px; }
  .wf-tbl-wrap { display: block; overflow-x: auto; max-width: 100%; padding-bottom: 2px; }
  .wf-tbl-grid { border-collapse: collapse; font-size: 12px; line-height: 1.4; }
  .wf-tbl-grid td { border: 1px solid #c7cdd6; padding: 1px 7px; white-space: nowrap; color: #33415c; max-width: 240px; overflow: hidden; text-overflow: ellipsis; }
  .wf-tbl-grid.wf-tbl-faint td { border-color: #e3e7ee; }
  .wf-tbl-more { color: #9aa4b2; }
  .wf-tbl-more-row { display: block; font-size: 12px; color: #9aa4b2; margin-top: 2px; }
  .wf-tbl-quick { display: inline-flex; flex-wrap: wrap; gap: 4px; margin-right: 4px; vertical-align: middle; }
  .wf-tbl-qbtn { font-size: 12px; line-height: 1.2; padding: 2px 7px; border: 1px solid #cdd4df; border-radius: 4px; background: #fff; color: #3a4a63; cursor: pointer; }
  .wf-tbl-qbtn:hover { border-color: var(--primary, #4a7dff); color: var(--primary, #4a7dff); }
  .wf-tbl-qbtn.active { background: var(--primary, #4a7dff); border-color: var(--primary, #4a7dff); color: #fff; }
  .wf-tbl-cbtn { font-size: 12px; line-height: 1.2; padding: 2px 7px; border: 1px dashed #c0c8d4; border-radius: 4px; background: #fff; color: #6a7686; cursor: pointer; }
  .wf-tbl-cbtn:hover { border-color: var(--primary, #4a7dff); color: var(--primary, #4a7dff); }
  .wf-tbl-cbtn.active { background: var(--primary, #4a7dff); border-color: var(--primary, #4a7dff); color: #fff; border-style: solid; }
  .wf-tbl-modes { display: inline-flex; flex-wrap: wrap; gap: 6px 14px; margin: 2px 0 4px; }
  .wf-radio { font-size: 13px; color: #3a4a63; cursor: pointer; }
  .wf-tbl-custom { display: block; margin-top: 4px; padding: 6px 10px; border: 1px dashed #d4dae3; border-radius: 6px; background: #fbfcfe; }
  .wf-tbl-defs { display: inline-block; border: 1px solid #e3e8f0; border-radius: 6px; overflow: hidden; margin: 2px 0 6px; background: #fff; }
  .wf-tbl-def { display: grid; grid-template-columns: 84px 84px 78px 92px; align-items: center; gap: 6px; padding: 3px 8px; font-size: 13px; }
  .wf-tbl-def + .wf-tbl-def { border-top: 1px solid #eef1f6; }
  .wf-tbl-def-head { background: #f5f7fb; color: #6b7688; font-size: 12px; font-weight: 600; }
  .wf-tbl-def-name { color: #3a4a63; }
  .wf-tbl-def select { font-size: 12px; padding: 1px 2px; border: 1px solid #d4dae3; border-radius: 4px; background: #fff; color: #25324a; max-width: 100%; }
  .wf-tbl-live { margin: 2px 0 4px; }
  .wf-tbl-live-box { display: inline-block; vertical-align: middle; margin-left: 6px; }
  .wf-tbl-live-tbl { border-collapse: collapse; }
  .wf-tbl-live-tbl td { width: 30px; height: 16px; }
  .wf-tbl-live-none { font-size: 12px; color: #b0b8c4; }
  .wf-embed-tip { color: #b45309; font-size: 12px; margin: 4px 0 6px; line-height: 1.5; }
  .wf-save-btn.ghost { background: #fff; color: #3a4a63; border: 1px solid #cdd4df; }
  .wf-scope-cap { font-size: 12px; color: #9aa4b2; padding: 6px 8px 2px; }
  .wf-funcs { margin-top: 18px; border: 1px solid #eef2f7; border-radius: 12px; background: #fbfdff; padding: 14px 16px; }
  .wf-funcs-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; margin-bottom: 10px; }
  .wf-funcs-row { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 10px; }
  /* 兜底修复：作者样式里的 display 会覆盖浏览器默认的 [hidden]{display:none}，
     历史上因此让「参数行 / 文件信息行 / 按钮行」带 hidden 也照样显示。 */
  .wf-tool [hidden] { display: none !important; }
  .wf-func {
    display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px;
    border: 1px solid #dce3ec; border-radius: 10px; background: #fff;
    padding: 7px 12px; font-size: 13px; color: #364152; transition: .15s;
  }
  .wf-func:hover { border-color: var(--primary, #4a7dff); }
  .wf-func.active { background: #eef4ff; border-color: var(--primary, #4a7dff); }
  .wf-func-main { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; user-select: none; }
  .wf-func.active .wf-func-main { color: var(--primary, #4a7dff); font-weight: 600; }
  .wf-func-main input { width: 15px; height: 15px; accent-color: var(--primary, #4a7dff); cursor: pointer; margin: 0; }
  .wf-func-params {
    display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px;
    padding-left: 10px; border-left: 1px dashed #d8e0ec; font-size: 12px; color: #6b7480;
  }
  .wf-func-params select, .wf-func-params input[type=number], .wf-func-params input[type=text] {
    border: 1px solid #dce3ec; border-radius: 6px; padding: 3px 6px; font-size: 12px; color: #364152; background: #fff; max-width: 100%;
  }
  .wf-func-params .wf-op-sub { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
  .wf-func-params .wf-op-sub input { accent-color: var(--primary, #4a7dff); }
  .home-card.wordfix .hc-icon { background: rgba(230,126,34,0.12); }
  .home-card.excelfix .hc-icon { background: rgba(34,139,87,0.12); }
  /* （已移除：原「选择要处理的工作表」清单，现由表格预览标签页承担选择） */
  /* Excel 表格预览（类 WPS/Excel 网格） */
  .xf-preview { margin: 14px 0 4px; }
  .xf-preview-sheet { margin-left: 8px; font-size: 12px; color: #98a2b3; font-weight: 500; }
  .xf-preview-hint { margin-left: 8px; font-size: 11.5px; color: #98a2b3; font-weight: 400; }
  .xf-tabs { display: flex; flex-wrap: wrap; gap: 4px; align-items: flex-end; padding-left: 2px; }
  .xf-tab {
    border: 1px solid #d0d5dd; border-bottom: none; background: #eef2f8; color: #475467;
    border-radius: 7px 7px 0 0; padding: 5px 13px; font-size: 12.5px; cursor: pointer;
    max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .xf-tab:hover { background: #e3ebf7; }
  .xf-tab.active { background: #fff; color: var(--primary, #4a7dff); font-weight: 600; border-color: #b9cdf3; }
  .xf-tab.hidden-sheet::after { content: ' 隐藏'; font-size: 10px; color: #e5893b; }
  .xf-grid-wrap { border: 1px solid #d0d5dd; border-radius: 0 6px 6px 6px; overflow: auto; max-height: 480px; background: #fff; }
  table.xf-grid { border-collapse: separate; border-spacing: 0; font-size: 12.5px; color: #1f2733; font-family: "Microsoft YaHei", "Segoe UI", system-ui, sans-serif; }
  table.xf-grid th, table.xf-grid td { border-right: 1px solid #e4e8ef; border-bottom: 1px solid #e4e8ef; padding: 3px 8px; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }
  table.xf-grid thead th { position: sticky; top: 0; z-index: 2; background: #f2f5f9; color: #667085; font-weight: 500; text-align: center; min-width: 40px; }
  table.xf-grid th.xf-rownum { position: sticky; left: 0; z-index: 1; background: #f2f5f9; color: #667085; font-weight: 500; text-align: center; }
  table.xf-grid thead th.xf-corner { left: 0; z-index: 3; background: #e9eef6; }
  table.xf-grid td.xf-num { text-align: right; }
  .xf-preview-note { font-size: 12px; color: #98a2b3; margin-top: 6px; padding-left: 2px; }

  /* ===== Excel 多表合并 ===== */
  .xf-modebar { display: flex; gap: 6px; margin: 4px 0 16px; padding: 4px; background: #f2f5f9; border-radius: 10px; width: fit-content; }
  .xf-modebtn { border: none; background: transparent; color: #667085; font-size: 14px; font-weight: 500; padding: 8px 18px; border-radius: 7px; cursor: pointer; transition: .15s; }
  .xf-modebtn:hover { color: var(--primary, #4a7dff); }
  .xf-modebtn.active { background: #fff; color: var(--primary, #4a7dff); font-weight: 600; box-shadow: 0 1px 4px rgba(16,24,40,.12); }
  .xf-pane-desc { font-size: 13px; color: #8a94a6; margin: 0 0 16px; line-height: 1.6; }
  .xf-merge-opts { margin-bottom: 14px; }
  .xf-opt-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 6px 0; font-size: 13px; color: #475467; }
  .xf-opt-row input[type=number], .xf-opt-row input[type=text] { border: 1px solid #dce3ec; border-radius: 6px; padding: 5px 8px; font-size: 12px; color: #364152; }
  .xf-opt-row .wf-num { width: 62px; }
  .xf-opt-row .wf-mini { width: 130px; }
  .xf-opt-row select { border: 1px solid #dce3ec; border-radius: 6px; padding: 5px 8px; font-size: 12px; color: #364152; background: #fff; }
  .xf-merge-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
  .xf-merge-list[hidden] { display: none; }
  .xf-merge-list .wf-file { margin-top: 0; }
  @media (max-width: 600px) {
    .xf-modebar { width: 100%; }
    .xf-modebtn { flex: 1; padding: 8px 10px; }
  }

  .xf-grid-stack { display: block; }
  .xf-grid-block { padding: 8px 10px 10px; border-bottom: 1px solid #eef1f5; }
  .xf-grid-block:last-child { border-bottom: none; }
  .xf-grid-title { font-size: 12.5px; font-weight: 600; color: #475467; margin: 2px 0 6px; padding-left: 2px; }
  .xf-grid-title .xf-grid-idx { color: #98a2b3; font-weight: 500; margin-right: 6px; }
  /* 分页工具栏 + 选区 */
  .xf-pager { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 6px 8px; background: #f7f9fc; border: 1px solid #d0d5dd; border-bottom: none; border-radius: 6px 6px 0 0; font-size: 12.5px; color: #475467; }
  .xf-pager[hidden] { display: none; }
  .xf-page-btn { border: 1px solid #cdd5e0; background: #fff; color: #475467; border-radius: 5px; padding: 3px 10px; font-size: 12.5px; cursor: pointer; }
  .xf-page-btn:hover { background: #eef3fb; }
  .xf-page-info { font-variant-numeric: tabular-nums; }
  .xf-sel-info { margin-left: 4px; color: #1f6feb; font-weight: 500; }
  table.xf-grid td.xf-sel, table.xf-grid th.xf-sel { background: rgba(74,125,255,0.28) !important; box-shadow: inset 0 0 0 1px #4a7dff; }
  table.xf-grid th.xf-rownum.xf-sel, table.xf-grid thead th.xf-sel { background: rgba(74,125,255,0.18) !important; }

/* 多页架构：每个工具页只渲染自身内容，tab-content 始终显示 */
.tab-content{display:block !important;}

/* ================================================================
   新版外壳：顶栏（品牌 + 搜索 + 图标） + 左侧分组导航 + 主内容区
   （2026-10 由「顶部胶囊导航」改版而来；旧 header/.tool-nav 规则保留但不再使用）
   ================================================================ */
:root { --topbar-h: 56px; }

.topbar {
  width: 100%; padding: 0;
  background: #fff; color: var(--text);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 60;
}
.topbar-inner {
  max-width: none; margin: 0 auto; padding: 0 20px;
  height: var(--topbar-h); display: flex; align-items: center; gap: 20px;
}
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; color: var(--text); flex: none; }
.brand-logo {
  width: 30px; height: 30px; border-radius: 9px; flex: none; color: #fff;
  background: linear-gradient(135deg, var(--primary), #6C5CE7);
  display: flex; align-items: center; justify-content: center;
}
.brand-name { font-size: 16px; font-weight: 700; color: var(--text); white-space: nowrap; letter-spacing: .2px; }

.topbar-search { position: relative; flex: 1 1 auto; max-width: 520px; min-width: 0; margin: 0 auto; }
.topbar-search .search-ico { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); font-size: 13px; opacity: .5; pointer-events: none; }
.topbar-search input {
  width: 100%; height: 36px; padding: 0 14px 0 36px;
  border: 1px solid var(--border); border-radius: 999px; background: #F5F7FA;
  font-size: 14px; font-family: inherit; color: var(--text); outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.topbar-search input::placeholder { color: #A5AEB8; }
.topbar-search input:focus { background: #fff; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(74,144,217,.15); }

.topbar-actions { display: flex; align-items: center; gap: 2px; flex: none; }
.tb-icon {
  width: 36px; height: 36px; border: none; border-radius: 9px; background: transparent;
  cursor: pointer; font-size: 16px; line-height: 1; color: #5B6470;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s;
}
.tb-icon:hover { background: var(--bg); color: var(--primary); }

.tb-menu {
  position: fixed; z-index: 9500; min-width: 178px; padding: 6px;
  background: #fff; border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 10px 30px rgba(20,30,50,.14); font-size: 13.5px;
}
.tbm-title { font-size: 11.5px; font-weight: 700; color: #98A2B3; padding: 7px 10px 4px; letter-spacing: .4px; }
.tbm-item { display: block; padding: 7px 10px; border-radius: 7px; color: var(--text); text-decoration: none; }
.tbm-item:hover { background: var(--bg); color: var(--primary); }
.tbm-empty { padding: 7px 10px; font-size: 12.5px; color: #A5AEB8; }

/* ---------- 两栏布局 ---------- */
.layout { width: 100%; max-width: none; margin: 0 auto; padding: 20px; flex: 1; display: flex; gap: 24px; align-items: flex-start; }
.sidebar {
  width: 206px; flex: none;
  position: sticky; top: calc(var(--topbar-h) + 16px);
  max-height: calc(100vh - var(--topbar-h) - 32px);
  overflow-y: auto; overscroll-behavior: contain;
}
.side-nav { display: flex; flex-direction: column; gap: 1px; }
.side-link { display: block; padding: 7px 11px; border-radius: 7px; font-size: 13.5px; color: #4A5568; text-decoration: none; transition: background .12s, color .12s; }
.side-link:hover { background: var(--bg); color: var(--primary); }
.side-link.active { background: rgba(74,144,217,.10); color: var(--primary); font-weight: 600; }
.side-home { font-weight: 600; margin-bottom: 6px; }
.side-group { margin-top: 12px; }
.side-group-title { font-size: 12px; font-weight: 700; letter-spacing: .5px; padding: 4px 11px 5px; color: #7C8798; }
.side-group[data-g="pdf"] .side-group-title { color: #E67E22; }
.side-group[data-g="office"] .side-group-title { color: #7C5CE0; }
.side-group[data-g="calc"] .side-group-title { color: #1A73E8; }
.side-empty { display: none; padding: 18px 11px; font-size: 13px; color: #A5AEB8; }

/* ---------- 主内容 ---------- */
.main { flex: 1 1 auto; min-width: 0; }
.layout .container { margin: 0 auto; }
.page-head { margin: 0 0 16px; }
.breadcrumb { font-size: 12.5px; color: var(--text-light); margin-bottom: 10px; }
.breadcrumb a { color: var(--text-light); text-decoration: none; }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb .sep { margin: 0 6px; color: #C6CEDA; }
.page-title { font-size: 24px; font-weight: 700; color: var(--text); margin: 0 0 8px; line-height: 1.3; }
.page-desc { font-size: 13.5px; color: var(--text-light); line-height: 1.65; margin: 0 0 8px; }
.page-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--success); }
.page-badge::before { content: "✓"; font-weight: 700; }

/* ---------- 反馈：沿用「右下角常驻固定卡片」规则（始终显示，不收起） ---------- */

/* ---------- 响应式：窄屏侧栏改为顶部胶囊行 ---------- */
@media (max-width: 900px) {
  .layout { flex-direction: column; padding: 14px; gap: 14px; }
  .sidebar { width: 100%; position: static; max-height: none; overflow: visible; }
  .side-nav { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px; }
  .side-home { margin-bottom: 0; }
  .side-group { margin-top: 0; width: 100%; }
  .side-group-title { padding: 6px 2px 2px; }
  .side-group .side-link { display: inline-block; padding: 6px 12px; border: 1px solid var(--border); margin: 0 6px 6px 0; }
  .side-link.active { border-color: var(--primary); }
  .side-empty { padding: 10px 2px; }
}
@media (max-width: 640px) {
  .topbar-inner { gap: 10px; padding: 0 12px; }
  .brand-name { display: none; }
  .topbar-search { margin: 0; }
  .page-title { font-size: 20px; }
}

/* 表格批量设置：参数内的子分组 */
.wf-op-group { display: inline-block; margin-right: 12px; white-space: nowrap; }
.wf-op-group select, .wf-op-group input { margin-left: 2px; }
/* 表格批量设置：参数区整行竖排（边框 / 行高 / 对齐 / 自动调整 各自独立成行，避免挤在一行） */
.wf-func-params.wf-tbl-params {
  flex: 1 1 100%; display: flex; flex-direction: column; align-items: stretch; gap: 8px;
  margin-top: 8px; padding-left: 0; border-left: none; padding-top: 8px; border-top: 1px dashed #d8e0ec;
}
.wf-func-params.wf-tbl-params .wf-op-group { display: block; margin-right: 0; white-space: normal; }
.wf-func-params.wf-tbl-params .wf-num { width: 64px; }
.wf-func-params.wf-tbl-params .wf-op-group > select { margin-left: 4px; }
.wf-func-params.wf-tbl-params .wf-op-hint { margin-top: 4px; }
.wf-func-params.wf-tbl-params .wf-op-label { display: inline-block; min-width: 56px; color: #6b7480; }
