* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
       background: #f4f6f9; color: #1f2937; font-size: 14px; }
.hidden { display: none !important; }
.muted { color: #6b7280; }
.small-text { font-size: 12px; }
.err { color: #dc2626; min-height: 18px; margin: 6px 0; font-size: 13px; }

/* 登录 */
.center-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-card { width: 340px; }
.login-card h1 { font-size: 20px; margin-bottom: 16px; text-align: center; }
.field { margin-bottom: 12px; }
.field label { display: block; margin-bottom: 4px; color: #374151; }
.field input { width: 100%; padding: 9px 10px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 14px; }

.card { background: #fff; border-radius: 10px; padding: 18px; box-shadow: 0 1px 3px rgba(0,0,0,.08); }

.btn { border: 1px solid #d1d5db; background: #fff; padding: 7px 14px; border-radius: 6px;
       cursor: pointer; font-size: 14px; }
.btn:hover { background: #f3f4f6; }
.btn.primary { background: #2563eb; border-color: #2563eb; color: #fff; }
.btn.primary:hover { background: #1d4ed8; }
/* 表格里的操作按钮到处都是,字号小两号(13→11)让信息本身更突出 */
.btn.small { padding: 3px 8px; font-size: 11px; }
.btn.danger { color: #dc2626; border-color: #fca5a5; }
.btn.wide { width: 100%; margin-top: 8px; }

/* 头部 */
header { display: flex; align-items: center; gap: 18px; background: #fff; padding: 10px 18px;
         box-shadow: 0 1px 3px rgba(0,0,0,.08); position: sticky; top: 0; z-index: 20; }
.brand { font-weight: 700; font-size: 16px; }
nav#tabs { display: flex; gap: 4px; flex: 1; }
nav#tabs button { border: none; background: none; padding: 8px 14px; cursor: pointer;
                  border-radius: 6px; font-size: 14px; color: #374151; }
nav#tabs button.active { background: #2563eb; color: #fff; }
.header-right { display: flex; align-items: center; gap: 8px; }

/* 横幅 */
.banner { padding: 9px 18px; font-weight: 600; }
.banner.red { background: #fee2e2; color: #b91c1c; }
.banner.orange { background: #ffedd5; color: #c2410c; }
.banner.blue { background: #dbeafe; color: #1d4ed8; font-weight: 400; }
/* 「有新版本」那条:文字和刷新按钮排一行 */
#banner-update { display: flex; align-items: center; gap: 12px; font-weight: 600; }

main { padding: 18px; max-width: 1280px; margin: 0 auto; }
h2 { font-size: 16px; margin: 6px 0 12px; }
h3 { font-size: 14px; margin-bottom: 8px; }
.pill { background: #2563eb; color: #fff; border-radius: 10px; padding: 1px 9px; font-size: 13px; }

/* 待办布局(首页 = 待办在上 + 订单汇总在下) */
.todo-flex { display: flex; gap: 18px; align-items: flex-start; }
#orders-block { margin-top: 26px; }
#orders-block h2, #tab-wecom h2 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.resend-text { width: 100%; min-height: 110px; padding: 10px; border: 1px solid #d1d5db;
               border-radius: 8px; font-size: 14px; line-height: 1.7; resize: vertical; }
.btn.go { background: #16a34a; border-color: #16a34a; color: #fff; }
.btn.refund { background: #dc2626; border-color: #dc2626; color: #fff; }
/* 已有备注:琥珀色 + 按钮上直接显示最新一条摘要(完整内容在 title) */
.btn.has-remark { background: #fef3c7; border-color: #f59e0b; color: #92400e; font-weight: 600;
                  max-width: 260px; overflow: hidden; text-overflow: ellipsis;
                  white-space: nowrap; vertical-align: middle; }
.btn.has-remark:hover { background: #fde68a; }
.split { display: flex; gap: 18px; flex: 1; flex-wrap: wrap; }
.split .col { flex: 1; min-width: 380px; }
#online-panel { width: 210px; background: #fff; border-radius: 10px; padding: 12px;
                box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.agent-row { display: flex; align-items: center; gap: 8px; padding: 5px 0; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #d1d5db; }
.dot.on { background: #16a34a; }

.list { display: flex; flex-direction: column; gap: 10px; }
.item { background: #fff; border-radius: 10px; padding: 12px 14px; box-shadow: 0 1px 3px rgba(0,0,0,.08);
        border-left: 4px solid #2563eb; }
.item.red { border-left-color: #dc2626; background: #fff5f5; }
.item.new-flag { outline: 2px solid #fbbf24; }
.item .row1 { display: flex; justify-content: space-between; gap: 8px; }
.item .title { font-weight: 600; }
.item .age { color: #6b7280; font-size: 13px; white-space: nowrap; }
.item.red .age { color: #dc2626; font-weight: 700; }
.item .meta { color: #4b5563; margin-top: 6px; font-size: 13px; line-height: 1.6; word-break: break-all; }
.badge { display: inline-block; font-size: 11px; border-radius: 4px; padding: 1px 6px;
         background: #e5e7eb; color: #374151; margin-left: 6px; vertical-align: 1px; }
.badge.bf { background: #fef3c7; color: #92400e; }
.empty { color: #9ca3af; text-align: center; padding: 30px 0; }

/* 表格 */
table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 10px; overflow: hidden;
        box-shadow: 0 1px 3px rgba(0,0,0,.08); }
th, td { padding: 8px 12px; text-align: left; border-bottom: 1px solid #f0f2f5; font-size: 13px; }
th { background: #f9fafb; color: #374151; white-space: nowrap; }
tr:last-child td { border-bottom: none; }
/* 当日订单整行加粗,让客服一眼扫到今天的单。
   连 .muted / .small-text 这些本来就淡的一起压过去,否则一行里粗细不齐更难读;
   按钮不动 —— 那是控件不是信息。 */
.today-row td, .today-row td .muted, .today-row td .small-text,
.today-row td span:not(.plat) { font-weight: 700; }
.today-row td .muted { color: #4b5563; }

.form-inline { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.form-inline input, .form-inline select { padding: 7px 10px; border: 1px solid #d1d5db; border-radius: 6px; }

/* 设置表单 */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.settings-grid .card label { display: flex; justify-content: space-between; align-items: center;
                             padding: 5px 0; gap: 10px; }
.settings-grid input[type=number], .settings-grid input[type=text] {
  width: 90px; padding: 5px 8px; border: 1px solid #d1d5db; border-radius: 6px; }

/* 弹窗 */
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 50;
              display: flex; align-items: center; justify-content: center; }
.modal { background: #fff; border-radius: 12px; padding: 22px; width: 460px; max-width: 92vw;
         max-height: 80vh; overflow: auto; }
.modal h2 { margin-bottom: 12px; }
.modal.drop { outline: 2px dashed #2563eb; outline-offset: -6px; }   /* 拖文件进来时的落点提示 */
.modal .m-item { padding: 8px 10px; border-radius: 8px; background: #fef2f2; margin-bottom: 8px;
                 border-left: 3px solid #dc2626; font-size: 13px; line-height: 1.6; }
.temp-pw { font-size: 26px; font-family: ui-monospace, Menlo, monospace; text-align: center;
           letter-spacing: 2px; background: #f3f4f6; border-radius: 8px; padding: 14px; margin: 12px 0; }

/* 订单汇总宽表 */
.wide-table { overflow-x: auto; }
.wide-table table { min-width: 1150px; }
.wide-table td { vertical-align: top; }
.st-ok { color: #1a7f37; font-weight: 600; }
.st-bad { color: #c00000; font-weight: 600; }
/* 卡密可能很长(一单多码)所以截断;复制按钮必须放在截断范围之外,否则会被
   省略号一起吃掉 —— 故 .cdk-cell 是 td 里的 span,不再是 td 本身 */
.cdk-td { white-space: nowrap; }
.cdk-cell { font-family: ui-monospace, Menlo, monospace; font-size: 12px; max-width: 140px;
            overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.copy-btn { padding: 3px 8px; font-size: 11px; line-height: 1.3; }

/* 搜索无结果:要大、要红。默认只查近 7 天,搜不到多半是窗口太窄而不是真没有 */
.search-empty { margin-top: 14px; text-align: center; font-size: 18px; font-weight: 700;
                color: #dc2626; }

/* 首页待办角标:没有待办时整条隐藏,不占地方 */
.todo-badges { display: flex; gap: 8px; margin: 0 0 12px; }
.todo-badges .btn { font-size: 14px; }
#badge-unread { border-color: #dc2626; color: #b91c1c; }
#badge-unread .pill { background: #dc2626; }

/* 企微客户:表格里的昵称 + 资料弹窗 */
.cust-link { color: #2563eb; text-decoration: none; }
.cust-link:hover { text-decoration: underline; }
.cust-head { display: flex; align-items: center; gap: 12px; margin: 6px 0 12px; }
.cust-avatar { width: 52px; height: 52px; border-radius: 50%; object-fit: cover;
               background: #f3f4f6; flex: 0 0 auto; }
.cust-name { font-size: 16px; font-weight: 600; }
.cust-row { display: flex; gap: 10px; padding: 6px 0; border-top: 1px solid #f0f0f0;
            font-size: 13px; line-height: 1.6; }
.cust-row b { flex: 0 0 72px; color: #6b7280; font-weight: 500; }
.cust-row span { flex: 1 1 auto; word-break: break-all; }
.tag-group { margin-bottom: 6px; }
.tag-group b { display: block; color: #6b7280; font-weight: 500; font-size: 12px; margin-bottom: 2px; }
.tag-pick { display: inline-flex; align-items: center; gap: 4px; margin: 0 10px 4px 0;
            font-size: 13px; white-space: nowrap; }
/* 客户资料弹窗内容多了要能滚,否则底部「关闭」被挤出视口(备注弹层踩过同样的坑)。
   资料 + 备注合用一条滚动条:分成两个滚动区看着整齐,实际是把备注那排
   「附件 / 添加备注」按钮挤没了 —— 同一个坑换了个地方而已。 */
#cust-mask .modal { max-height: 88vh; display: flex; flex-direction: column; overflow: hidden; }
#cust-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; margin-bottom: 10px; }
#cust-fresh { min-height: 16px; margin: 4px 0; }
#cust-remark-slot { border-top: 1px solid #e5e7eb; padding-top: 6px; }
#cust-remark-slot h2 { font-size: 15px; margin: 0 0 2px; }
/* 面板要在备注弹层里撑满、只让列表滚 */
#remark-panel { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
/* 嵌进客户资料弹窗时改回普通文档流,滚动交给 #cust-scroll 统一管 */
#cust-remark-slot #remark-panel { display: block; }
#cust-remark-slot .remark-list { overflow: visible; }

/* 订单汇总的平台标 */
/* 平台列。有图标时只画图标(不要底色方块,品牌色自己够显眼);
   将来接了没图标的平台会回落成文字,那时底色还得在 —— 所以是加 .ico 类而不是改 .plat。 */
.plat { display: inline-flex; align-items: center; padding: 1px 6px; border-radius: 4px;
        font-size: 12px; white-space: nowrap; }
.plat.ico { padding: 0; background: none; }
.plat-ico { width: 18px; height: 18px; display: block; }
.plat-douyin { background: #f1f5f9; color: #475569; }
.plat-wxstore { background: #dcfce7; color: #15803d; }
/* 只给屏幕阅读器:图标列没有可见文字,但「抖店/微信小店」得念得出来 */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
           overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* 到期提醒:顶栏一枚小标签,只显示最急那项,全部内容在 title 里 */
.expiry-chip { font-size: 12px; padding: 2px 8px; border-radius: 10px; white-space: nowrap;
               cursor: default; }
.expiry-chip.exp-ok     { background: #f0fdf4; color: #15803d; }
.expiry-chip.exp-warn   { background: #ffedd5; color: #c2410c; font-weight: 600; }
.expiry-chip.exp-urgent { background: #fee2e2; color: #b91c1c; font-weight: 700; }

/* 激活码列:码一行,操作按钮一行 */
.cdk-ops { display: flex; gap: 4px; margin: 2px 0 6px; }
.after-td div:first-child { white-space: nowrap; }

/* 手工补录码的删除键:平时淡,悬停才红 —— 别让它比复制键还抢眼 */
.del-cdk { padding: 3px 8px; font-size: 11px; line-height: 1.3; color: #9ca3af; }
.del-cdk:hover { color: #b91c1c; border-color: #fca5a5; }

/* 企微客户表格:头像 + 昵称 + 性别 */
.wc-name { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.wc-avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover;
             background: #f3f4f6; flex: 0 0 auto; cursor: pointer; }
.wc-avatar.ph { display: inline-flex; align-items: center; justify-content: center;
                color: #6b7280; font-size: 13px; }
.wc-name .g { font-size: 13px; }
.wc-name .g1 { color: #2563eb; }
.wc-name .g2 { color: #db2777; }

/* 设置待办:待办人平铺单选 + 计划时间快捷按钮 */
.pick-list { display: flex; flex-wrap: wrap; gap: 6px; max-height: 168px; overflow-y: auto;
             border: 1px solid #e5e7eb; border-radius: 6px; padding: 8px; }
.pick { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px;
        border: 1px solid #e5e7eb; border-radius: 999px; cursor: pointer; font-size: 13px; }
.pick:hover { border-color: #93c5fd; }
.pick:has(input:checked) { border-color: #2563eb; background: #eff6ff; }
.quick-row { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }

.item .row1 .ops { white-space: nowrap; }

/* 客户备注弹层 */
/* 备注弹层:整体不滚,只让备注列表滚 —— 否则备注一多,
   底部的「添加备注 / 关闭」就被挤出视口,得先滚动才点得到。 */
.modal-wide { width: 640px; display: flex; flex-direction: column; overflow: hidden; }
.remark-list { flex: 1 1 auto; min-height: 60px; overflow-y: auto; margin: 8px 0 10px; }
.remark-item { border-bottom: 1px dashed #e5e7eb; padding: 8px 0; }
.remark-item:last-child { border-bottom: 0; }
.remark-item.gone { opacity: .7; background: #fafafa; }
.remark-text { white-space: pre-wrap; word-break: break-word; color: #1f2328; }
.remark-meta { display: flex; align-items: center; gap: 8px; margin-top: 3px; flex-wrap: wrap; }
.remark-meta .r-ops { margin-left: auto; display: flex; gap: 6px; }

/* 备注上的待办行 */
.remark-todo { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 5px;
               background: #eff6ff; border-left: 3px solid #2563eb; border-radius: 0 6px 6px 0;
               padding: 5px 8px; font-size: 12px; color: #1e40af; }
.remark-todo.overdue { background: #fef2f2; border-left-color: #dc2626; color: #b91c1c; }
.remark-todo .t-ops { margin-left: auto; display: flex; gap: 6px; }

/* 附件:待提交的暂存条 + 已保存备注里的缩略图/文件片 */
.att-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.att-bar:empty { margin-top: 0; }
.atts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.att-thumb { width: 76px; height: 76px; object-fit: cover; border-radius: 6px;
             border: 1px solid #e5e7eb; cursor: pointer; background: #f3f4f6; display: block; }
.att-thumb:hover { border-color: #2563eb; }
.att-vid { position: relative; display: inline-block; line-height: 0; }
.att-vid::after { content: "▶"; position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%);
                  color: #fff; font-size: 20px; text-shadow: 0 1px 4px rgba(0,0,0,.7); pointer-events: none; }
.att-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 240px; cursor: pointer;
            border: 1px solid #d1d5db; border-radius: 6px; padding: 5px 9px; font-size: 12px;
            background: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att-chip:hover { border-color: #2563eb; background: #f8fafc; }
.att-chip .x { color: #dc2626; font-weight: 700; padding: 0 2px; }
.att-chip.up { background: #f3f4f6; color: #6b7280; cursor: default; }

/* 附件放大层(图片/视频) */
#lb-mask { z-index: 80; background: rgba(0,0,0,.82); }
#todo-mask { z-index: 70; }
.lightbox { display: flex; flex-direction: column; gap: 10px; max-width: 92vw; max-height: 92vh; }
.lb-bar { display: flex; align-items: center; gap: 10px; color: #fff; }
.lb-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.lb-body { display: flex; align-items: center; justify-content: center; overflow: auto; }
.lb-body img, .lb-body video { max-width: 92vw; max-height: 80vh; border-radius: 8px; background: #000; }
.lb-bar .btn { text-decoration: none; color: #1f2937; }

/* 待办列表页 */
.todo-card { background: #fff; border-radius: 10px; padding: 10px 12px; border-left: 4px solid #2563eb;
             box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.todo-card.overdue { border-left-color: #dc2626; background: #fff5f5; }
.todo-card .row1 { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.todo-card .title { font-weight: 600; }
.todo-card .tt { white-space: pre-wrap; word-break: break-word; margin: 5px 0; }
.todo-card .tm { color: #6b7280; font-size: 12px; display: flex; gap: 10px; flex-wrap: wrap; }
.due { font-weight: 600; white-space: nowrap; }
.due.overdue { color: #dc2626; }

/* 一单两码时标出「客户已收到」的那个(sph 平台自动发的)。做得小而不抢眼:
   它是给客服扫一眼用的提示,不是警告 —— 真要补发时复制哪个才关键。 */
.cdk-tag {
  display: inline-block;
  margin-left: 4px;
  padding: 0 4px;
  font-size: 10px;
  line-height: 15px;
  color: #047857;
  background: #d1fae5;
  border-radius: 3px;
  vertical-align: middle;
  white-space: nowrap;
}

/* 批量补录结果里的「成功」计数。用绿色和 .err 的红色配对,一眼分得清 */
.ok-text { color: #047857; font-weight: 600; }

/* 统计比例:颜色表示指标,百分比和订单数同时可读。 */
.stats-rate { position: relative; min-width: 108px; height: 24px; border-radius: 5px;
  overflow: hidden; background: #dcfce7; color: #14532d; }
.stats-rate-fill { position: absolute; inset: 0 auto 0 0; background: #86efac; }
.stats-rate.refund { background: #fee2e2; color: #7f1d1d; }
.stats-rate.refund .stats-rate-fill { background: #fca5a5; }
.stats-rate-label { position: relative; display: block; text-align: center; line-height: 24px; font-weight: 600; }
.stats-rate-count { font-size: 11px; color: #6b7280; text-align: center; margin-top: 3px; }
