:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --border: #e3e6eb;
  --text: #1f2430;
  --muted: #6b7280;
  --primary: #0379b6;
  --primary-soft: #e0f2fb;
  --success: #0f6e56;
  --success-soft: #e1f5ee;
  --warn: #854f0b;
  --warn-soft: #faeeda;
  --danger: #a32d2d;
  --danger-soft: #fcebeb;
  --radius: 10px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.6 "PingFang SC", "Microsoft YaHei", system-ui, sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary); text-decoration: none; }
.hidden { display: none !important; }
.boot { padding: 60px; text-align: center; color: var(--muted); }

.layout { display: flex; min-height: 100vh; }
.sidebar { width: 220px; flex: 0 0 220px; background: #fff; border-right: 1px solid var(--border); padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { padding: 4px 10px 16px; border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.brand b { display: block; font-size: 16px; }
.brand span { font-size: 11px; color: var(--muted); }
.nav-group { font-size: 11px; color: var(--muted); padding: 14px 10px 6px; letter-spacing: .05em; }
.nav-item { display: flex; align-items: center; gap: 8px; padding: 9px 10px; border-radius: 8px; cursor: pointer; color: #374151; }
.nav-item:hover { background: #f3f4f6; }
.nav-item.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--danger); margin-left: auto; }
.main { flex: 1; min-width: 0; }
.topbar { height: 58px; background: #fff; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 26px; position: sticky; top: 0; z-index: 5; }
.topbar h2 { font-size: 16px; margin: 0; font-weight: 600; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }
.content { padding: 22px 26px 60px; }

.btn { border: 1px solid var(--border); background: #fff; border-radius: 7px; padding: 7px 13px; cursor: pointer; }
.btn:hover { border-color: #b8bec9; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { opacity: .9; }
.btn.danger { color: var(--danger); border-color: #e6b8b8; }
.btn.sm { padding: 4px 9px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 20px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.card .label { color: var(--muted); font-size: 12px; }
.card .value { font-size: 25px; font-weight: 600; margin-top: 6px; }
.card .hint { font-size: 12px; color: var(--muted); margin-top: 2px; }
.card.accent { border-left: 3px solid var(--primary); }
.card.alert { border-left: 3px solid var(--danger); }
.card.good { border-left: 3px solid var(--success); }

/* 订单详情头部：业务编号 + 实际金额PI / 信用证短号 / 客户单号 标签 */
.id-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.id-tag { display: inline-flex; align-items: baseline; gap: 5px; font-size: 12px; line-height: 1.6; color: #374151; background: #f3f5f9; border: 1px solid #e8ecf2; border-radius: 8px; padding: 2px 8px; white-space: nowrap; }
.id-tag i { font-style: normal; font-size: 10.5px; color: var(--muted); }
.id-tag.lc { background: #eef4ff; border-color: #d7e4fb; color: #1d4ed8; }
.id-tag.lc b { font-weight: 700; }
/* 列表里的信用证短号小标签 */
.lc-badge { display: block; width: fit-content; margin-top: 3px; font-size: 10.5px; line-height: 1.5; color: #1d4ed8; background: #eef4ff; border-radius: 6px; padding: 0 5px; }
/* 订单列表：信用证独立列（短号 + 开证行缩写），手机端叠在业务编号下 */
.lc-cell { white-space: nowrap; }
.lc-pill { display: inline-block; font-size: 10.5px; line-height: 1.5; color: #1d4ed8; background: #eef4ff; border-radius: 6px; padding: 0 5px; }
.bank-abbr { font-style: normal; margin-left: 5px; font-size: 10.5px; color: var(--muted); }
.lc-none { color: var(--muted); }
.order-cell .cell-sub { font-size: 10.5px; color: var(--muted); font-weight: 400; }
/* 提示条：多张 LC 建议拆分 */
.notice { margin: 0; padding: 9px 14px; font-size: 12.5px; line-height: 1.65; border-bottom: 1px solid var(--border); }
.notice.warn { background: #fff8e6; color: #8a5a00; }
.notice .btn { margin-left: 8px; vertical-align: middle; }
/* 信用证面板内的发运批次小节 */
.sub-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 14px; border-top: 1px solid var(--border); font-size: 13px; font-weight: 600; }
.sub-head .small { font-weight: 400; }
.sub-head .btn { margin-left: auto; }
.lc-kv { padding: 0; }
@media (max-width: 760px) {
  /* 订单头部：业务编号卡与最后一张卡占满整行，标签有位置一行排开 */
  .order-head > .card:first-child, .order-head > .card:last-child { grid-column: 1 / -1; }
}

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 18px; overflow: hidden; }
.panel-head { padding: 13px 18px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; font-weight: 600; }
.panel-body { padding: 16px 18px; }
.panel-body.tight { padding: 0; }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 500; padding: 10px 14px; background: #fafbfc; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 10px 14px; border-bottom: 1px solid #f0f1f3; font-size: 13px; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafbfc; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; background: #f1f3f5; color: #4b5563; }
.tag.blue { background: var(--primary-soft); color: var(--primary); }
.tag.green { background: var(--success-soft); color: var(--success); }
.tag.amber { background: var(--warn-soft); color: var(--warn); }
.tag.red { background: var(--danger-soft); color: var(--danger); }
.bar { height: 6px; border-radius: 3px; background: #eceff3; overflow: hidden; min-width: 70px; }
.bar > i { display: block; height: 100%; background: var(--primary); }

.mask { position: fixed; inset: 0; background: rgba(15,23,42,.45); display: flex; align-items: center; justify-content: center; z-index: 50; }
.login-card { background: #fff; padding: 30px 34px; border-radius: 14px; width: 380px; }
.login-card h1 { font-size: 20px; margin: 0 0 4px; }
.modal { background: #fff; border-radius: 12px; width: min(680px, 92vw); max-height: 86vh; overflow-y: auto; padding: 22px 24px; }
.modal.wide { width: min(1080px, 97vw); }
.doc-scroll { background: #eceff3; border-radius: 8px; padding: 10px; max-height: 64vh; overflow: auto; }
.doc-scroll .df-page { box-shadow: 0 1px 6px rgba(0, 0, 0, .14); }
@media (max-width: 760px) { .doc-scroll { padding: 6px; max-height: 66vh; } }
.modal h3 { margin: 0 0 16px; font-size: 16px; }
.field { margin-bottom: 13px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.field input, .field select, .field textarea { width: 100%; border: 1px solid var(--border); border-radius: 7px; padding: 8px 10px; background: #fff; outline: none; }
.field input:focus, .field textarea:focus { border-color: var(--primary); }
.field textarea { min-height: 100px; resize: vertical; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.toast { position: fixed; right: 22px; bottom: 22px; background: #1f2937; color: #fff; padding: 10px 16px; border-radius: 8px; z-index: 80; font-size: 13px; }
.empty { padding: 34px; text-align: center; color: var(--muted); }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 14px 22px; border-left: 1px solid var(--border); margin-left: 6px; }
.timeline li:last-child { border-left-color: transparent; }
.timeline li::before { content: ""; position: absolute; left: -5px; top: 5px; width: 9px; height: 9px; border-radius: 50%; background: var(--primary); }
.timeline li.done::before { background: var(--success); }
.timeline b { font-weight: 600; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.tab { padding: 8px 14px; cursor: pointer; border-bottom: 2px solid transparent; color: var(--muted); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.split.doc-split { grid-template-columns: minmax(0, .78fr) minmax(0, 1.35fr); align-items: start; }
.kv { display: grid; grid-template-columns: minmax(110px, max-content) 1fr; gap: 6px 10px; font-size: 13px; }
.kv .k { color: var(--muted); }
pre.doc { white-space: pre-wrap; background: #fafbfc; border: 1px solid var(--border); border-radius: 8px; padding: 14px; font: 12px/1.7 ui-monospace, monospace; max-height: 360px; overflow: auto; }
.tpl-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 0; border-top: 1px solid var(--border); }
.tpl-row:first-child { border-top: 0; }

/* 单据模板库：卡片网格，标题 + 字段标签 + 操作 */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; padding: 12px 14px; }
.tpl-card { display: flex; flex-direction: column; gap: 8px; padding: 12px 13px; border: 1px solid var(--border); border-radius: 10px; background: #fff; }
.tpl-card-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.tpl-card-top b { font-size: 13.5px; line-height: 1.3; }
.tpl-count { flex: 0 0 auto; font-size: 11px; color: var(--muted); }
.tpl-chips { display: flex; flex-wrap: wrap; gap: 4px 6px; }
.tpl-chip { font-size: 11.5px; line-height: 1.6; color: #4b5563; background: #f3f5f9; border-radius: 999px; padding: 1px 8px; white-space: nowrap; }
.tpl-card-ops { display: flex; gap: 8px; margin-top: auto; padding-top: 2px; }
.tpl-card-ops .btn { flex: 0 1 auto; }

/* 业务文件档案：日期/按钮不折行，文件名与备注允许换行并限宽 */
.doc-file-table td, .doc-file-table th { white-space: nowrap; }
.doc-file-table td.wrap { white-space: normal; min-width: 130px; }
.doc-file-table td.wrap a { display: inline-block; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }
.doc-file-table td.ops { white-space: nowrap; }
@media (max-width: 760px) {
  /* 手机端只留 文件类型 / 文件名 / 日期 / 操作，避免表格又宽又高 */
  .doc-file-table { min-width: 0; }
  .doc-file-table th:nth-child(1), .doc-file-table td:nth-child(1),
  .doc-file-table th:nth-child(3), .doc-file-table td:nth-child(3),
  .doc-file-table th:nth-child(5), .doc-file-table td:nth-child(5),
  .doc-file-table th:nth-child(6), .doc-file-table td:nth-child(6) { display: none; }
  .doc-file-table td, .doc-file-table th { padding: 8px 5px; font-size: 11.5px; vertical-align: top; }
  .doc-file-table th { vertical-align: bottom; }
  .doc-file-table td.wrap { min-width: 0; }
  .doc-file-table td.wrap a { max-width: 40vw; }
  .doc-file-table td.ops .btn { padding: 4px 6px; font-size: 11px; }
}
.timeline li.stage-item { cursor: pointer; border-radius: 6px; transition: background .15s; }
.timeline li.stage-item:hover { background: #f2f7fd; }
.timeline li.stage-item .tag { font-size: 11px; margin-left: 4px; }
@media (max-width: 900px) { .sidebar { width: 180px; flex-basis: 180px; } .split { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  .layout { display: block; }
  .sidebar { width: 100%; height: auto; position: static; padding: 10px 12px; border-right: 0; border-bottom: 1px solid var(--border); white-space: nowrap; overflow-x: auto; }
  .brand { display: inline-block; border-bottom: 0; padding: 0 14px 6px 0; margin: 0; vertical-align: middle; }
  .brand b { font-size: 14px; }
  .brand span { font-size: 10px; }
  .nav-group { display: none; }
  .nav-item { display: inline-flex; padding: 7px 10px; margin-right: 4px; font-size: 13px; vertical-align: middle; }
  .sidebar > div:last-child { display: inline-block; margin: 0 0 0 10px; padding: 0; vertical-align: middle; }
  .topbar { height: 50px; padding: 0 14px; }
  .topbar h2 { font-size: 15px; }
  .content { padding: 14px 12px 40px; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .card { padding: 12px 13px; }
  .card .value { font-size: 20px; }
  .split { grid-template-columns: 1fr; gap: 12px; }
  .panel { margin-bottom: 12px; }
  .panel-head { padding: 11px 13px; font-size: 13px; }
  .panel-body { padding: 12px 13px; }
  .panel-body.tight { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { min-width: 640px; }
  th, td { padding: 8px 10px; font-size: 12px; }
  .grid2 { grid-template-columns: 1fr; }
  .modal { width: 96vw; max-height: 92vh; padding: 18px 16px; }
  .login-card { width: 92vw; padding: 24px 20px; }
  .timeline li { padding-bottom: 10px; }
  pre.doc { font-size: 11px; }
}
@media (max-width: 420px) {
  .cards { grid-template-columns: 1fr 1fr; }
  .card .value { font-size: 18px; }
  .topbar-actions .btn.sm { padding: 3px 7px; }
}

/* ---------- 移动端：底部标签栏（≤760px 生效） ---------- */
.tabbar { display: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; font-weight: 600; font-size: 15px; padding: 4px 2px 12px; }
.sheet-group { font-size: 12px; color: var(--muted); padding: 14px 4px 6px; letter-spacing: .03em; }
.sheet-list { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: #fff; }
.sheet-list > button { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; padding: 13px 14px; border: 0; border-top: 1px solid var(--border); background: none; font-size: 14px; text-align: left; cursor: pointer; }
.sheet-list > button:first-child { border-top: 0; }
.sheet-list > button:active { background: #f2f6fa; }
.sheet-list .chev { color: #c3c8d0; font-size: 17px; }

@media (max-width: 760px) {
  .sidebar { display: none !important; }
  .layout { display: block; }
  .content { padding: 12px 12px calc(84px + env(safe-area-inset-bottom)); }
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
    background: rgba(255,255,255,.97); backdrop-filter: blur(8px);
    border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom);
  }
  .tab-item {
    position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px; padding: 7px 0 6px; border: 0; background: none; color: #6b7280; font-size: 11px; line-height: 1; cursor: pointer;
  }
  .tab-item svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
  .tab-item.active { color: var(--primary); font-weight: 600; }
  .tab-item.active svg { stroke-width: 2; }
  .tab-dot { position: absolute; top: 5px; left: 56%; background: var(--danger); color: #fff; font-size: 10px; font-style: normal; line-height: 1; padding: 2px 4px; border-radius: 999px; }
  .toast { left: 12px; right: 12px; bottom: calc(76px + env(safe-area-inset-bottom)); text-align: center; }
  .topbar { height: 52px; padding: 0 12px; gap: 8px; }
  .topbar h2 { font-size: 15px; }
  .topbar-actions { gap: 6px; }
  #reload-btn { display: none; }
  .topbar-actions .btn.sm { padding: 5px 9px; }
  .modal-mask { align-items: flex-end; }
  .modal, .modal.wide {
    width: 100%; max-width: 100%; border-radius: 16px 16px 0 0; max-height: 92vh;
    padding: 18px 14px calc(14px + env(safe-area-inset-bottom));
  }
  .modal-actions { position: sticky; bottom: calc(-1 * env(safe-area-inset-bottom)); background: #fff; padding: 10px 0 2px; margin-top: 14px; flex-wrap: wrap; }
  .modal-actions .btn { flex: 1 1 30%; min-width: 92px; padding: 9px 8px; font-size: 13px; }
  .doc-scroll { padding: 4px; max-height: 62vh; background: #e9ecef; }
  .doc-scroll .df-page { box-shadow: none; }
  .panel-body.tight { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { min-width: 560px; }
  /* 单据版式不参与表格横向最小宽度，避免 A4 内容被裁切 */
  .df-doc table { min-width: 0; }
  /* 卡片头：标题 / 说明 / 操作 竖排，避免说明被挤成一字一行 */
  .panel-head { display: block; }
  .panel-head .small { display: block; margin-top: 4px; font-weight: 400; line-height: 1.5; }
  .panel-head > span:last-child { display: block; margin-top: 8px; }
  .panel-head > span:last-child .btn { margin-right: 6px; }
  .tpl-row { gap: 6px 8px; }
  .tpl-row .btn { flex: 0 1 auto; }
  /* 模板行：名称独占一行，说明换行显示，操作按钮排在下面，避免长文本被挤成一字一行 */
  .tpl-row > b { flex: 0 0 100%; min-width: 0 !important; font-size: 13.5px; }
  .tpl-row > .small { flex: 0 0 100%; line-height: 1.5; }
  .tpl-grid { grid-template-columns: 1fr; gap: 8px; padding: 10px 12px; }
  .tpl-card { padding: 11px 12px; gap: 7px; }
  .tpl-card-ops .btn { flex: 1 1 0; justify-content: center; }
  .modal h3 { font-size: 15px; line-height: 1.4; }
  .modal h3 .small { display: block; font-size: 11px; margin-top: 2px; }
  .sheet-list > button { padding: 11px 14px; }
  .kv { grid-template-columns: minmax(96px, max-content) 1fr; font-size: 12px; }
  .cards { gap: 8px; }
  .card .value { font-size: 19px; }
  .login-card { border-radius: 16px; }
}
@media (max-width: 380px) {
  .tab-item span { font-size: 10px; }
  .card .value { font-size: 17px; }
}

/* 订单页费用表：手机上收起次要列，避免横向溢出 */
@media (max-width: 760px) {
  .exp-table { min-width: 0; }
}

/* 订单页付款表：手机上收起「性质」列，操作按钮紧凑化 */
@media (max-width: 760px) {
  .pay-table th:nth-child(3), .pay-table td:nth-child(3) { display: none; }
  .exp-table .ops .btn { padding: 4px 7px; font-size: 11px; }
}

@media (max-width: 760px) {
  /* 财务二级标签：横向一排可滑动，不再被挤成一字一行 */
  .tabs {
    gap: 2px; margin: 0 -12px 12px; padding: 0 8px;
    overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex: 0 0 auto; white-space: nowrap; padding: 8px; font-size: 13px; }
  .rec-note { flex: 1; min-width: 0; font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* ---------- 手机端记录卡片（替代横表格，一条一行，不再需要横向滑动） ---------- */
.rec-list { display: none; }
.rec-card { padding: 11px 13px; border-top: 1px solid var(--border); }
.rec-card:first-child { border-top: 0; }
.rec-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.rec-row + .rec-row { margin-top: 6px; }
.rec-name { flex: 1; min-width: 0; font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec-amt { font-size: 14px; font-weight: 600; white-space: nowrap; }
.rec-row.small { font-size: 11.5px; gap: 6px; overflow: hidden; }
.rec-row.small span { white-space: nowrap; }
.rec-row.small span:first-child { flex: 0 0 auto; }
.rec-row.small span { overflow: hidden; text-overflow: ellipsis; }
.rec-ops { margin-left: auto; display: flex; gap: 6px; flex: 0 0 auto; }
.rec-ops .btn { padding: 4px 8px; font-size: 11px; }
.rec-row .tag { font-size: 10.5px; padding: 1px 6px; }

@media (max-width: 760px) {
  .rec-list { display: block; }
  .rec-list .empty { padding: 22px; }
  .only-desktop { display: none !important; }
  /* 列表卡片头：标题 + 计数 + 按钮排一行，省掉竖排占位 */
  .panel-head.compact { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: nowrap; }
  .panel-head.compact > span { min-width: 0; margin-top: 0 !important; display: inline; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .panel-head.compact .small { display: inline; margin: 0 0 0 6px; font-weight: 400; }
  .panel-head.compact .btn { flex: 0 0 auto; white-space: nowrap; }
}

/* 财务台账表格：日期/金额/状态/按钮不折行，长附件名截断，避免桌面端被挤成一字一行 */
.tag, td .btn, th .btn { white-space: nowrap; }
.fin-table th { white-space: nowrap; }
.fin-table td { white-space: nowrap; }
.fin-table td.wrap { white-space: normal; min-width: 108px; }
.att-cell { display: inline-block; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }

/* 订单列表：PI 号必须一行显示，客户名用简称 */
.orders-table td.pi-cell { white-space: nowrap; font-size: 12px; letter-spacing: -.1px; }
.orders-table td.nowrap { white-space: nowrap; }
.orders-table td.cust-cell { white-space: nowrap; font-weight: 600; }
@media (max-width: 760px) {
  .orders-table { min-width: 0; }
  .orders-table th.hide-sm, .orders-table td.hide-sm { display: none; }
  .orders-table th, .orders-table td { font-size: 12px; padding: 9px 8px; }
  .orders-table td.pi-cell { font-size: 11px; }
  .orders-table td:last-child .btn { padding: 4px 7px; font-size: 11px; }
  .orders-table .order-cell .cell-sub { font-size: 10px; }
  .notice { padding: 9px 12px; font-size: 12px; }
  .notice .btn { display: block; margin: 6px 0 0; }
  .sub-head { padding: 9px 12px; font-size: 12.5px; }
  .sub-head .small { flex: 1 1 100%; order: 3; }
  .ship-table { min-width: 0; }
  .ship-table th, .ship-table td { font-size: 11.5px; padding: 8px 5px; }
  .ship-table th.hide-sm, .ship-table td.hide-sm { display: none; }
  .ship-table td .btn, .ship-table th .btn { padding: 4px 7px; font-size: 11px; }
  /* 工作台待办：手机不横滑，日期挂标题下 */
  .todo-table { min-width: 0; }
  .todo-table th.hide-sm, .todo-table td.hide-sm { display: none; }
  .todo-table th, .todo-table td { font-size: 12px; padding: 9px 8px; }
  .todo-table .cell-sub { font-size: 10.5px; color: var(--muted); margin-top: 2px; }
}

/* 订单台账小结条 */
.ledger-sum { display: flex; flex-wrap: wrap; gap: 4px 20px; padding: 9px 14px; background: #f7f9fc; border-bottom: 1px solid var(--border); font-size: 12.5px; color: #4b5563; }
.ledger-sum b { font-size: 14px; color: #111827; margin-left: 3px; }
.ledger-sum i { font-style: normal; margin-left: 6px; }
.only-mobile { display: none; }

/* 「记一笔」选择卡片 */
.choose-grid { display: grid; gap: 10px; margin: 4px 0 2px; }
.choose-card { text-align: left; border: 1px solid var(--border); border-radius: 12px; background: #fff; padding: 13px 14px; cursor: pointer; }
.choose-card b { display: block; font-size: 14px; margin-bottom: 5px; color: var(--primary); }
.choose-card span { display: block; font-size: 12px; color: var(--muted); line-height: 1.6; }
.choose-card:active { background: #f2f6fa; }

@media (max-width: 760px) {
  .ledger-table th:nth-child(5), .ledger-table td:nth-child(5) { display: none; }
  .only-mobile { display: block; margin-top: 2px; }
  .ledger-sum { gap: 3px 14px; padding: 8px 12px; font-size: 12px; }
  .ledger-sum b { font-size: 13px; }
  .choose-card { padding: 12px; }
}

/* 订单台账：小屏改为「日期 / 类型+摘要 / 金额 / 操作」四列 */
.ledger-table .tag { white-space: nowrap; }
.ledger-table td:first-child, .ledger-table th:first-child { white-space: nowrap; }
@media (max-width: 760px) {
  .ledger-table th:nth-child(3), .ledger-table td:nth-child(3) { display: none; }
  .ledger-table th, .ledger-table td { font-size: 11.5px; padding: 8px 6px; }
  .ledger-table .tag { font-size: 10.5px; padding: 1px 5px; }
  .ledger-table .only-mobile { margin-top: 3px; line-height: 1.35; }
  .ledger-table .ops { white-space: nowrap; }
  .ledger-table .ops .btn { padding: 4px 6px; font-size: 11px; }
}

@media (max-width: 760px) {
  /* 小屏只留「编辑 / 删除」；标记已付款改在编辑表单里设状态 */
  .ledger-table .ops .btn[data-ol-paid] { display: none; }
  .ledger-table td.num, .ledger-table th.num { width: 58px; }
}

/* 水泵订单明细：手机只留 # / 客户型号 / 台数 / 托数 / 备注，避免框内横滑 */
.pump-table td, .pump-table th { vertical-align: top; }
@media (max-width: 760px) {
  .pump-table { min-width: 0; }
  .pump-table th:nth-child(2), .pump-table td:nth-child(2),
  .pump-table th:nth-child(4), .pump-table td:nth-child(4),
  .pump-table th:nth-child(5), .pump-table td:nth-child(5) { display: none; }
  .pump-table th, .pump-table td { font-size: 11.5px; padding: 8px 6px; }
  .pump-table td .tag { font-size: 10px; padding: 1px 5px; }
}

/* 发货明细（装柜实数）编辑弹窗 */
.sd-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin: 10px 0; }
.sd-grid label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: #4b5563; }
.sd-grid input { padding: 7px 9px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; }
.sd-same { display: flex; align-items: center; gap: 6px; font-size: 13px; margin: 8px 0; }
.sd-table { width: 100%; border-collapse: collapse; margin: 4px 0 8px; }
.sd-table th, .sd-table td { border-bottom: 1px solid var(--border); padding: 6px 4px; font-size: 12.5px; text-align: left; }
.sd-table th { color: #6b7280; font-weight: 600; white-space: nowrap; }
.sd-table input { width: 100%; min-width: 64px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 7px; font-size: 12.5px; box-sizing: border-box; }
.sd-table td:first-child input, .sd-table td:nth-child(2) input { min-width: 110px; }
.sd-table .num input { text-align: right; }
.sd-table .empty { text-align: center; color: var(--muted); padding: 14px; }
@media (max-width: 760px) {
  .sd-grid { grid-template-columns: 1fr 1fr; }
  .ship-table td.ops, .ship-table th.ops { white-space: nowrap; }
  .ship-table .ops .btn { padding: 4px 6px; font-size: 10.5px; }
}

/* 提单 / CO 草稿在弹窗里的预览：与打印版同一套框线 */
.modal table.b { border-collapse: collapse; width: 100%; margin: 0; }
.modal table.b td { border: 1px solid #555; font-size: 12px; padding: 5px 8px; vertical-align: top; line-height: 1.5; }
.modal table.b td.lab { background: #f3f5f8; font-weight: 700; color: #374151; }

/* 可折叠面板（旧版模板库等） */
.panel.fold { overflow: hidden; }
.panel.fold > summary { cursor: pointer; list-style: none; user-select: none; }
.panel.fold > summary::-webkit-details-marker { display: none; }
.panel.fold > summary::after { content: "展开 ▾"; margin-left: auto; font-size: 12px; color: var(--muted); }
.panel.fold[open] > summary::after { content: "收起 ▴"; }
.panel.fold > .tpl-grid { padding: 12px 16px 16px; }

/* 可折叠面板的标题靠左紧凑排列（右侧只留展开/收起） */
.panel.fold > summary { justify-content: flex-start; gap: 8px; }
.panel.fold > summary > .small { font-weight: 400; }
.panel.fold > .panel-body { border-top: 0; }

/* ---------- 附件：类型徽标 / 缩略图 / 预览弹窗 ---------- */
.file-chip { display: inline-flex; align-items: center; gap: 7px; max-width: 100%; color: inherit; }
.file-chip:hover .file-chip-name { color: var(--primary); text-decoration: underline; }
.file-chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 240px; }
.fic { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; flex: 0 0 auto;
  border-radius: 6px; font: 700 9px/1 Arial, sans-serif; letter-spacing: .3px; color: #fff; background: #94a3b8; }
.fic.pdf { background: #dc2626; }
.fic.img { background: #0ea5e9; }
.fic.doc { background: #2563eb; }
.fic.xls { background: #16a34a; }
.fic.file { background: #94a3b8; }
.fic.lg { width: 34px; height: 34px; border-radius: 8px; font-size: 11px; }
.fic.xl { width: 64px; height: 64px; border-radius: 12px; font-size: 16px; }
.fthumb { width: 24px; height: 24px; flex: 0 0 auto; border-radius: 6px; object-fit: cover; border: 1px solid var(--border); background: #fff; }
.fthumb.lg { width: 34px; height: 34px; border-radius: 8px; }

.att-meta { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 9px; background: #fafbfc; margin-bottom: 12px; }
.att-meta-txt { display: flex; flex-direction: column; min-width: 0; }
.att-meta-txt b { font-size: 13px; word-break: break-all; }
.att-view { text-align: center; background: #f3f4f6; border: 1px solid var(--border); border-radius: 10px; padding: 10px; }
.att-view img { max-width: 100%; max-height: 62vh; border-radius: 6px; }
.att-frame { width: 100%; height: 60vh; border: 1px solid var(--border); border-radius: 10px; background: #fff; }
.att-hint { margin-bottom: 6px; }
.att-fallback { text-align: center; padding: 34px 20px; border: 1px dashed var(--border); border-radius: 10px; background: #fafbfc; }
.att-fallback b { display: block; margin: 12px 0 6px; word-break: break-all; }
.att-fallback p { margin: 0; line-height: 1.7; }

/* ---------- 单据中心：未选订单 / 订单选择器 ---------- */
.doc-order-sel { min-width: 300px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--card, #fff); color: var(--text); }
.doc-gate { text-align: center; padding: 40px 16px 44px; }
.doc-gate-ic { font-size: 40px; display: block; margin-bottom: 6px; filter: grayscale(.2); }
.doc-gate > b { display: block; font-size: 16px; margin-bottom: 8px; }
.doc-gate p { margin: 0 auto 18px; max-width: 560px; line-height: 1.8; }
.doc-gate-pick { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: center; }
.doc-gate-pick .btn { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 开证行单据清单两行截断 */
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
/* 制单记录：折叠的其余记录 */
.doc-more-row td { text-align: center; padding: 10px 0 2px; }
.doc-more-row:hover { background: transparent; }
@media (max-width: 760px) {
  .doc-order-sel { min-width: 0; width: 100%; margin-top: 8px; }
}
@media (max-width: 760px) {
  .panel.fold > summary { position: relative; padding-right: 70px; }
  .panel.fold > summary::after { position: absolute; right: 13px; top: 12px; margin: 0; }
  .file-chip-name { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; max-width: 190px; }
  .att-frame { height: 55vh; }
}

/* ---------- 信用证识别 ---------- */
.lc-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; border-top: 1px solid var(--border); background: #fafbfc; }
.lc-bar-l { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.lc-bar-l .k { color: var(--muted); font-size: 12px; }
.lc-pill-inline { font-size: 13px; padding: 1px 7px; border-radius: 6px; background: var(--primary-soft); color: var(--primary); }
.lc-bar-r { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.lc-res { border: 1px solid var(--border); border-radius: 9px; padding: 10px 12px; background: #fafbfc; display: grid; gap: 6px; }
.lc-res-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.lc-res-line .k { color: var(--muted); min-width: 72px; font-size: 12px; }
.lc-block { margin-top: 12px; }
.lc-block-h { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.lc-chips { display: flex; flex-wrap: wrap; gap: 6px; max-height: 190px; overflow: auto; }
.lc-chip { font-size: 12px; line-height: 1.5; padding: 3px 8px; border-radius: 7px; background: #f1f3f5; color: #374151; }
@media (max-width: 760px) {
  .lc-bar { align-items: flex-start; }
  .lc-bar-r { width: 100%; justify-content: space-between; }
}

/* ---------- 附件预览：PDF 自绘查看器 ---------- */
.pdf-shell { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: #f3f4f6; }
.pdf-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 7px 10px; background: #fff; border-bottom: 1px solid var(--border); }
.pdf-grp { display: inline-flex; align-items: center; gap: 6px; }
.pdf-grp .btn.sm { min-width: 30px; padding: 4px 8px; line-height: 1.2; }
.pdf-grp span.small { min-width: 62px; text-align: center; }
.pdf-stage { max-height: 64vh; overflow: auto; padding: 12px; display: flex; justify-content: flex-start; align-items: flex-start; }
.pdf-canvas { background: #fff; box-shadow: 0 2px 10px rgba(15, 23, 42, .14); border-radius: 2px; max-width: none; margin: 0 auto; }

/* PDF 弹窗：整体撑满视口高度，只有画布区域滚动，底部按钮始终可见 */
.modal.pdf-modal { display: flex; flex-direction: column; overflow: hidden; height: min(88vh, 1040px); }
.modal.pdf-modal h3, .modal.pdf-modal .att-meta, .modal.pdf-modal .modal-actions { flex: 0 0 auto; }
.modal.pdf-modal .modal-actions { margin-top: 12px; }
.modal.pdf-modal .pdf-shell { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.modal.pdf-modal .pdf-bar { flex: 0 0 auto; }
.modal.pdf-modal .pdf-stage { flex: 1 1 auto; min-height: 0; max-height: none; }
@media (max-width: 760px) {
  .pdf-stage { max-height: 58vh; padding: 8px; }
  .pdf-bar { padding: 6px 8px; gap: 6px; }
  .pdf-grp span.small { min-width: 50px; }
}
