/* 任务流管理系统 - 商务简洁风格 */
:root {
  --primary: #1f6f5c;
  --primary-dark: #185a4b;
  --primary-light: #e8f3ef;
  --text: #22303f;
  --text-sub: #6b7a8c;
  --line: #e3e8ee;
  --bg: #f5f7fa;
  --danger: #c0392b;
  --warn: #b7791f;
  --ok: #1f7a4d;
  --radius: 8px;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; height: 100%;
  font-family: "Microsoft YaHei", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  font-size: 13px; color: var(--text); background: var(--bg);
  /* 禁止浏览器在动态内容插入时自动调整滚动位置 */
  overflow-anchor: none;
}
a { color: var(--primary); text-decoration: none; }
button { font-family: inherit; font-size: 13px; cursor: pointer; }

/* 布局 */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 190px; background: #22303f; color: #cdd8e3; flex: 0 0 190px; }
.sidebar .brand { padding: 18px 16px; font-size: 15px; font-weight: 600; color: #fff;
  border-bottom: 1px solid #2e3d4d; letter-spacing: .5px; }
.sidebar .menu-item { padding: 11px 16px; cursor: pointer; border-left: 3px solid transparent; }
.sidebar .menu-item:hover { background: #2b3b4c; color: #fff; }
.sidebar .menu-item.active { background: #2b3b4c; color: #fff; border-left-color: var(--primary); }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 48px; background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; padding: 0 16px; justify-content: space-between; }
.topbar .who { color: var(--text-sub); }
.topbar .who b { color: var(--text); }
.content { padding: 16px; flex: 1; overflow-anchor: none; }

/* 当前正在处理的订单: 固定在内容区顶部, 滚动订单明细时始终可见 */
#focusCard {
  position: relative; z-index: 25; margin-bottom: 14px;
}
#focusCard:empty { display: none; }
.focus-live-card {
  border: 2px solid #e59a18;
  background: linear-gradient(135deg, #fffaf0 0%, #fff 62%);
  box-shadow: 0 10px 28px rgba(180, 102, 0, .18);
}
.focus-live-card h3 {
  display: flex; align-items: center; gap: 8px; font-size: 16px; color: #9a5b00;
}
.focus-live-dot {
  width: 10px; height: 10px; border-radius: 50%; background: #e59a18;
  box-shadow: 0 0 0 4px rgba(229, 154, 24, .16);
}
.focus-live-time { margin-left: auto; font-size: 12px; font-weight: 400; color: var(--text-sub); }
.focus-live-summary {
  display: flex; flex-wrap: wrap; gap: 10px; margin: 2px 0 10px;
}
.focus-live-summary > span {
  display: flex; align-items: baseline; gap: 6px; padding: 6px 10px;
  background: rgba(255,255,255,.86); border: 1px solid #f1d8aa; border-radius: 6px;
}
.focus-live-summary small { color: var(--text-sub); font-size: 11px; }
.focus-live-summary b { font-size: 14px; color: var(--text); }
.focus-live-summary b.cell-phone { font-size: 16px; color: #9a5b00; }
.focus-live-card table.grid tbody tr { background: #fffdf7; }
.focus-live-card td.cell-phone { font-size: 15px; font-weight: 600; }

/* 卡片与表格 */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 14px;
  /* 列多的时候让整块横向滚动, 不要把所有列挤成一团 */
  overflow-x: auto; overflow-anchor: none; }
.card h3 { margin: 0 0 12px; font-size: 14px; font-weight: 600; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.toolbar .spacer { flex: 1; }
/*
 * 列多的时候不要把每列挤成一条: 短内容列一律不换行(表格因此有自己的最小宽度,
 * 放不下就让 .card 横向滚动); 只有标了 .cell-remark 的长文本列才限宽换行。
 */
table.grid { width: 100%; border-collapse: collapse; background: #fff; }
table.grid td { white-space: nowrap; }
table.grid th, table.grid td { border-bottom: 1px solid var(--line); padding: 8px 10px;
  text-align: left; vertical-align: middle; }
table.grid th { background: #fafbfc; color: var(--text-sub); font-weight: 600;
  white-space: nowrap; }
table.grid tbody tr:hover { background: #f9fbfc; }
table.grid td.actions { white-space: nowrap; }
/* 长文本列(订单备注/任务备注/评论内容/商品): 限宽换行, 不让它把表格撑爆 */
table.grid th.cell-remark, table.grid td.cell-remark {
  min-width: 140px; max-width: 320px; white-space: normal; word-break: break-word; }
/* 评价内容: 固定宽度 + 最多两行, 不让它把整张表撑宽(客服处理页操作栏被挤到屏幕外) */
table.grid th.cell-review, table.grid td.cell-review {
  width: 210px; max-width: 210px; min-width: 210px; }
.clamp-2 { max-width: 210px; white-space: normal; word-break: break-word;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; }
/* 操作列固定在右侧: 表格横向滚动时也一直看得到、点得到 */
table.grid.sticky-actions th.actions, table.grid.sticky-actions td.actions {
  position: sticky; right: 0; z-index: 2; background: #fff;
  box-shadow: -6px 0 8px -6px rgba(16, 24, 32, .25); }
table.grid.sticky-actions th.actions { background: #fafbfc; z-index: 3; }
table.grid.sticky-actions tbody tr:hover td.actions { background: #f9fbfc; }
/*
 * 客服处理页订单明细: 固定表格布局, 整表永远不超过容器宽度(不出现横向滚动条);
 * 长内容统一省略号截断 + 悬停 title 看全; 操作列允许换行, 保证按钮都在窗口内。
 */
table.grid.fit-orders { table-layout: fixed; width: 100%; }
table.grid.fit-orders th, table.grid.fit-orders td {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 8px 8px; }
table.grid.fit-orders td.actions {
  white-space: normal; overflow: visible; text-overflow: clip; line-height: 2; }
table.grid.fit-orders td.actions .link {
  display: inline-block; white-space: nowrap; margin-right: 6px; }
table.grid.fit-orders td.cell-status { white-space: normal; line-height: 2; }
/* 订单号必须完整显示: 不给省略号; 实在放不下就换行(不截断) */
table.grid.fit-orders td.cell-order-no {
  white-space: normal; word-break: break-all; overflow: visible; text-overflow: clip; }
table.grid.fit-orders td.cell-phone {
  white-space: nowrap; overflow: visible; text-overflow: clip; }
table.grid.fit-orders td.cell-review .clamp-2 {
  display: block; max-width: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
table.grid.fit-orders th .hint { display: none; }
.pager { margin-top: 12px; display: flex; gap: 8px; align-items: center; color: var(--text-sub); }

input[type=text], input[type=password], input[type=number], input[type=date], select, textarea {
  height: 30px; padding: 0 8px; border: 1px solid #cfd8e3; border-radius: 4px;
  font-family: inherit; font-size: 13px; color: var(--text); background: #fff; outline: none;
}
textarea { height: auto; padding: 6px 8px; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); }
select { min-width: 130px; }
.field { margin-bottom: 12px; }
.field label { display: block; margin-bottom: 5px; color: var(--text-sub); }
.field .hint { color: #9aa7b4; font-size: 12px; margin-top: 4px; }

/* 按钮 */
.btn { height: 30px; padding: 0 12px; border-radius: 4px; border: 1px solid #cfd8e3;
  background: #fff; color: var(--text); }
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); color: #fff; }
.btn.danger { color: var(--danger); border-color: #e6c3be; }
.btn.danger:hover { background: #fdf3f2; border-color: var(--danger); }
.btn.small { height: 26px; padding: 0 9px; font-size: 12px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.link { color: var(--primary); cursor: pointer; margin-right: 10px; }

/* 标签 */
.tag { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px;
  background: var(--primary-light); color: var(--primary-dark); }
.tag.gray { background: #eef1f5; color: #5b6b7c; }
.tag.ok { background: #e6f5ec; color: var(--ok); }
.tag.warn { background: #fdf3e3; color: var(--warn); }
.tag.danger { background: #fdeceb; color: var(--danger); }

/* 统计块 */
.stats { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 16px; min-width: 128px; }
.stat .num { font-size: 22px; font-weight: 600; color: var(--primary-dark); }
.stat .label { color: var(--text-sub); margin-top: 4px; }
.stat.clickable { cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.stat.clickable:hover { border-color: var(--primary); box-shadow: 0 2px 8px rgba(30, 90, 160, .12); }

/* 弹窗 */
.mask { position: fixed; inset: 0; background: rgba(24, 34, 46, .42); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center; padding: 28px 16px; z-index: 50; }
.mask.wide { align-items: flex-start; }
.dialog { background: #fff; border-radius: 10px; width: 480px; max-width: 96vw;
  max-height: 86vh; display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 18px 48px rgba(16, 32, 48, .26); }
.dialog.lg { width: 860px; }
.dialog .head { padding: 15px 20px; border-bottom: 1px solid var(--line); font-size: 15px;
  font-weight: 600; color: var(--text); display: flex; align-items: center;
  justify-content: space-between; gap: 12px; background: #fff; }
.dialog .head .close { width: 26px; height: 26px; line-height: 24px; text-align: center;
  border-radius: 50%; color: var(--text-sub); font-size: 18px; cursor: pointer; flex: 0 0 auto; }
.dialog .head .close:hover { background: #eef1f5; color: var(--text); }
.dialog .body { padding: 18px 20px; overflow: auto; flex: 1 1 auto; }
.dialog .foot { padding: 13px 20px; border-top: 1px solid var(--line); background: #fafbfc;
  display: flex; justify-content: flex-end; gap: 10px; }
.dialog .field { margin-bottom: 16px; }
.dialog .field:last-child { margin-bottom: 0; }
.dialog .field > label { display: block; margin-bottom: 6px; color: var(--text-sub); font-size: 13px; }
.dialog .field input[type=text], .dialog .field input[type=password],
.dialog .field input[type=number], .dialog .field select, .dialog .field textarea {
  width: 100%; height: 34px; padding: 0 10px; border: 1px solid #cfd8e3; border-radius: 6px;
  font-size: 13px; transition: border-color .15s, box-shadow .15s; }
.dialog .field textarea { height: auto; padding: 8px 10px; line-height: 1.6; }
.dialog .field input:focus, .dialog .field select:focus, .dialog .field textarea:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(31, 111, 92, .12); outline: none; }
.dialog .field input[type=file] { font-size: 13px; color: var(--text-sub); }
.dialog .field .hint { color: #9aa7b4; font-size: 12px; margin-top: 6px; line-height: 1.6; }
.dialog table.grid { border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.dialog table.grid th { background: #f7f9fb; }
.dialog .hint { line-height: 1.7; }

/* 图片查看(点击缩略图放大) */
.lightbox { position: fixed; inset: 0; background: rgba(16, 24, 32, .82); z-index: 80;
  display: flex; align-items: center; justify-content: center; padding: 32px; cursor: zoom-out; }
.lightbox img { max-width: 94vw; max-height: 88vh; border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .5); background: #fff; }
.lightbox .tip { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%);
  color: #d7e1ea; font-size: 12px; }
img.thumb { max-width: 76px; max-height: 56px; border-radius: 4px; border: 1px solid var(--line);
  cursor: zoom-in; vertical-align: middle; }

/* 提示 */
#toast { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 99; }
.toast-item { background: #22303f; color: #fff; padding: 9px 16px; border-radius: 4px;
  margin-bottom: 8px; box-shadow: 0 4px 12px rgba(0,0,0,.2); }
.toast-item.ok { background: var(--ok); }
.toast-item.err { background: var(--danger); }
.empty { color: #9aa7b4; padding: 24px 0; text-align: center; }
.mono { font-family: Consolas, Menlo, monospace; font-size: 12px; }
.req::after { content: " *"; color: var(--danger); }

/* 登录页 */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1f6f5c 0%, #24455c 100%); }
.login-box { background: #fff; border-radius: 10px; padding: 32px 34px; width: 380px;
  box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.login-box h1 { font-size: 20px; margin: 0 0 6px; }
.login-box p.sub { color: var(--text-sub); margin: 0 0 22px; }
.login-box .field input { width: 100%; height: 36px; }
.login-box .btn.primary { width: 100%; height: 38px; font-size: 14px; margin-top: 6px; }
/* 图片预览 */
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.thumbs img { width: 84px; height: 84px; object-fit: cover; border: 1px solid var(--line);
  border-radius: 4px; }

/* 订单行可点选(选中后 Ctrl+V 粘贴截图), 以及表格里的截图缩略图 */
table.grid tbody tr.orderRow { cursor: pointer; }
table.grid tbody tr.orderRow.picked { background: #e8f3ef; box-shadow: inset 2px 0 0 var(--primary); }
img.thumb { width: 76px; height: 76px; object-fit: cover; border: 1px solid var(--line);
  border-radius: 4px; cursor: zoom-in; }

/* 通用「可搜索下拉」控件(选客服等: 几百条也能输入关键字直接定位) */
.ssInput { background: #fff; border: 1px solid var(--line); border-radius: 4px; height: 32px;
  padding: 0 20px 0 8px; color: var(--text); }
.ssInput:hover { border-color: var(--primary); }
.ssDrop .ssFilter { height: 30px; border: 1px solid var(--line); border-radius: 4px;
  padding: 0 8px; }
.ssDrop .ssList .ssItem { padding: 5px 8px; border-radius: 4px; cursor: pointer;
  white-space: nowrap; font-size: 13px; }
.ssDrop .ssList .ssItem:hover { background: #eef4fb; color: var(--primary); }
