:root{--pri:#4a7fc0;--g1:#3f9482;--grad:linear-gradient(120deg,#3f9482,#6366f1);--line:#e8ebf0;--bg:#f4f5f9;--text:#1f2329;--mute:#8a919f;--bad:#e5484d}
*{box-sizing:border-box;margin:0;padding:0}
body{font:14px/1.6 -apple-system,BlinkMacSystemFont,"PingFang SC","Microsoft YaHei",sans-serif;background:var(--bg);color:var(--text)}
.hide{display:none!important}
.login{min-height:100vh;display:grid;place-items:center;background:var(--grad)}
.login .box{background:#fff;padding:36px;border-radius:18px;width:340px;display:flex;flex-direction:column;gap:14px;box-shadow:0 20px 50px rgba(0,0,0,.2)}
.login h1{font-size:22px;text-align:center;margin-bottom:6px}
input,select,textarea{font:inherit;border:1px solid var(--line);border-radius:8px;padding:9px 12px;outline:0;background:#fff;width:100%}
input:focus,select:focus,textarea:focus{border-color:var(--pri);box-shadow:0 0 0 3px rgba(74,127,192,.15)}
textarea{resize:vertical;font-family:ui-monospace,Menlo,Consolas,monospace;font-size:13px}
.btn{font:inherit;border:1px solid var(--line);background:#fff;border-radius:8px;padding:7px 16px;cursor:pointer;color:var(--text);transition:.15s}
.btn:hover{border-color:var(--pri);color:var(--pri)}
.btn.pri{background:var(--grad);color:#fff;border-color:transparent}
.btn.pri:hover{opacity:.9;color:#fff}
.btn.danger{color:var(--bad)}
.btn.danger:hover{border-color:var(--bad);color:var(--bad)}
.btn.sm{padding:3px 10px;font-size:13px}
.btn:disabled{opacity:.5;cursor:not-allowed}
.err{color:var(--bad);min-height:20px;font-size:13px}
.app{display:flex;min-height:100vh}
aside{width:200px;background:#1f2937;color:#cbd5e1;display:flex;flex-direction:column;flex:none}
.logo{padding:22px 20px;font-size:17px;font-weight:600;color:#fff}
nav{flex:1}
nav a{display:block;padding:12px 20px;cursor:pointer;color:#cbd5e1}
nav a:hover{background:#2b3648}
nav a.on{background:var(--pri);color:#fff}
.side-foot{padding:16px 20px;font-size:13px;border-top:1px solid #334155}
.side-foot a{cursor:pointer;color:#93c5fd;margin-left:8px}
main{flex:1;padding:26px 30px;min-width:0}
h2{font-size:20px;margin-bottom:18px}
.bar{display:flex;gap:10px;align-items:center;margin-bottom:16px;flex-wrap:wrap}
.bar .grow{flex:1}
.bar input,.bar select{width:auto;min-width:160px}
/* 业绩报表:数据日期选择(默认今天,最近 7 天) */
.daypick{display:flex;align-items:center;gap:6px;flex:none;font-size:13px;color:#4b5563;white-space:nowrap}
.daypick select{min-width:182px}
.card{background:#fff;border-radius:12px;padding:20px;box-shadow:0 2px 10px rgba(30,40,80,.05);margin-bottom:18px}
.stats{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:16px;margin-bottom:18px}
.stat{background:#fff;border-radius:12px;padding:18px 20px;box-shadow:0 2px 10px rgba(30,40,80,.05)}
.stat small{color:var(--mute)}
.stat b{display:block;font-size:28px;margin-top:4px}
table{width:100%;border-collapse:collapse;background:#fff;border-radius:12px;overflow:hidden}
th,td{padding:10px 14px;text-align:left;border-bottom:1px solid var(--line);vertical-align:top;word-break:break-all}
th{background:#f8f9fb;color:#666;font-weight:500;white-space:nowrap}
tr:last-child td{border-bottom:0}
.tw{overflow-x:auto;border-radius:12px;box-shadow:0 2px 10px rgba(30,40,80,.05)}
.tag{display:inline-block;padding:1px 9px;border-radius:5px;font-size:12px;background:#edf8e4;color:#5aa627}
.tag.off{background:#f1f2f4;color:#8a919f}
.tag.bad{background:#fdecec;color:var(--bad)}
.tag.batch{background:#eef2ff;color:#4f5bd5;white-space:nowrap}
.mono{font-family:ui-monospace,Menlo,Consolas,monospace;font-size:13px}
/* 业绩报表:差额(省下的量)用绿色强调;时间和操作按钮不拆行 */
.diffv{color:#2f9e73;font-weight:600}
/* 业绩报表:表头下方的合计行(与前台「用户新增查询」一致) */
.sumrow td{background:#f2f7fd;border-bottom:1px solid #dbe7f5}
.sumrow td.pick{text-align:left;white-space:nowrap}
.sumrow td.pick b{color:var(--pri)}
.nowrap{white-space:nowrap;word-break:normal}
.mute{color:var(--mute)}
.pager{display:flex;gap:10px;align-items:center;justify-content:flex-end;margin-top:14px;flex-wrap:wrap}
.bar .grow,.pager .grow,.bulkbar .grow{flex:1}
/* 搜索联想框:输入批次号/卡密,下方先列出批次,再列出卡密 */
.bar .searchbox{position:relative;flex:0 0 260px;min-width:0}
.bar .searchbox input{width:100%;min-width:0;padding:7px 10px}
.sug{position:absolute;z-index:14;top:calc(100% + 6px);left:0;right:0;max-height:min(360px,60vh);overflow:auto;overscroll-behavior:contain;background:#fff;border:1px solid var(--line);border-radius:10px;box-shadow:0 12px 30px rgba(30,40,80,.16);padding:6px}
.sug-group{padding:6px 8px 4px;font-size:12px;color:var(--mute)}
.sug-item{padding:7px 8px;border-radius:8px;cursor:pointer}
.sug-item:hover{background:#f2f6fd}
.sug-main{font-size:13px;font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.sug-sub{margin-top:1px;font-size:12px;color:var(--mute);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.sug-empty{padding:14px 8px;text-align:center;font-size:13px;color:var(--mute)}
/* 启用/停用/全部 切换 */
.seg{display:inline-flex;border:1px solid var(--line);border-radius:8px;overflow:hidden;background:#fff;flex:none}
.seg button{font:inherit;border:0;background:transparent;padding:7px 14px;cursor:pointer;color:#4b5563;transition:.15s}
.seg button+button{border-left:1px solid var(--line)}
.seg button:hover{background:#f6f8fb}
.seg button.on{background:var(--pri);color:#fff}
.seg button.on:hover{background:var(--pri)}
.seg button b{font-weight:600;margin-left:2px}
/* 表格上方批量操作条 */
.bulkbar{display:flex;gap:8px;align-items:center;flex-wrap:wrap;background:#fff;border-radius:10px;padding:10px 12px;margin-bottom:10px;box-shadow:0 2px 10px rgba(30,40,80,.05)}
.bulkbar .mute{font-size:13px}
/* 省钱调控条:全局比例 + 说明 + 调整按钮 */
.tunebar{display:flex;align-items:center;gap:10px;flex-wrap:wrap;background:#fff;border-radius:10px;padding:10px 12px;margin-bottom:10px;box-shadow:0 2px 10px rgba(30,40,80,.05)}
.tunebar .tb-main{font-weight:600}
.tunebar .tb-main b{color:var(--pri);margin-left:4px}
.tunebar .tb-meta{font-size:12px;font-weight:400;color:#8a93a6;margin-left:2px}
.tunebar .tb-tip{font-size:13px;flex:1}
.tunebar .btn{margin-left:auto}
/* 手机端「全选本页」文字按钮:桌面有表头勾选框,这里默认隐藏 */
.linkbtn{display:none;margin-left:10px;border:0;background:none;color:var(--pri);font:inherit;font-size:13px;padding:2px 4px;cursor:pointer}
.modal{position:fixed;inset:0;background:rgba(0,0,0,.45);display:grid;place-items:center;z-index:20;padding:20px}
.mbox{background:#fff;border-radius:14px;width:720px;max-width:100%;max-height:92vh;overflow:auto;padding:22px 24px}
.mhead{display:flex;justify-content:space-between;align-items:center;margin-bottom:16px;font-size:17px}
.mhead a{cursor:pointer;font-size:24px;color:var(--mute);line-height:1}
.form{display:grid;gap:14px}
.form label{display:grid;gap:5px;font-weight:500}
.form label small{font-weight:400;color:var(--mute)}
.chk{display:flex;gap:16px;flex-wrap:wrap;font-weight:400}
.chk label{display:flex;gap:5px;align-items:center;font-weight:400}
.chk input{width:auto}
.foot{display:flex;justify-content:flex-end;gap:10px;margin-top:6px}
pre.out{background:#0f172a;color:#e2e8f0;padding:12px;border-radius:8px;overflow:auto;max-height:260px;font-size:12px;white-space:pre-wrap;word-break:break-all}
.toast{position:fixed;top:20px;left:50%;transform:translate(-50%,-80px);background:#333;color:#fff;padding:10px 22px;border-radius:8px;transition:.3s;z-index:50}
.toast.show{transform:translate(-50%,0)}.toast.ok{background:#2f9e73}.toast.err{background:var(--bad)}
/* ============ 手机端(iPhone 16 Pro Max 440×956 为基准) ============
   功能与桌面完全一致,只调整布局:左侧栏改顶部导航、表格改卡片、
   控件全宽铺开并把可点区域放大到 40px 以上 */
@media(max-width:820px){
  body{font-size:15px;-webkit-text-size-adjust:100%}
  input,select{min-height:44px;font-size:16px} /* 16px 可避免 iOS 聚焦时页面放大 */
  textarea{font-size:16px}

  /* 侧栏 → 顶部两行:标题+退出 / 均分导航(常驻吸顶) */
  .app{flex-direction:column;min-height:100vh}
  aside{position:sticky;top:0;z-index:15;width:100%;flex-direction:column;padding-top:env(safe-area-inset-top);box-shadow:0 2px 10px rgba(15,23,42,.25)}
  .logo{display:block;padding:12px 14px 6px;font-size:15px}
  .side-foot{position:absolute;right:10px;top:9px;padding:0;border:0;font-size:13px}
  .side-foot a{margin-left:0;padding:6px 10px;border-radius:7px;background:#2b3648}
  nav{display:flex;width:100%;gap:4px;padding:4px 8px 10px}
  nav a{flex:1 1 0;min-width:0;padding:9px 0;border-radius:8px;text-align:center;font-size:13px;white-space:nowrap}
  nav a:hover{background:transparent}
  nav a.on{background:var(--pri);color:#fff}
  main{padding:14px 12px calc(44px + env(safe-area-inset-bottom))}
  h2{font-size:18px;margin-bottom:12px}

  /* 筛选栏:导入按钮与状态切换同一行,下面逐行铺满 */
  .bar{gap:8px;margin-bottom:12px}
  .bar .grow{display:none}
  .bar #imp{flex:1 1 38%;min-height:44px;padding:10px 8px}
  .seg{flex:1 1 52%;min-height:44px}
  .seg button{flex:1;padding:11px 2px;font-size:13px}
  .bar select,.bar input{flex:1 1 100%;width:100%!important;min-width:0}
  .bar .searchbox{flex:1 1 100%;width:100%}
  .bar .searchbox input{padding:10px 12px}
  .sug{max-height:50vh}
  /* 复选框不要被上面的 input 规则撑成大方块 */
  .bar>label{display:flex;align-items:center;gap:8px;flex:1 1 100%;font-size:14px;color:#4b5563}
  /* 日期选择:标题在上、下拉框独占一行,避免挤在一起 */
  .bar .daypick{display:grid;gap:6px;white-space:normal}
  input[type=checkbox],input[type=radio]{flex:none;width:22px!important;height:22px!important;min-height:0;accent-color:var(--pri)}

  /* 省钱调控条:标题+按钮一行,说明换行 */
  .tunebar{gap:6px;padding:10px}
  .tunebar .tb-main{flex:1 1 auto}
  .tunebar .tb-tip{flex:1 1 100%;font-size:12px;line-height:1.5}
  .tunebar .btn{flex:1 1 100%;min-height:40px;font-size:14px;margin-left:0}

  /* 批量操作条:计数独占一行,按钮两列 */
  .bulkbar{gap:6px;padding:10px;margin-bottom:10px}
  .bulkbar .grow{display:none}
  .bulkbar>.mute{flex:1 1 100%;font-size:13px}
  .bulkbar .linkbtn{display:inline-block}
  .bulkbar>.mute:last-child{font-size:12px;line-height:1.5;margin-top:2px}
  .bulkbar .btn{flex:1 1 calc(33.33% - 4px);min-height:40px;font-size:14px;padding:8px 6px}

  /* 表格 → 卡片:每条记录一张白卡,标签在前、值在后 */
  .tw{overflow:visible;background:none;box-shadow:none;border-radius:0}
  table,tbody,tr,td{display:block;width:auto}
  table{background:none;border-radius:0}
  thead{display:none}
  tbody tr{position:relative;background:#fff;border-radius:14px;padding:12px 14px;margin-bottom:10px;box-shadow:0 2px 10px rgba(30,40,80,.05)}
  tbody td{display:flex;gap:10px;border:0;padding:3px 0;font-size:14px;line-height:1.5;word-break:break-all}
  tbody td[data-label]::before{content:attr(data-label);flex:0 0 66px;color:var(--mute);font-size:13px}
  /* 勾选框:浮在卡片右上角,不影响正文 */
  tbody td.pick{position:absolute;top:11px;right:12px;padding:0;gap:0}
  tbody td.pick::before{display:none}
  tbody td.pick input{width:22px;height:22px;min-height:0;accent-color:var(--pri)}
  table.pickable tbody tr{padding-right:46px}
  tbody td.code{font-size:15px;font-weight:600}
  /* 操作按钮:一行等分,热区放大 */
  tbody td.act{flex-wrap:wrap;gap:8px;padding-top:10px;margin-top:8px;border-top:1px dashed var(--line)}
  tbody td.act::before{display:none}
  tbody td.act .btn{flex:1 1 0;min-height:40px;font-size:14px;padding:8px 4px}
  /* 空状态 / 无数据占位 */
  tbody td[colspan]{display:block;text-align:center;padding:20px 0;color:var(--mute)}
  /* 合计行在手机上也保持为一张独立卡片 */
  tbody tr.sumrow{margin-bottom:12px;border:1px solid #dbe7f5}
  table.pickable tbody tr.sumrow{padding-right:14px}
  tbody tr.sumrow td{background:none;border:0}
  /* 合计不浮到右上角,独占一行放在最前面 */
  tbody tr.sumrow td.pick{position:static;padding:0 0 6px;text-align:left;font-size:13px}

  /* 分页:计数、每页条数各占一行,上一页/页码/下一页同一行 */
  .pager{gap:8px;margin-top:4px;justify-content:flex-start}
  .pager .grow{display:none}
  .pager>.mute{flex:1 1 100%}
  .pager #psz{flex:1 1 100%;width:100%!important;min-width:0}
  .pager .btn{flex:1 1 0;min-height:44px;font-size:15px;padding:8px 4px}
  .pager>span:not(.mute){flex:none;min-width:52px;text-align:center}

  /* 弹窗 → 底部抽屉:内容超长时可滚动,标题吸顶 */
  .modal{display:flex;align-items:flex-end;justify-content:center;padding:0}
  .mbox{width:100%;max-width:100%;max-height:92vh;border-radius:18px 18px 0 0;padding:16px 16px calc(16px + env(safe-area-inset-bottom))}
  .mhead{position:sticky;top:0;z-index:2;background:#fff;padding:4px 0 10px;margin-bottom:12px;border-bottom:1px solid var(--line);font-size:16px}
  .form{gap:12px}
  .foot .btn{flex:1 1 0;min-height:44px;font-size:15px}

  /* 概览卡片:两列 */
  .stats{grid-template-columns:1fr 1fr;gap:10px}
  .stat{padding:14px 16px}
  .stat b{font-size:24px}
  .card{padding:16px;border-radius:14px}

  /* 登录 */
  .login{padding:20px}
  .login .box{width:100%;max-width:360px;padding:28px 22px}
  .login .btn{min-height:46px;font-size:16px}
  pre.out{max-height:200px}
}
