* { box-sizing: border-box; }
:root{
  --bg:#f5f7fa; --panel:#ffffff; --border:#e3e8ef; --text:#1f2937; --muted:#6b7280;
  --primary:#2563eb; --primary-hover:#1d4ed8; --danger:#dc2626; --success:#059669;
  --warn:#d97706; --shadow:0 1px 3px rgba(16,24,40,.08),0 1px 2px rgba(16,24,40,.04);
}
html,body{ margin:0; padding:0; height:100%; }
body{ font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Microsoft YaHei",sans-serif; background:var(--bg); color:var(--text); font-size:13px; }
a{ color:var(--primary); text-decoration:none; }
button,input,select,textarea{ font-family:inherit; font-size:13px; }

/* 布局 */
.app{ display:flex; height:100vh; overflow:hidden; }
.sidebar{ width:190px; flex:0 0 190px; background:#111827; color:#d1d5db; display:flex; flex-direction:column; }
.logo{ height:56px; display:flex; align-items:center; padding:0 18px; font-size:16px; font-weight:700; color:#fff; border-bottom:1px solid #1f2937; }
.logo span{ color:#60a5fa; }
.nav{ padding:10px 0; }
.nav-group-title{ padding:10px 18px 6px; font-size:11px; letter-spacing:1px; color:#6b7280; font-weight:600; }
.nav-group-title--second{ margin-top:10px; padding-top:14px; border-top:1px solid #1f2937; }
.nav-item{ display:block; padding:11px 18px; color:#d1d5db; cursor:pointer; border-left:3px solid transparent; }
.nav-item:hover{ background:#1f2937; color:#fff; }
.nav-item.active{ background:#1e3a8a; color:#fff; border-left-color:#60a5fa; }
.main{ flex:1; min-width:0; display:flex; flex-direction:column; }
.topbar{ height:56px; flex:0 0 56px; background:#fff; border-bottom:1px solid var(--border); display:flex; align-items:center; padding:0 20px; gap:12px; }
.topbar h1{ font-size:16px; margin:0; font-weight:600; }
.content{ flex:1; overflow:auto; padding:16px; }
.page{ display:none; }
.page.active{ display:block; }
.settings-stack{ display:flex; flex-direction:column; gap:28px; }

/* 通用面板 */
.panel{ background:var(--panel); border:1px solid var(--border); border-radius:8px; box-shadow:var(--shadow); }
.panel-head{ padding:12px 16px; border-bottom:1px solid var(--border); display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
/* 订单页顶部状态栏滚动时固定在顶部；表头 top 跟随其高度（--orderHeadH 由 JS 测量） */
#orderPanelHead{ position:sticky; top:0; z-index:6; background:var(--panel); border-radius:8px 8px 0 0; }
/* 订单表格自身不要成为滚动容器：否则表头 sticky 相对 #orderTableWrap，
   滚动 .content 时会随表格上移、钻到状态栏下方导致表头错位。改为与状态栏共用 .content 作参照 */
#orderTableWrap{ overflow:visible; }
#page-orders thead th{ top:var(--orderHeadH, 0px); }
/* 客户管理：搜索栏与表头一起固定；容器不自建滚动，均相对 .content */
#customerPanelHead{ position:sticky; top:0; z-index:6; background:var(--panel); border-radius:8px 8px 0 0; }
#customerTableWrap{ overflow:visible; }
#page-customers thead th{ top:var(--customerHeadH, 0px); }
/* 新增「订单数」列后，轻微收紧客户表水平内边距，保证桌面 12 列仍不撑出面板（overflow:visible 需容器包住表格） */
#page-customers th,#page-customers td{ padding:8px 8px; }
/* 发票管理：搜索栏与表头一起固定 */
#invoicePanelHead{ position:sticky; top:0; z-index:6; background:var(--panel); border-radius:8px 8px 0 0; }
#invoiceTableWrap{ overflow:visible; }
#page-invoices thead th{ top:var(--invoiceHeadH, 0px); }
/* 账单记录：搜索栏与表头一起固定 */
#billPanelHead{ position:sticky; top:0; z-index:6; background:var(--panel); border-radius:8px 8px 0 0; }
#billTableWrap{ overflow:visible; }
#page-bills thead th{ top:var(--billHeadH, 0px); }
#page-bills td:nth-child(8){ white-space:normal; min-width:180px; max-width:320px; color:var(--muted); }
.bill-invoice-cell{ white-space:normal; }
.bill-invoice-thumb{ width:34px; height:34px; object-fit:cover; border-radius:4px; border:1px solid var(--line,#e5e7eb); vertical-align:middle; cursor:pointer; }
.bill-invoice-thumb:hover{ opacity:.8; }
/* 账单详情弹窗内的发票区块 */
.bill-detail-invoice{ margin-top:16px; border-top:1px dashed var(--border); padding-top:14px; }
.bill-invoice-head{ display:flex; align-items:center; gap:10px; margin-bottom:10px; }
.bill-invoice-head .muted{ font-size:12px; }
.bill-invoice-upload{ display:flex; align-items:center; gap:8px; flex-wrap:wrap; margin-top:10px; }
.bill-invoice-upload input[type=file]{ font-size:12px; }
/* 蓝思兑换 */
#lansiPanelHead{ position:sticky; top:0; z-index:6; background:var(--panel); border-radius:8px 8px 0 0; }
#lansiTableWrap{ overflow:visible; }
#page-lansi thead th{ top:var(--lansiHeadH, 0px); }
#page-lansi td:nth-child(6){ white-space:normal; min-width:140px; max-width:260px; }
#page-lansi td:nth-child(9){ white-space:normal; min-width:140px; max-width:220px; }
.btn-success{ background:#059669; border-color:#059669; color:#fff; }
.btn-success:hover{ background:#047857; border-color:#047857; }
.panel-body{ padding:14px 16px; }
.toolbar{ display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.tabs{ display:flex; gap:4px; background:#eef2f7; padding:3px; border-radius:7px; }
.tab{ padding:6px 14px; border-radius:5px; cursor:pointer; color:var(--muted); white-space:nowrap; }
.tab.active{ background:#fff; color:var(--primary); font-weight:600; box-shadow:var(--shadow); }
.input,.select,.textarea{ border:1px solid var(--border); border-radius:6px; padding:7px 10px; background:#fff; color:var(--text); outline:none; }
.input:focus,.select:focus,.textarea:focus{ border-color:var(--primary); box-shadow:0 0 0 2px rgba(37,99,235,.12); }
.textarea{ resize:vertical; min-height:70px; width:100%; }
.btn{ border:1px solid var(--border); background:#fff; color:var(--text); padding:7px 14px; border-radius:6px; cursor:pointer; white-space:nowrap; }
.btn:hover{ border-color:#c7d2fe; background:#f8fafc; }
.btn-primary{ background:var(--primary); border-color:var(--primary); color:#fff; }
.btn-primary:hover{ background:var(--primary-hover); border-color:var(--primary-hover); }
.btn-danger{ color:var(--danger); }
.btn-sm{ padding:4px 9px; font-size:12px; }
.btn:disabled{ opacity:.5; cursor:not-allowed; }
.link{ color:var(--primary); cursor:pointer; }
.link-danger{ color:var(--danger); cursor:pointer; }
.muted{ color:var(--muted); }
.right{ margin-left:auto; }
.badge{ padding:2px 8px; border-radius:10px; font-size:12px; display:inline-block; }
.badge-gray{ background:#f1f5f9; color:#64748b; }
.badge-blue{ background:#dbeafe; color:#1d4ed8; }
.badge-green{ background:#d1fae5; color:#047857; }
.badge-red{ background:#fee2e2; color:#b91c1c; }
.badge-amber{ background:#fef3c7; color:#b45309; }

/* 表格 */
.table-wrap{ width:100%; overflow:auto; }
table{ border-collapse:separate; border-spacing:0; width:100%; white-space:nowrap; }
th,td{ border-bottom:1px solid var(--border); padding:8px 10px; text-align:left; }
thead th{ background:#f8fafc; position:sticky; top:0; z-index:2; font-weight:600; color:#475569; }
/* 固定栏与表头滚动时不透出数据行文字：固定栏向上盖住内容区顶部留白，表头向下盖住接缝 */
#orderPanelHead,#customerPanelHead,#invoicePanelHead,#billPanelHead,#lansiPanelHead{ box-shadow:0 -24px 0 0 var(--bg); }
thead th{ box-shadow:0 3px 0 0 #f8fafc; }
tbody tr:hover td{ background:#f8fbff; }
/* 可勾选订单（未结算）整行可点，显示手型光标 */
tbody tr.checkable{ cursor:pointer; }
/* 选中某个用户后，其他用户的行不可勾选 */
tbody tr.locked-row{ cursor:default; }
tbody tr.locked-row:hover td{ background:transparent; }
.row-check:disabled{ opacity:.45; cursor:not-allowed; }
/* 客户管理：返利额度 30% 的行用淡金色背景；其余行白色/浅色交替 */
tbody tr.stripe-row td{ background:#f7f9fc; }
tbody tr.stripe-row:hover td{ background:#eef3f9; }
tbody tr.gold-row td{ background:#fdf6e3; }
tbody tr.gold-row:hover td{ background:#faf0cf; }
/* 已结算订单：两种背景色交替区分相邻批次（背景设在 tr 上，td 继承） */
tbody tr.settled td{ background:transparent; }
tbody tr.batch-color-0{ background:#eef6ff; }
tbody tr.batch-color-1{ background:#effaf3; }
tbody tr.settled:hover{ filter:brightness(0.97); }
td.match{ background:inherit !important; border-right:1px solid #cbd5e1; text-align:center; vertical-align:middle; }
/* 拼团中已录入订单的合计栏：金额上方显示订单数 */
.user-total-count{ font-size:11px; font-weight:400; color:var(--muted); margin-bottom:2px; }
/* 表头 match 列必须保持不透明底色，否则 sticky 滚动时数据行会透过表头显示 */
th.match{ background:#f8fafc; border-right:1px solid #cbd5e1; text-align:center; vertical-align:middle; }
td.remark-cell{ white-space:normal; min-width:180px; max-width:280px; color:var(--muted); }
/* 未结算订单：成团人数可点击内联编辑 */
td.people-cell{ cursor:pointer; color:#2563eb; font-weight:600; }
td.people-cell:hover{ background:#fff7ed !important; }
td.people-cell input.people-input{ width:100%; box-sizing:border-box; padding:3px 5px; border:1px solid #2563eb; border-radius:4px; font-size:13px; }
.empty{ padding:60px 20px; text-align:center; color:var(--muted); }
.stat{ font-size:12px; color:var(--muted); }

/* 弹窗 */
.modal-mask{ position:fixed; inset:0; background:rgba(15,23,42,.45); display:none; align-items:center; justify-content:center; z-index:50; padding:20px; }
.modal-mask.show{ display:flex; }
.modal{ background:#fff; border-radius:10px; width:640px; max-width:100%; max-height:90vh; display:flex; flex-direction:column; box-shadow:0 20px 40px rgba(0,0,0,.2); }
.modal.wide{ width:900px; }
.modal-head{ padding:14px 18px; border-bottom:1px solid var(--border); display:flex; align-items:center; font-weight:600; font-size:15px; }
.modal-head .close{ margin-left:auto; cursor:pointer; color:var(--muted); font-size:20px; line-height:1; }
.modal-body{ padding:18px; overflow:auto; }
.modal-foot{ padding:12px 18px; border-top:1px solid var(--border); display:flex; justify-content:flex-end; gap:8px; }
.form-grid{ display:grid; grid-template-columns:repeat(2,1fr); gap:12px 16px; }
.form-item{ display:flex; flex-direction:column; gap:5px; }
.form-item.full{ grid-column:1 / -1; }
.form-item label{ color:#475569; font-size:12px; }
.form-item .input,.form-item .select{ width:100%; }
/* 开团人：输入文字 → 查询客户 → 点选 */
.cust-picker{ position:relative; }
.cust-results{ display:none; position:absolute; left:0; right:0; top:calc(100% + 2px); background:#fff; border:1px solid var(--border); border-radius:6px; box-shadow:0 8px 24px rgba(0,0,0,.14); max-height:230px; overflow:auto; z-index:30; }
.cust-results.show{ display:block; }
.cust-results .cust-opt{ padding:7px 10px; cursor:pointer; font-size:13px; border-bottom:1px solid #f1f5f9; }
.cust-results .cust-opt:last-child{ border-bottom:none; }
.cust-results .cust-opt:hover,.cust-results .cust-opt.active{ background:#eff6ff; }
.cust-results .cust-opt .cid{ display:block; color:var(--muted); font-size:11px; margin-top:2px; }
.cust-results .cust-empty{ padding:10px; color:var(--muted); font-size:12px; }
.form-section{ grid-column:1 / -1; font-weight:600; color:var(--primary); border-top:1px dashed var(--border); padding-top:12px; margin-top:4px; }
.preview-box{ background:#f8fafc; border:1px solid var(--border); border-radius:6px; padding:12px 12px 0; margin-bottom:14px; max-height:180px; overflow:auto; }
.preview-box .row{ display:flex; justify-content:space-between; padding:3px 0; }
/* 合计行固定在预览区底部：容器底部不留内边距，由合计行自身的不透明背景延伸到滚动区底部，滚动时不透出下方文字 */
.preview-box .total{ position:sticky; bottom:0; z-index:2; background:#f8fafc; box-shadow:0 12px 0 0 #f8fafc; border-top:1px solid var(--border); margin-top:6px; padding:8px 0 12px; font-weight:700; color:var(--danger); }
.remark-list{ max-height:220px; overflow:auto; margin-bottom:10px; }
.remark-item{ display:flex; gap:8px; align-items:flex-start; padding:7px 0; border-bottom:1px dashed var(--border); }
.remark-item .time{ color:var(--muted); font-size:12px; white-space:nowrap; }
.remark-item .txt{ flex:1; white-space:pre-wrap; word-break:break-all; }
.photo-list{ display:flex; flex-wrap:wrap; gap:8px; margin-top:6px; }
.photo-thumb{ position:relative; width:80px; height:100px; }
.photo-thumb img{ width:80px; height:100px; object-fit:cover; border:1px solid var(--border); border-radius:4px; display:block; cursor:pointer; }
.photo-thumb .photo-del{ position:absolute; top:-6px; right:-6px; width:18px; height:18px; line-height:16px; text-align:center; padding:0; border-radius:50%; background:#ef4444; color:#fff; font-size:12px; cursor:pointer; border:none; }
.toast{ position:fixed; top:70px; left:50%; transform:translateX(-50%); background:#111827; color:#fff; padding:10px 18px; border-radius:6px; z-index:100; display:none; box-shadow:var(--shadow); }

/* 登录 */
.login-mask{ position:fixed; inset:0; z-index:200; display:flex; align-items:center; justify-content:center; background:linear-gradient(135deg,#1e3a8a,#0f172a); }
.login-card{ width:360px; background:#fff; border-radius:12px; padding:32px; box-shadow:0 24px 60px rgba(0,0,0,.3); }
.login-logo{ text-align:center; font-size:22px; font-weight:700; }
.login-logo span{ color:var(--primary); }
.login-sub{ text-align:center; color:var(--muted); margin:8px 0 26px; }
.login-card .form-item{ margin-bottom:14px; }
.login-error{ min-height:20px; color:var(--danger); font-size:12px; margin-bottom:6px; }
.login-btn{ width:100%; padding:10px; }
.login-tip{ text-align:center; color:var(--muted); font-size:11px; margin-top:16px; }

/* 顶栏用户菜单 */
.user-menu{ margin-left:16px; position:relative; cursor:pointer; display:flex; align-items:center; gap:6px; }
.user-name{ font-weight:600; }
.user-caret{ color:var(--muted); }
.user-dropdown{ display:none; position:absolute; right:0; top:30px; background:#fff; border:1px solid var(--border); border-radius:8px; box-shadow:0 8px 24px rgba(0,0,0,.12); min-width:150px; padding:4px 0; z-index:20; }
.user-menu.open .user-dropdown{ display:block; }
.user-drop-item{ padding:9px 14px; }
.user-drop-item:hover{ background:#f1f5f9; }
.user-drop-item.danger{ color:var(--danger); border-top:1px solid var(--border); }

/* 结算方式明细列表 */
.settlement-list{ display:flex; flex-direction:column; gap:8px; }
.settlement-item{ border:1px solid var(--border); border-radius:8px; padding:10px 12px; display:flex; align-items:flex-start; gap:12px; background:#fff; }
.settlement-item:hover{ border-color:#c7d2fe; }
.settlement-item .info{ flex:1; min-width:0; line-height:1.7; font-size:12px; }
.settlement-item .badge{ margin-right:6px; }
.settlement-item .muted{ font-size:12px; }

/* 勾选订单后浮动批量结算条 */
.float-settle{ display:none; position:fixed; left:50%; bottom:28px; transform:translateX(-50%); z-index:60;
  align-items:center; gap:14px; background:#1e293b; color:#fff; padding:12px 18px; border-radius:30px;
  box-shadow:0 12px 32px rgba(15,23,42,.35); }
.float-settle.show{ display:flex; }
.float-settle .float-count{ font-size:13px; white-space:nowrap; }
.float-settle .float-count b{ color:#facc15; font-size:16px; }
.float-settle .btn-sm{ padding:5px 12px; }

/* 发票管理 */
.invoice-section{ margin-top:18px; border-top:1px dashed var(--border); padding-top:14px; }
.invoice-section-head{ display:flex; align-items:center; margin-bottom:10px; }
.invoice-item-table{ width:100%; border-collapse:separate; border-spacing:0; }
.invoice-item-table th{ background:#f8fafc; color:#475569; font-size:12px; font-weight:600; text-align:left; padding:6px 8px; border-bottom:1px solid var(--border); }
.invoice-item-table td{ padding:6px 8px; border-bottom:1px solid var(--border); }
.invoice-item-table .input,.invoice-item-table .select{ width:100%; padding:5px 7px; font-size:12px; }
.invoice-attach-list{ display:flex; flex-direction:column; gap:6px; margin-top:8px; }
.invoice-attach-item{ display:flex; align-items:center; gap:10px; border:1px solid var(--border); border-radius:6px; padding:6px 10px; background:#fff; }
.invoice-attach-item .iv-attach-no{ width:300px; flex:none; padding:5px 8px; font-size:12px; }
.invoice-attach-item .link{ flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.invoice-attach-item .btn{ margin-left:auto; }

/* 蓝思兑换：图片缩略图 150×100 */
.ls-thumbs{ display:flex; flex-wrap:wrap; gap:10px; margin-top:10px; }
.ls-thumb{ position:relative; width:150px; height:100px; flex:none; }
.ls-thumb img{ width:150px; height:100px; object-fit:cover; display:block; background:#f8fafc;
  border:1px solid var(--border); border-radius:6px; cursor:zoom-in; }
.ls-thumb img:hover{ border-color:var(--primary); }
.ls-thumb .ls-del-img{ position:absolute; top:-6px; right:-6px; width:20px; height:20px; line-height:18px;
  text-align:center; padding:0; border-radius:50%; background:#dc2626; color:#fff; font-size:12px; cursor:pointer; border:none; }
.ls-thumb-badge{ position:absolute; left:0; top:0; padding:2px 7px; font-size:11px; color:#fff;
  background:rgba(217,119,6,.9); border-radius:5px 0 5px 0; pointer-events:none; }
.ls-thumb-name{ position:absolute; left:0; right:0; bottom:0; padding:3px 6px; font-size:11px; color:#fff;
  background:rgba(15,23,42,.6); border-radius:0 0 5px 5px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; pointer-events:none; }
.ls-thumb-fallback{ display:flex; align-items:center; justify-content:center; width:150px; height:100px;
  padding:8px; font-size:12px; color:var(--muted); background:#f8fafc; border:1px solid var(--border);
  border-radius:6px; overflow:hidden; word-break:break-all; }

/* 蓝思兑换：图片查看器（左右切换） */
.ls-viewer-mask{ z-index:90; background:rgba(15,23,42,.82); }
.ls-viewer{ display:flex; flex-direction:column; width:auto; max-width:min(94vw,1100px); max-height:92vh;
  background:#1f2937; color:#f9fafb; border-radius:10px; box-shadow:0 24px 60px rgba(0,0,0,.45); }
.ls-viewer-head{ display:flex; align-items:center; gap:12px; padding:10px 16px; font-size:14px; font-weight:600;
  border-bottom:1px solid rgba(255,255,255,.12); }
.ls-viewer-count{ font-size:12px; font-weight:400; color:#9ca3af; }
.ls-viewer-head .close{ margin-left:auto; color:#e5e7eb; font-size:22px; cursor:pointer; }
.ls-viewer-head .close:hover{ color:#fff; }
.ls-viewer-stage{ position:relative; display:flex; align-items:center; justify-content:center;
  min-height:220px; padding:14px 62px; touch-action:pan-y; user-select:none; }
.ls-viewer-stage img{ display:block; max-width:min(86vw,960px); max-height:70vh; object-fit:contain;
  border-radius:6px; background:#111827; }
.ls-viewer-nav{ position:absolute; top:50%; transform:translateY(-50%); width:42px; height:58px;
  border:none; border-radius:6px; background:rgba(255,255,255,.14); color:#fff; font-size:30px; line-height:1;
  cursor:pointer; padding:0; }
.ls-viewer-nav:hover{ background:rgba(255,255,255,.3); }
.ls-viewer-nav:disabled{ opacity:.25; cursor:default; }
.ls-viewer-prev{ left:10px; }
.ls-viewer-next{ right:10px; }
.ls-viewer-name{ padding:8px 16px 12px; font-size:12px; color:#9ca3af; text-align:center;
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

/* 问题反馈：附件缩略图（图片 150×100，文件为卡片） */
.fb-files{ display:flex; flex-wrap:wrap; gap:10px; margin-top:10px; }
.fb-file{ position:relative; width:150px; min-height:100px; flex:none; }
.fb-file img{ width:150px; height:100px; object-fit:cover; display:block; background:#f8fafc;
  border:1px solid var(--border); border-radius:6px; cursor:zoom-in; }
.fb-file img:hover{ border-color:var(--primary); }
.fb-file-card{ display:flex; flex-direction:column; align-items:center; justify-content:center; gap:4px;
  width:150px; height:100px; padding:8px; background:#f8fafc; border:1px solid var(--border);
  border-radius:6px; cursor:pointer; text-align:center; word-break:break-all; }
.fb-file-card:hover{ border-color:var(--primary); }
.fb-file-card .fb-file-icon{ font-size:22px; line-height:1; }
.fb-file-card .fb-file-name{ font-size:11px; color:var(--muted); max-height:30px; overflow:hidden; }
.fb-file .fb-del{ position:absolute; top:-6px; right:-6px; width:20px; height:20px; line-height:18px;
  text-align:center; padding:0; border-radius:50%; background:#dc2626; color:#fff; font-size:12px; cursor:pointer; border:none; }
.fb-file .fb-badge{ position:absolute; left:0; top:0; padding:2px 7px; font-size:11px; color:#fff;
  background:rgba(217,119,6,.9); border-radius:5px 0 5px 0; pointer-events:none; }
.fb-file-namebar{ position:absolute; left:0; right:0; bottom:0; padding:3px 6px; font-size:11px; color:#fff;
  background:rgba(15,23,42,.6); border-radius:0 0 5px 5px; overflow:hidden; text-overflow:ellipsis;
  white-space:nowrap; pointer-events:none; }
.fb-viewer-mask{ z-index:90; }
.fb-viewer-foot{ padding:0 16px 12px; text-align:center; font-size:12px; }

/* ==================== 响应式（桌面端默认隐藏以下元素，>=901px 完全保持原布局） ==================== */
.menu-toggle,.sidebar-close,.scroll-tip,.sidebar-backdrop{ display:none; }
.invoice-table-scroll{ width:100%; }
/* --- 更新人数结果弹框 --- */
.sync-summary{ padding:10px 14px; background:var(--bg,#f5f7fa); border-radius:8px; margin-bottom:16px; font-size:14px; }
.sync-summary b{ color:var(--primary,#2563eb); }
.sync-project{ border:1px solid var(--border,#e5e7eb); border-radius:8px; padding:12px 14px; margin-bottom:12px; }
.sync-project-title{ font-weight:600; font-size:15px; margin-bottom:10px; }
.sync-row{ display:flex; align-items:flex-start; gap:10px; margin:8px 0; }
.sync-tag{ flex:none; min-width:64px; text-align:center; padding:3px 8px; border-radius:5px; font-size:13px; color:#fff; }
.sync-tag.ok{ background:#16a34a; }
.sync-tag.fail{ background:#dc2626; }
.sync-nums{ display:flex; flex-wrap:wrap; gap:6px; padding-top:1px; }
.sync-num{ display:inline-block; padding:2px 8px; border-radius:4px; font-size:13px; font-family:monospace; }
.sync-num.ok{ background:#e8f7ee; color:#15803d; }
.sync-num.fail{ background:#fdeaea; color:#b91c1c; }
.sync-none,.sync-empty{ color:var(--muted,#6b7280); font-size:13px; }

/* --- 微信支付配置：按商户号分块 --- */
.wxpay-groups{ padding:14px 16px; display:flex; flex-direction:column; gap:14px; }
.wxpay-group{ border:1px solid var(--border,#e3e8ef); border-radius:8px; overflow:hidden; background:#fff; }
.wxpay-group-head{ display:flex; align-items:center; gap:12px; padding:10px 14px; background:#f6f8fb; border-bottom:1px solid var(--border,#e3e8ef); }
.wxpay-group-no{ font-weight:600; font-size:14px; color:var(--text,#1f2937); }
.wxpay-group-head .muted{ margin-left:auto; font-size:12px; }
.wxpay-table{ min-width:930px; }
.cred-table{ min-width:1050px; }
.wxpay-table td{ white-space:normal; vertical-align:middle; word-break:break-all; }
/* 状态不占用列表列：废弃配置整条置灰 */
.wxpay-row-discarded td{ color:#9ca3af !important; background:#f7f7f8 !important; }
.wxpay-row-discarded:hover td{ background:#f1f2f4 !important; }

/* --- 值班记录：按月分块 --- */
#dutyGroups{ display:grid; grid-template-columns:repeat(auto-fill, minmax(360px, 1fr)); gap:14px; align-items:start; }
.duty-group{ border:1px solid var(--border,#e3e8ef); border-radius:8px; overflow:hidden; background:#fff; }
.duty-group-head{ display:flex; align-items:center; gap:12px; padding:10px 14px; background:#f6f8fb; border-bottom:1px solid var(--border,#e3e8ef); }
.duty-month{ font-weight:600; font-size:14px; color:var(--text,#1f2937); }
.duty-group-head .muted{ margin-left:auto; font-size:12px; }
.duty-table{ width:100%; min-width:0; }
.duty-table td,.duty-table th{ vertical-align:middle; padding:2px 10px; }
.duty-table thead th{ background:#f8fafc; }
.duty-table td.duty-name{ font-weight:600; }
/* festival 类型：仅日期栏淡红色背景，名称/操作栏保持原样 */
.duty-table tr.duty-festival td:first-child{ background:#fdecec; }
.duty-table tr.duty-festival:hover td:first-child{ background:#fbdcdc; }
/* 每月合计行 */
.duty-table tr.duty-total td{ background:#f8fafc; border-top:1px solid var(--border,#e3e8ef); font-weight:600; color:#047857; text-align:left; padding:9px 12px; }
.duty-table tr.duty-total b{ color:var(--danger,#dc2626); }
.wp-pwd-text{ font-family:monospace; letter-spacing:1px; }
.wp-pwd-toggle{ margin-left:8px; font-size:12px; }
.wp-scene-link{ display:inline-block; max-width:100%; overflow:hidden; text-overflow:ellipsis; }
.wp-scene-link .muted{ margin-left:4px; }
.wp-scene-lines{ display:block; }
.wp-scene-line{ display:block; line-height:1.6; }
.wp-modal-scenes{ margin-top:14px; border-top:1px dashed var(--border,#e3e8ef); padding-top:12px; }
.wp-modal-scenes-title{ font-weight:600; color:var(--primary,#2563eb); margin-bottom:8px; }
.wp-modal-scene{ padding:5px 0; border-bottom:1px dashed var(--border,#e3e8ef); word-break:break-all; }
.wxpay-row-discarded .wp-scene-link{ color:#9ca3af !important; }
.wp-pwd-wrap{ display:flex; align-items:center; gap:8px; }
.wp-pwd-wrap .input{ flex:1; min-width:0; }
.wp-merchant-wrap{ position:relative; display:flex; align-items:center; gap:6px; }
.wp-merchant-wrap .input{ flex:1; min-width:0; }
.wp-merchant-wrap .input.wp-merchant-readonly{ background:#f3f4f6; color:var(--muted,#6b7280); cursor:default; }
.wp-merchant-btn{ flex:none; padding:6px 9px; }
.wp-merchant-menu{ display:none; position:absolute; right:0; top:100%; margin-top:4px; min-width:100%; max-height:230px; overflow:auto; background:#fff; border:1px solid var(--border,#e3e8ef); border-radius:6px; box-shadow:0 8px 20px rgba(0,0,0,.12); z-index:30; }
.wp-merchant-menu.show{ display:block; }
.wp-merchant-option{ padding:7px 10px; cursor:pointer; white-space:nowrap; }
.wp-merchant-option:hover{ background:#f1f5f9; }
.wp-merchant-option .muted{ margin-left:6px; font-size:12px; }
.wp-merchant-empty{ padding:8px 10px; color:var(--muted,#6b7280); }
.wp-scene-hint{ margin-bottom:12px; font-size:12px; color:var(--muted,#6b7280); }
.scene-list{ margin-bottom:14px; }
.wp-scene-empty{ padding:10px 0; }
.scene-row{ display:flex; align-items:center; gap:8px; padding:6px 0; border-bottom:1px dashed var(--border,#e3e8ef); }
.scene-row .scene-content{ flex:1; min-width:0; }
.scene-add-row{ display:flex; align-items:center; gap:8px; }
.scene-add-row .input{ flex:1; min-width:0; }

/* 桌面端即使意外带上 .show/.open 也不显示遮罩、不改变侧栏 */
@media (min-width:901px){
  .sidebar-backdrop.show{ display:none !important; }
}

@media (max-width:900px){
  /* --- 整体布局：纵向，内容区独立滚动 --- */
  html,body{ height:100%; }
  .app{ flex-direction:column; height:100vh; height:100dvh; overflow:hidden; }
  .main{ width:100%; min-height:0; }
  /* 纵向由内容区滚动；横向一律禁止整页拖动（表格横向滚动交给 .table-wrap 内部） */
  .content{ flex:1; min-height:0; padding:10px; overflow-x:hidden; overflow-y:auto; -webkit-overflow-scrolling:touch; }
  .panel{ border-radius:6px; }

  /* --- 侧边栏改为抽屉 --- */
  .sidebar{
    position:fixed; top:0; left:0; bottom:0; width:250px; max-width:82vw;
    flex:none; z-index:80; overflow-y:auto; -webkit-overflow-scrolling:touch;
    transform:translateX(-100%); transition:transform .24s ease;
    box-shadow:2px 0 18px rgba(0,0,0,.25);
    padding-top:env(safe-area-inset-top);
  }
  .sidebar.open{ transform:translateX(0); }
  .sidebar-backdrop{
    position:fixed; inset:0; background:rgba(15,23,42,.45); z-index:70;
  }
  .sidebar-backdrop.show{ display:block; }
  .sidebar-close{
    display:block; margin-left:auto; color:#9ca3af; font-size:22px; line-height:1;
    cursor:pointer; padding:0 2px;
  }
  .nav-item{ padding:14px 18px; font-size:14px; }

  /* --- 顶栏 --- */
  .topbar{
    flex:0 0 auto; min-height:52px; height:auto;
    padding:8px 10px; padding-top:calc(8px + env(safe-area-inset-top)); gap:8px;
  }
  .topbar h1{ font-size:15px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  .topbar .stat{ display:none; }
  .user-menu{ margin-left:auto; }
  .menu-toggle{
    display:inline-flex; align-items:center; justify-content:center; flex:none;
    width:34px; height:34px; padding:0; border:1px solid var(--border);
    background:#fff; color:var(--text); border-radius:6px; cursor:pointer;
    font-size:18px; line-height:1;
  }

  /* --- 工具栏：输入框自适应、按钮换行、标签横向滚动 --- */
  .panel-head{ padding:10px; gap:6px; }
  .panel-head .input{ flex:1 1 140px; width:auto !important; min-width:0; }
  .panel-head .right{ margin-left:0; }
  /* 标签栏独占一行，避免把搜索框挤出屏幕；标签多时本行内横向滚动（隐藏滚动条，仍可滑动） */
  .tabs{ flex:1 1 100%; width:100%; max-width:100%; overflow-x:auto; flex-wrap:nowrap;
    -webkit-overflow-scrolling:touch; scrollbar-width:none; }
  .tabs::-webkit-scrollbar{ display:none; width:0; height:0; }
  .tab{ flex:0 0 auto; padding:8px 12px; }
  .panel-body{ padding:10px; }

  /* --- 表格：横向滑动；移动端禁用垂直 sticky（与横向滚动容器冲突会错位） --- */
  .scroll-tip{ display:block; font-size:11px; color:var(--muted); padding:6px 10px 0; }
  .table-wrap,#orderTableWrap,#customerTableWrap,#invoiceTableWrap,#billTableWrap,#lansiTableWrap{
    overflow-x:auto; -webkit-overflow-scrolling:touch; overscroll-behavior-x:contain;
  }
  #orderPanelHead,#customerPanelHead,#invoicePanelHead,#billPanelHead,#lansiPanelHead{ position:static; box-shadow:none; }
  #page-orders thead th,#page-customers thead th,#page-invoices thead th,#page-bills thead th,#page-lansi thead th{ top:auto; }
  thead th{ position:static; box-shadow:none; }
  th,td{ padding:7px 8px; }
  #orderTable{ min-width:1080px; }
  #page-customers table,#page-invoices table,#page-bills table{ min-width:900px; }
  #page-lansi table{ min-width:1500px; }
  #page-projects table,#page-group_types table,#page-statuses table{ min-width:520px; }
  #dutyGroups{ grid-template-columns:1fr; }
  .wxpay-groups{ padding:10px; gap:10px; }
  .wxpay-group-head{ padding:9px 10px; }
  .invoice-item-table{ min-width:620px; }
  .invoice-table-scroll{ overflow-x:auto; -webkit-overflow-scrolling:touch; }

  /* --- 弹窗：全屏，表单单列 --- */
  /* 遮罩改为拉伸布局，弹窗高度由遮罩决定，避免 height:100% 在某些浏览器下溢出视口 */
  .modal-mask{ padding:0; align-items:stretch; }
  .modal,.modal.wide{
    width:100%; max-width:100%; height:auto; max-height:none;
    border-radius:0;
  }
  .modal-body{ flex:1; min-height:0; padding:14px; -webkit-overflow-scrolling:touch; }
  .modal-head{ padding:14px; padding-top:calc(14px + env(safe-area-inset-top)); }
  .modal-foot{ padding:12px 14px; padding-bottom:calc(12px + env(safe-area-inset-bottom)); }
  .form-grid{ grid-template-columns:1fr; gap:12px; }
  .form-item.full,.form-section{ grid-column:auto; }
  .form-item label{ font-size:13px; }
  .invoice-attach-item{ flex-wrap:wrap; }
  .invoice-attach-item .iv-attach-no{ width:100%; flex:none; }
  .photo-list{ gap:6px; }

  /* --- 蓝思兑换图片：查看器保持居中，不跟随表单弹窗的全屏拉伸 --- */
  .ls-viewer-mask{ padding:12px; align-items:center; justify-content:center; }
  .ls-viewer{ width:100%; max-width:100%; border-radius:10px; }
  .ls-viewer-stage{ padding:10px 48px; min-height:180px; }
  .ls-viewer-stage img{ max-width:100%; max-height:60vh; }
  .ls-thumbs{ gap:8px; }
  .fb-viewer-mask{ padding:12px; align-items:center; justify-content:center; }

  /* --- 表单控件 16px：避免 iOS 聚焦时自动缩放页面 --- */
  .input,.select,.textarea,.btn,
  .invoice-item-table .input,.invoice-item-table .select,
  .invoice-attach-item .iv-attach-no{ font-size:16px; }
  .btn{ min-height:36px; }
  .textarea{ min-height:90px; }

  /* --- 登录 --- */
  .login-mask{ padding:16px; }
  .login-card{ width:100%; max-width:360px; padding:24px; }
  .login-card .input{ font-size:16px; }

  /* --- 浮动结算条 / 提示 --- */
  .float-settle{
    left:12px; right:12px; bottom:12px; bottom:calc(12px + env(safe-area-inset-bottom));
    transform:none; width:auto; border-radius:14px; flex-wrap:wrap;
    justify-content:space-between; gap:8px;
  }
  .toast{
    top:8px; top:calc(8px + env(safe-area-inset-top)); bottom:auto;
    left:12px; right:12px; transform:none; text-align:center;
  }
  .user-dropdown{ top:34px; }
}
