:root {
  --bg: #f4f6fa;
  --panel: #ffffff;
  --line: #e5e8ef;
  --line-strong: #d3d8e3;
  --text: #1f2733;
  --text-2: #5b6675;
  --text-3: #93a0b0;
  --brand: #2b6cff;
  --brand-dark: #1e54cc;
  --brand-soft: #eaf1ff;
  --red: #e0453c;
  --red-soft: #fdecea;
  --green: #17a673;
  --green-soft: #e6f7f1;
  --amber: #d98613;
  --amber-soft: #fdf3e2;
  --sidebar: #16202f;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(23, 35, 55, .06), 0 8px 24px rgba(23, 35, 55, .06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font-family: inherit; font-size: 14px; color: inherit; }
a { color: var(--brand); }

/* ---------- Boot ---------- */
.boot { height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--text-2); gap: 14px; }
.boot-spinner { width: 34px; height: 34px; border: 3px solid var(--line-strong); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 登录 ---------- */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: linear-gradient(160deg, #eef3fb 0%, #f7f9fd 55%, #eaf1ff 100%); }
.login-card { width: 100%; max-width: 410px; background: var(--panel); border-radius: 16px; box-shadow: 0 12px 40px rgba(23, 35, 55, .12); padding: 34px 32px 28px; }
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.login-logo { width: 38px; height: 38px; border-radius: 10px; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 17px; }
.login-card h1 { font-size: 19px; margin: 0; }
.login-sub { color: var(--text-2); font-size: 13px; margin: 0 0 20px; }
.tabs { display: flex; gap: 4px; background: var(--bg); border-radius: 9px; padding: 4px; margin-bottom: 18px; }
.tabs button { flex: 1; border: 0; background: transparent; padding: 8px 10px; border-radius: 7px; cursor: pointer; color: var(--text-2); font-weight: 500; }
.tabs button.on { background: var(--panel); color: var(--brand); box-shadow: var(--shadow); }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; color: var(--text-2); margin-bottom: 6px; font-weight: 500; }
.field .row-inline { display: flex; gap: 8px; }
.field .row-inline input { flex: 1; min-width: 0; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=email], input[type=tel], input[type=file], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(43, 108, 255, .12); }
textarea { resize: vertical; min-height: 64px; }
.field-err { color: var(--red); font-size: 12.5px; margin-top: 6px; min-height: 17px; }

.btn { border: 1px solid var(--line-strong); background: #fff; padding: 8px 15px; border-radius: 8px; cursor: pointer; font-weight: 500; transition: all .15s; white-space: nowrap; }
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger:hover { background: #c9372f; border-color: #c9372f; color: #fff; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--bg); color: var(--brand); }
.btn-block { width: 100%; padding: 10px; }
.btn-sm { padding: 5px 10px; font-size: 13px; border-radius: 7px; }

/* ---------- 布局 ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: 216px; flex: 0 0 216px; background: var(--sidebar); color: #cfd8e6; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.side-brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 16px; border-bottom: 1px solid rgba(255, 255, 255, .07); }
.side-logo { width: 30px; height: 30px; border-radius: 8px; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 14px; }
.side-brand b { color: #fff; font-size: 14.5px; letter-spacing: .3px; }
.side-nav { padding: 10px 10px; overflow-y: auto; flex: 1; }
.side-group { font-size: 11px; color: #66748c; padding: 12px 10px 5px; letter-spacing: .6px; }
.side-nav a { display: flex; align-items: center; gap: 9px; padding: 9px 11px; border-radius: 8px; color: #cfd8e6; text-decoration: none; font-size: 13.5px; cursor: pointer; margin-bottom: 1px; }
.side-nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.side-nav a.on { background: var(--brand); color: #fff; font-weight: 500; }
.side-nav a .ico { width: 16px; text-align: center; font-size: 13px; opacity: .9; }
.side-nav a .badge { margin-left: auto; background: rgba(255, 255, 255, .16); border-radius: 9px; padding: 1px 7px; font-size: 11px; }
.side-nav a.on .badge { background: rgba(255, 255, 255, .28); }
.side-user { padding: 10px 18px 0; font-size: 12px; color: #8b9ab0; line-height: 1.6; }
.side-user b { color: #fff; font-weight: 600; }
.side-foot { padding: 10px 16px 14px; border-top: 1px solid rgba(255, 255, 255, .07); }
/* 收起态才出现的「退出」短标签（退出登录四个字 64px 宽度放不下） */
.side-foot .lbl-sm { display: none; }

/* ---------- 侧栏收起（电脑端，2026-11-04 用户要求）----------
   收起后只剩一列图标：分组标题变成一条分隔线，品牌名 / 当前登录 / 按钮文字都藏起来，
   鼠标停在图标上有原生 title 提示。状态记在本机（ui.sidebar.v1），下次打开还是收起。
   ⚠️ 全部规则锁在 min-width:901px 里：手机上侧栏是抽屉（216px 固定），
      不锁的话收起时会把抽屉一起挤成 64px。 */
@media (min-width: 901px) {
  .sidebar { transition: width .16s ease, flex-basis .16s ease; }
  .shell.collapsed .sidebar { width: 64px; flex: 0 0 64px; }
  .shell.collapsed .side-brand { padding: 18px 0 16px; justify-content: center; }
  .shell.collapsed .side-brand b { display: none; }
  .shell.collapsed .side-nav { padding: 10px 8px; }
  .shell.collapsed .side-group {
    height: 1px; padding: 0; margin: 9px 6px; overflow: hidden; text-indent: -99px;
    background: rgba(255, 255, 255, .1); border-radius: 1px;
  }
  .shell.collapsed .side-nav a { justify-content: center; padding: 9px 0; gap: 0; }
  .shell.collapsed .side-nav a .lbl { display: none; }
  .shell.collapsed .side-nav a .ico { width: auto; font-size: 15px; }
  .shell.collapsed .side-user { display: none; }
  .shell.collapsed .side-foot { padding: 10px 8px 14px; }
  .shell.collapsed .side-foot #btn-logout { padding: 5px 0; }
  .shell.collapsed .side-foot #btn-logout .lbl { display: none; }
  .shell.collapsed .side-foot .lbl-sm { display: inline; }
  .shell.collapsed .side-foot #build-tag { display: none; }
}

/* 只读输入框（如「验证码将发到 x***@qq.com」） */
input.ro { background: var(--bg); color: var(--text-2); }
.note-num { font-size: 13.5px; font-weight: 600; color: var(--brand); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 58px; background: var(--panel); border-bottom: 1px solid var(--line); display: flex; align-items: center; padding: 0 22px; gap: 14px; position: sticky; top: 0; z-index: 20; }
.topbar h2 { font-size: 16px; margin: 0; font-weight: 600; }
.topbar .crumb { color: var(--text-3); font-size: 13px; }
.topbar .spacer { flex: 1; }
.user-chip { display: flex; align-items: center; gap: 9px; padding: 5px 10px 5px 6px; border-radius: 999px; background: var(--bg); font-size: 13px; }
.user-avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-weight: 600; font-size: 12px; }
.content { padding: 20px 22px 48px; flex: 1; }

/* ---------- 移动端（员工多用手机打开） ---------- */
.nav-toggle {
  display: none; width: 38px; height: 38px; flex: 0 0 38px; border: 1px solid var(--line);
  background: var(--panel); border-radius: 9px; font-size: 17px; line-height: 1;
  color: var(--text); cursor: pointer; place-items: center;
}
.nav-toggle:active { background: var(--bg); }
.side-mask { display: none; }

/* 顶栏常显的「设置」按钮（手机、电脑都有，避免入口找不到） */
.topbar-icon {
  width: 34px; height: 34px; flex: 0 0 34px; padding: 0; border: 1px solid var(--line);
  background: var(--panel); border-radius: 9px; font-size: 16px; line-height: 1;
  color: var(--text-2); cursor: pointer; display: grid; place-items: center;
}
.topbar-icon:hover, .topbar-icon.on { background: var(--brand-soft); color: var(--brand); border-color: #c9dcfb; }
button.user-chip { border: 0; cursor: pointer; font-family: inherit; color: inherit; }
button.user-chip:hover { background: var(--brand-soft); }

/* 「本地缓存 · X 分钟前」提示标签（2026-10-27）：数据来自本地快照时显示，点它强制刷新 */
.cache-chip {
  padding: 4px 9px; border-radius: 999px; border: 1px dashed #c9dcfb;
  background: var(--brand-soft); color: var(--brand); font-size: 12px; line-height: 1.4;
  font-family: inherit; cursor: pointer; white-space: nowrap;
}
.cache-chip:hover { background: #e3edfe; }
.cache-chip[hidden] { display: none; }

/* ---------- 卡片 / 工具条 ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.card-head { padding: 14px 16px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.card-head h3 { margin: 0; font-size: 14.5px; font-weight: 600; }
.card-head .spacer { flex: 1; }
.card-body { padding: 16px; }
.card-body.tight { padding: 0; }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .spacer { flex: 1; }
.toolbar input[type=text], .toolbar select { width: auto; min-width: 150px; padding: 7px 10px; }
.toolbar input.search { min-width: 240px; }

/* ---------- 多行搜索框（一次查多个单号）—— js/util.js 的 autoGrow ----------
   单行时和普通输入框一模一样高；粘贴多行/多个单号后自动长高（最多 5 行再内部滚动）。
   有 2 个以上关键词时描边变蓝（is-multi），一眼看出「这框正在同时查多个」。 */
textarea.search, textarea.multi-search {
  width: 300px; min-width: 240px; min-height: 0; height: 34px;
  padding: 7px 10px; line-height: 18px; resize: none; overflow: auto;
  white-space: pre; font-size: 14px;
}
.card-head textarea.multi-search { width: 240px; min-width: 200px; }
textarea.search.is-multi, textarea.multi-search.is-multi { border-color: var(--brand); background: var(--brand-soft); }

/* ---------- 显示列（列勾选）+ 右下角翻页条 —— js/listprefs.js ---------- */
.colpick { position: relative; }
.colpick-n { color: var(--brand); font-weight: 600; font-size: 12px; }
.colpick-panel {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 40;
  width: 240px; max-height: 360px; overflow: auto;
  background: #fff; border: 1px solid var(--line-strong); border-radius: 10px;
  box-shadow: 0 12px 32px rgba(23, 35, 55, .16); padding: 10px 12px;
}
.colpick-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; font-size: 13px; }
.colpick-head .spacer { flex: 1; }
.colpick-head .link-btn { font-size: 12px; }
.colpick-list { display: flex; flex-direction: column; }
.colpick-item {
  display: flex; align-items: center; gap: 8px; padding: 4px 3px;
  font-size: 13px; border-radius: 6px; cursor: pointer;
}
.colpick-item:hover { background: var(--brand-soft); }
.colpick-item input { width: 15px; height: 15px; margin: 0; cursor: pointer; }
.colpick-item.is-lock { color: var(--text-3); cursor: default; }
.colpick-item.is-lock:hover { background: transparent; }
.colpick-panel .hint { margin: 8px 0 0; }

.pager {
  display: flex; align-items: center; justify-content: flex-end; gap: 8px;
  flex-wrap: wrap; margin-top: 14px; font-size: 12.5px; color: var(--text-2);
}
.pager .pager-info b { color: var(--text); }
.pager .pager-cap { color: var(--text-3); font-weight: normal; margin-left: 8px; }
.pager-size { display: inline-flex; align-items: center; gap: 5px; }
.pager-size select { width: auto; min-width: 76px; padding: 4px 8px; font-size: 12.5px; border-radius: 7px; }
.pg-btn {
  border: 1px solid var(--line-strong); background: #fff; padding: 4px 11px;
  border-radius: 7px; cursor: pointer; font-size: 12.5px; white-space: nowrap;
}
.pg-btn:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); }
.pg-btn:disabled { opacity: .5; cursor: not-allowed; }
.pager-nums { display: inline-flex; align-items: center; gap: 4px; }
.pg-num {
  min-width: 28px; height: 26px; padding: 0 6px; border-radius: 7px;
  border: 1px solid var(--line); background: #fff; cursor: pointer; font-size: 12.5px;
}
.pg-num:hover { border-color: var(--brand); color: var(--brand); }
.pg-num.is-on { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.pg-gap { color: var(--text-3); padding: 0 2px; }
.pager-jump { display: inline-flex; align-items: center; gap: 5px; }
.pager-jump input { width: 66px; padding: 4px 8px; font-size: 12.5px; border-radius: 7px; text-align: center; }
/* 店铺档案 / 员工账号的卡片是 tight（表格贴边）—— 翻页条得自己留出内边距，不然贴到卡片边上 */
.card-body.tight .pager { padding: 0 12px 12px; }

/* ---------- 批量勾选 + 删除 —— js/batch.js ---------- */
.batchbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 8px 12px; margin-bottom: 12px;
  background: var(--brand-soft); border: 1px solid #cfe0ff; border-radius: 9px;
  font-size: 13px;
}
.batchbar[hidden] { display: none; }          /* display:flex 会盖掉 [hidden]，必须显式写一条 */
.batchbar .spacer { flex: 1; }
.batchbar .hint { margin: 0; }
.batchbar-n { color: var(--text-2); }
.batchbar-n b { color: var(--brand); font-size: 15px; }
/* 店铺 / 员工 用的是 tight 卡片（表格贴边），操作条得自己留出内边距 */
.card-body.tight .batchbar { margin: 0 12px 12px; }
/* 批量填充控件组：物流页「发货日期」= 日期框 + 填充 / 今天 / 清空日期；
   核价页「汇率」= 数字框 + 填充汇率 / 清空汇率 */
.batchfill { display: inline-flex; align-items: center; gap: 6px; }
.batchfill input[type="date"],
.batchfill input[type="number"] {
  width: 128px; padding: 4px 6px; font-size: 13px;
  border: 1px solid var(--line, #d7dce5); border-radius: 7px; background: #fff;
}
.batchfill input[type="number"] { width: 96px; }
/* 行首勾选框列：表头是全选，行里是单选；选中的整行浅蓝底，一眼看出会被删的是哪几条 */
table.dt th .rowsel-all,
table.dt td .rowsel-box {
  width: 15px; height: 15px; margin: 0; padding: 0;
  cursor: pointer; accent-color: var(--brand);
}
table.dt td .rowsel-box { display: block; margin: 0 auto; }
table.dt tbody tr.is-sel td { background: var(--brand-soft); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 16px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 15px 16px; box-shadow: var(--shadow); }
.stat .lbl { font-size: 12.5px; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.stat .val { font-size: 25px; font-weight: 700; margin-top: 6px; letter-spacing: -.4px; }
.stat .sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.stat.accent-blue .val { color: var(--brand); }
.stat.accent-red .val { color: var(--red); }
.stat.accent-amber .val { color: var(--amber); }
.stat.accent-green .val { color: var(--green); }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table.dt { width: 100%; border-collapse: collapse; font-size: 13.2px; }
/* 列多的表（订单处理页 10 列）—— 给个下限，宁可横向滚动也不让浏览器把列压扁、内容挤成一团。
   改了那边的列宽记得同步这个数（≈ 各列 width 之和）。 */
table.dt.dt-wide { min-width: 1560px; }
table.dt th { text-align: left; padding: 10px 8px; background: #fafbfd; color: var(--text-2); font-weight: 600; font-size: 12.5px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.dt td { padding: 9px 8px; border-bottom: 1px solid #f0f2f7; vertical-align: middle; }
table.dt tbody tr:hover { background: #fafcff; }
table.dt tbody tr:last-child td { border-bottom: 0; }
table.dt .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
/* 列头筛选框：塞在 <th> 里（标签在上、筛选框在下）。这样 `thead th` 的个数不变，
   页面/测试按「第几个表头」取格子的写法不受影响。 */
table.dt th.th-filterable { padding: 6px 6px 7px; }
table.dt th .th-label { display: block; padding: 0 2px; }
table.dt th .th-filter {
  display: block; width: 100%; min-width: 56px; margin-top: 4px;
  padding: 3px 7px; font-size: 12px; font-weight: 400; text-align: left;
  border: 1px solid var(--line); border-radius: 6px; background: #fff;
  color: var(--text-1, inherit);
}
table.dt th .th-filter::placeholder { color: var(--text-3); }
table.dt th .th-filter:hover { border-color: var(--line-strong); }
table.dt th .th-filter:focus { outline: none; border-color: var(--brand, #2f6fed); box-shadow: 0 0 0 2px rgba(47,111,237,.12); }
/* 有筛选值的列头高亮一下，一眼看出这张表正在被筛
   （日期框没有 placeholder，:placeholder-shown 永远不成立 —— 下面单独用 .has-value 判断） */
table.dt th .th-filter:not(:placeholder-shown),
table.dt th .th-filter.has-value { border-color: var(--brand, #2f6fed); background: #f5f9ff; }
/* 日期列筛选：原生日期控件（点一下选，不用手打格式）。窄列里把内边距收一点，
   「2026-10-05」也放得下；右侧那个小日历图标保留（就是「可以自己选」的入口）。 */
table.dt th .th-filter-date { padding: 2px 3px; min-width: 86px; font-size: 11.5px; }
table.dt th .th-filter-date::-webkit-calendar-picker-indicator { margin-left: 2px; opacity: .65; cursor: pointer; }
table.dt th .th-filter-date:hover::-webkit-calendar-picker-indicator { opacity: 1; }
/* 日期多选（2026-10-22 用户：「日期可以多选几天」）：选过的天收成小标签排在日期框上面，
   点标签移除那一天的筛选。标签是 readonly input —— value 不算文本，th.textContent 仍只有列名。 */
table.dt th .th-dates { display: block; }
table.dt th .th-dates .th-chip {
  display: inline-block; margin: 0 3px 3px 0; padding: 1px 6px; width: auto; min-width: 0;
  font-size: 11px; line-height: 1.5; text-align: center; color: var(--brand, #2f6fed);
  border: 1px solid rgba(47, 111, 237, .45); border-radius: 20px; background: #f5f9ff; cursor: pointer;
}
table.dt th .th-dates .th-chip:hover { border-color: var(--brand, #2f6fed); background: rgba(47, 111, 237, .14); }
/* 「空」按钮（2026-10-21 用户：所有筛选项要能筛空白结果）——
   贴在筛选框右内侧：平时透明不占视觉，悬停 / 聚焦 / 已开启才露出来；
   开了以后变实心蓝，一眼看出这一列正在「只看空白」。 */
table.dt th .th-filter-box { position: relative; display: block; margin-top: 4px; }
table.dt th .th-filter-box .th-filter { margin-top: 0; padding-right: 28px; }
/* 日期框右边有「~」和「空」两个按钮 → 再多留一点内边距（避免盖住日期数字） */
table.dt th .th-filter-box .th-filter.th-filter-date { padding-right: 46px; }
/* 「~」区间模式开关（2026-10-22「日期可以按照区间选择」）：在「空」左边同一排，
   点亮后起点终点配成闭区间；样式跟着「空」走。「~」字用伪元素画（不进 th.textContent）。 */
table.dt th .th-range {
  position: absolute; right: 24px; top: 50%; transform: translateY(-50%);
  border: 0; background: transparent; color: var(--text-3);
  font-size: 12px; line-height: 1; padding: 3px 4px; border-radius: 5px;
  cursor: pointer; opacity: 0; transition: opacity .12s, background .12s, color .12s;
}
table.dt th .th-filter-box:hover .th-range,
table.dt th .th-filter-box:focus-within .th-range { opacity: .75; }
table.dt th .th-range:hover { opacity: 1; color: var(--brand); background: rgba(47, 111, 237, .12); }
table.dt th .th-range.on { opacity: 1; color: #fff; background: var(--brand); }
table.dt th .th-range::after { content: '~'; }
table.dt th .th-blank {
  position: absolute; right: 3px; top: 50%; transform: translateY(-50%);
  border: 0; background: transparent; color: var(--text-3);
  font-size: 11px; line-height: 1; padding: 3px 4px; border-radius: 5px;
  cursor: pointer; opacity: 0; transition: opacity .12s, background .12s, color .12s;
}
table.dt th .th-filter-box:hover .th-blank,
table.dt th .th-filter-box:focus-within .th-blank { opacity: .75; }
table.dt th .th-blank:hover { opacity: 1; color: var(--brand); background: rgba(47, 111, 237, .12); }
table.dt th .th-blank.on { opacity: 1; color: #fff; background: var(--brand); }
/* 「空」字用伪元素画：按钮本身没有文本 → 表头 th.textContent 仍然只有列名 */
table.dt th .th-blank::after { content: '空'; font-size: 11px; }
/* 空白模式下输入框做成虚线灰底：看得懂「现在不是按关键词筛」 */
table.dt th .th-filter.is-blank { background: #f3f5f9; border-style: dashed; }
/* 筛选没命中：保留表头，只在表体里写一行说明（用户要能就地删掉打错的筛选词） */
table.dt tbody tr td.empty-row { text-align: center; padding: 26px 12px; color: var(--text-3); background: #fff; }
table.dt tbody tr td.empty-row .empty-row-tip { display: block; margin-top: 6px; font-size: 12px; opacity: .75; }
table.dt tbody tr:hover td.empty-row { background: #fff; }
/* 日期列可点表头排序：箭头（两个小三角）走伪元素 —— th / .th-label 的 textContent
   仍是纯标签，页面与测试按表头文字取格子的写法不受影响。
   图标用 SVG 背景画（字体里的 ⇅ 太小太淡，实机上几乎看不见）。
   点一次升序（上面那个三角变蓝）、再点倒序、第三次取消。 */
table.dt th.th-sortable { cursor: pointer; user-select: none; }
table.dt th.th-sortable:hover { background: #eef4ff; color: var(--text); }
table.dt th.th-sortable::after,
table.dt th.th-sortable .th-label::after {
  content: ''; display: inline-block; width: 8px; height: 14px;
  margin-left: 5px; vertical-align: -3px; opacity: .85;
  background: no-repeat center / 8px 14px
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='14' viewBox='0 0 8 14'%3E%3Cpath d='M4 0.8 7.3 4.8H0.7Z' fill='%23a9b3c6'/%3E%3Cpath d='M4 13.2 0.7 9.2h6.6Z' fill='%23a9b3c6'/%3E%3C/svg%3E");
}
/* 有筛选框的表头是两行（标签 + 输入框），箭头只挂在标签后面，th::after 关掉 */
table.dt th.th-sortable.th-filterable::after { content: none; display: none; background: none; }
table.dt th.th-sortable:hover::after,
table.dt th.th-sortable:hover .th-label::after { opacity: 1; filter: brightness(.82); }
table.dt th.th-sorted { background: #eaf2ff; color: var(--brand, #2f6fed); }
table.dt th.th-sortable.th-asc::after,
table.dt th.th-sortable.th-asc .th-label::after {
  opacity: 1; filter: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='14' viewBox='0 0 8 14'%3E%3Cpath d='M4 0.8 7.3 4.8H0.7Z' fill='%232f6fed'/%3E%3Cpath d='M4 13.2 0.7 9.2h6.6Z' fill='%23c9d2e2'/%3E%3C/svg%3E");
}
table.dt th.th-sortable.th-desc::after,
table.dt th.th-sortable.th-desc .th-label::after {
  opacity: 1; filter: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='14' viewBox='0 0 8 14'%3E%3Cpath d='M4 0.8 7.3 4.8H0.7Z' fill='%23c9d2e2'/%3E%3Cpath d='M4 13.2 0.7 9.2h6.6Z' fill='%232f6fed'/%3E%3C/svg%3E");
}
.ta-right { text-align: right; }
.ta-center { text-align: center; }
.empty { padding: 46px 20px; text-align: center; color: var(--text-3); font-size: 13.5px; }
.row-actions { display: flex; gap: 4px; white-space: nowrap; }
.link-btn { background: none; border: 0; color: var(--brand); cursor: pointer; padding: 2px 5px; border-radius: 5px; font-size: 13px; }
.link-btn:hover { background: var(--brand-soft); }
.link-btn.danger { color: var(--red); }
.link-btn.danger:hover { background: var(--red-soft); }

/* ---------- 表格里的行内编辑（格子直接改） ---------- */
table.dt-edit td.ed { padding: 4px 6px; transition: background .15s; }
table.dt-edit td.ed input.cell,
table.dt-edit td.ed select.cell,
table.dt-edit td.ed textarea.cell {
  width: 100%; padding: 6px 7px; border: 1px solid transparent; border-radius: 7px;
  background: transparent; transition: border-color .12s, background .12s, box-shadow .12s;
}
table.dt-edit td.ed input.cell:hover,
table.dt-edit td.ed select.cell:hover,
table.dt-edit td.ed textarea.cell:hover { border-color: var(--line-strong); background: #fff; }
table.dt-edit td.ed input.cell:focus,
table.dt-edit td.ed select.cell:focus,
table.dt-edit td.ed textarea.cell:focus {
  outline: none; border-color: var(--brand); background: #fff;
  box-shadow: 0 0 0 3px var(--brand-soft);
}
/* 多行格子（2026-10-20：采购备注 / 采购渠道 / 布纱 / 米数，一行一个值）：
   回车换行、跟着内容长高（inline.js 调高度），最多 6 行左右再多就内部滚动 —— 不让一格把整屏撑开 */
table.dt-edit td.ed textarea.cell.cell-ml {
  display: block; resize: none; overflow: hidden;
  min-height: 32px; max-height: 132px;
  line-height: 1.45; white-space: pre-wrap; word-break: break-word;
}
table.dt-edit td.ed.ta-right textarea.cell.cell-ml { text-align: right; }

/* 一格拆成多小格（2026-10-20：采购备注 / 采购渠道 / 布纱 / 米数）：
   同一个订单行里纵向摆几个小格（一行一种料 / 一家渠道），旁边列还是一整个大格 ——
   行变高，看起来就是那几列拆行、其他列合并。小格之间画细线，一眼数得清几条。 */
table.dt-edit td.ed.ed-lines { padding: 0; vertical-align: top; }
table.dt-edit td.ed.ed-lines:hover { background: #fff; }
.cell-lines { display: flex; flex-direction: column; }
.cell-line { display: flex; align-items: center; border-bottom: 1px solid var(--line); }
.cell-line:last-of-type { border-bottom: 0; }
.cell-line input {
  flex: 1 1 auto; min-width: 0; border: 0; background: transparent; padding: 5px 7px;
  font: inherit; color: inherit; border-radius: 4px;
}
.cell-line input:focus { outline: none; background: #fff; box-shadow: inset 0 0 0 2px var(--brand-soft); }
/* edit.fit：小格随内容自动撑开 —— 渠道里带长单号也不许被列宽截断（列跟着变宽，表格横向滚动）。
   field-sizing 是新的 CSS（Chromium 123+）；老浏览器退回普通定宽输入框，不会更糟。 */
.cell-line input.fit { field-sizing: content; min-width: 140px; flex: 1 0 auto; }
table.dt-edit td.ed.ta-right .cell-line input { text-align: right; }
.cell-line .line-del {
  flex: 0 0 auto; border: 0; background: none; color: var(--text-3); cursor: pointer;
  padding: 0 5px; font-size: 14px; line-height: 1; opacity: 0; transition: opacity .12s;
}
.cell-line:hover .line-del { opacity: 1; }
.cell-line .line-del:hover { color: var(--red); }
.cell-line .line-del[hidden] { display: none; }
.cell-lines .line-add {
  border: 0; background: none; color: var(--text-3); cursor: pointer; font: inherit;
  font-size: 11.5px; text-align: left; padding: 2px 7px 4px; align-self: flex-start;
  opacity: 0; transition: opacity .12s;
}
table.dt-edit td.ed.ed-lines:hover .line-add,
table.dt-edit td.ed.ed-lines:focus-within .line-add,
.cell-lines .line-add:focus-visible { opacity: .6; }
.cell-lines .line-add:hover { opacity: 1; color: var(--brand); }
table.dt-edit td.ed.ta-right .cell-lines .line-add { align-self: flex-end; }
table.dt-edit td.ed input.cell[type="date"] { min-width: 88px; }
table.dt-edit td.ed input.cell[type="datetime-local"] { min-width: 152px; }
/* 2026-10-20 用户：日期列隐藏年 —— Chromium/Edge 支持把日期框的「年」段单独藏起来 */
table.dt input[type="date"]::-webkit-datetime-edit-year-field { display: none; }
table.dt-edit td.ed input.cell.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
table.dt-edit td.ed .cell-wrap { display: flex; align-items: center; gap: 6px; }
table.dt-edit td.ed .cell-wrap > [data-inline] { flex: 1 1 auto; min-width: 0; }
table.dt-edit td.ed .cell-note { flex: 0 0 auto; }
/* 靠「默认值」顶着的格子（本列为空，默认值取自同行别的列，如「交接单订单号」默认=订单号）：
   灰字提示这是默认值、还没真填 —— 点一下改了就恢复成正常颜色（见 js/inline.js 的 edit.def）。 */
table.dt-edit td.ed.cell-def input.cell { color: var(--text-3); }
table.dt-edit td.ed.cell-def input.cell:hover,
table.dt-edit td.ed.cell-def input.cell:focus { color: var(--text); }
/* 「点开编辑」型格子：看着是内容，点一下弹层去改（如订单的多片产品） */
table.dt-edit td.ed.open-cell { cursor: pointer; border-radius: 7px; transition: background .12s, box-shadow .12s; }
table.dt-edit td.ed.open-cell:hover { background: #fff; box-shadow: inset 0 0 0 1px var(--line-strong); }
table.dt-edit td.ed.open-cell:active { background: var(--brand-soft); }
table.dt-edit td.ed.open-cell .mini-line { pointer-events: none; }
table.dt-edit td.ed.saving { background: var(--amber-soft); }
table.dt-edit td.ed.ok { background: var(--green-soft); }
table.dt-edit td.ed.err { background: var(--red-soft); }

.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 500; white-space: nowrap; background: #eef1f6; color: #5b6675; }
.tag-gray { background: #eef1f6; color: #5b6675; }
.tag-blue { background: var(--brand-soft); color: var(--brand); }
.tag-green { background: var(--green-soft); color: var(--green); }
.tag-red { background: var(--red-soft); color: var(--red); }
.tag-amber { background: var(--amber-soft); color: var(--amber); }
.tag-purple { background: #f1ecfd; color: #6b4fd8; }

/* ---------- 表单 ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.form-grid .full { grid-column: 1 / -1; }
.form-section-title { grid-column: 1 / -1; font-size: 13px; font-weight: 600; color: var(--text); margin: 8px 0 12px; padding-bottom: 7px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 8px; }
.form-section-title .spacer { flex: 1; }

.item-rows { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.item-rows table { width: 100%; border-collapse: collapse; font-size: 13px; }
.item-rows th { background: #fafbfd; padding: 8px 10px; text-align: left; font-size: 12.5px; color: var(--text-2); border-bottom: 1px solid var(--line); }
.item-rows td { padding: 6px 10px; border-bottom: 1px solid #f0f2f7; }
.item-rows input, .item-rows select { padding: 6px 8px; font-size: 13px; }
.item-rows tr:last-child td { border-bottom: 0; }
.item-total { display: flex; justify-content: flex-end; gap: 26px; padding: 11px 14px; background: #fafbfd; border-top: 1px solid var(--line); font-size: 13px; }
.item-total b { font-size: 15px; color: var(--brand); }

/* ---------- Modal ---------- */
.layer { position: fixed; inset: 0; z-index: 100; display: none; }
.layer.show { display: block; }
.layer .mask { position: absolute; inset: 0; background: rgba(19, 27, 42, .42); }
.modal { position: relative; margin: 5vh auto; background: var(--panel); border-radius: 13px; box-shadow: 0 22px 60px rgba(15, 23, 38, .3); max-height: 90vh; display: flex; flex-direction: column; width: calc(100% - 32px); animation: pop .16s ease-out; }
.modal-sm { max-width: 430px; margin-top: 22vh; }
@keyframes pop { from { transform: translateY(10px); opacity: 0; } }
.modal-head { padding: 15px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; }
.modal-head h3 { margin: 0; font-size: 15.5px; font-weight: 600; }
.modal-x { margin-left: auto; border: 0; background: none; font-size: 23px; line-height: 1; cursor: pointer; color: var(--text-3); padding: 0 4px; }
.modal-x:hover { color: var(--text); }
.modal-body { padding: 18px; overflow-y: auto; }
.modal-foot { padding: 13px 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 9px; background: #fcfdff; border-radius: 0 0 13px 13px; }
.confirm-msg { margin: 0; color: var(--text-2); }

.detail-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 18px; }
.detail-grid .k { font-size: 12px; color: var(--text-3); }
.detail-grid .v { font-size: 13.5px; word-break: break-all; }

/* ---------- Toast ---------- */
.toast-layer { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: #26313f; color: #fff; padding: 9px 17px; border-radius: 9px; font-size: 13.5px; box-shadow: 0 8px 26px rgba(15, 23, 38, .28); animation: drop .2s ease-out; max-width: 560px; }
.toast-error { background: #b8352c; }
.toast-success { background: #157f5c; }
.toast.out { opacity: 0; transform: translateY(-8px); transition: all .3s; }
@keyframes drop { from { transform: translateY(-12px); opacity: 0; } }

/* ---------- 其他 ---------- */
.hint { font-size: 12.5px; color: var(--text-3); }
.hint-box { background: var(--brand-soft); border: 1px solid #d6e4ff; color: #24509e; padding: 10px 13px; border-radius: 8px; font-size: 13px; margin-bottom: 14px; }
.warn-box { background: var(--amber-soft); border: 1px solid #f6e0b8; color: #8a5a09; padding: 10px 13px; border-radius: 8px; font-size: 13px; margin-bottom: 14px; }
/* 首次上手引导条（如「还没有员工账号，先建管理员」） */
.setup-banner { display: flex; align-items: center; gap: 12px; background: var(--brand-soft); border: 1px solid #c9dcfb; border-radius: 10px; padding: 13px 15px; margin-bottom: 16px; }
.setup-ico { font-size: 20px; line-height: 1; flex: 0 0 auto; }
.setup-txt { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 3px; font-size: 13px; color: var(--text-2); line-height: 1.55; }
.setup-txt b { color: var(--brand); font-size: 14px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.muted { color: var(--text-3); }
.nowrap { white-space: nowrap; }
.mt8 { margin-top: 8px; } .mt14 { margin-top: 14px; } .mb0 { margin-bottom: 0; }
.drop-zone { border: 1.5px dashed var(--line-strong); border-radius: 10px; padding: 26px; text-align: center; color: var(--text-2); cursor: pointer; transition: all .15s; background: #fcfdff; }
.drop-zone:hover, .drop-zone.over { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.map-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 16px; }
.map-item { display: flex; align-items: center; gap: 9px; }
.map-item label { flex: 0 0 108px; font-size: 13px; color: var(--text-2); }
.map-item select { flex: 1; }
.preview-box { max-height: 260px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
/* 导入页「未识别」列的手动匹配下拉框：要显眼，但别把行撑高 */
.map-sel { height: 30px; padding: 0 8px; font-size: 12.5px; border: 1px solid #e3b0b0; background: #fff7f7; color: var(--text); border-radius: 6px; max-width: 260px; }
.map-sel:hover { border-color: var(--red); }
.map-sel:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); background: #fff; }
.spin-inline { display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(255, 255, 255, .4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -2px; }

@media (max-width: 900px) {
  /* 侧边栏抽屉：必须靠 ☰ 打开，否则手机上无法切换页面 */
  .nav-toggle { display: grid; }
  /* 收起侧栏是电脑端的事，手机上留位置给 ☰ */
  #btn-collapse { display: none; }
  .sidebar { position: fixed; left: -216px; z-index: 60; transition: left .2s; box-shadow: 0 0 44px rgba(10, 18, 32, .38); }
  .sidebar.open { left: 0; }
  .side-mask { display: block; position: fixed; inset: 0; background: rgba(17, 25, 40, .45); z-index: 55; opacity: 0; pointer-events: none; transition: opacity .2s; }
  .side-mask.show { opacity: 1; pointer-events: auto; }

  .topbar { height: 54px; padding: 0 12px; gap: 10px; }
  .topbar h2 { font-size: 15px; }
  .topbar-icon { width: 32px; height: 32px; flex: 0 0 32px; font-size: 15px; }
  .cache-chip { font-size: 11px; padding: 3px 7px; }
  .user-chip { padding: 4px; }
  .user-chip span { display: none; }
  .content { padding: 12px 12px 44px; }

  .form-grid, .map-grid, .detail-grid { grid-template-columns: 1fr; }
  .card-body { padding: 13px; }
  .card-head { padding: 12px 13px; flex-wrap: wrap; }
  .toolbar { gap: 8px; }
  .toolbar > .spacer { display: none; }
  .setup-banner { flex-wrap: wrap; }
  .setup-banner .btn { width: 100%; }

  .modal { margin: 2vh auto; width: calc(100% - 20px); max-height: 94vh; }
  .modal-sm { margin-top: 12vh; }
  .modal-body { padding: 14px; }

  .login-page { padding: 14px; align-items: flex-start; padding-top: 7vh; }
  .login-card { padding: 26px 20px 22px; }
  .tabs button { font-size: 12.5px; padding: 8px 4px; white-space: nowrap; }

  /* 明细表窄屏更紧凑，避免横向滚动过多 */
  .item-rows table.mini { min-width: 780px; }
  .rows-block { padding: 2px 10px 10px; }
}
/* ---------- 面料采购业务补充 ---------- */
.form-grid.cols3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.req { color: var(--red); font-weight: 600; }

.rows-block { border: 1px solid var(--line); border-radius: 10px; padding: 2px 14px 14px; margin-bottom: 12px; background: #fcfdff; }
.rows-block-head { display: flex; align-items: center; gap: 10px; padding: 11px 0 6px; font-size: 13.5px; }
.rows-block-head .spacer { flex: 1; }
.rows-block .form-section-title { margin-top: 6px; }

.item-rows { overflow-x: auto; }
.item-rows table.mini { min-width: 920px; }
.item-rows table.mini textarea { min-height: 36px; resize: vertical; }
.item-rows table.mini th, .item-rows table.mini td { white-space: nowrap; }

.chk { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); cursor: pointer; }
.chk input { width: auto; }
/* 员工账号表单里的「页面权限」勾选区（2026-10-17）：按左侧菜单的分组分栏，一眼对上。
   两列小卡片，窄屏收成一列。 */
.perm-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 6px; }
.perm-group { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fafbfe; }
.perm-group-title { font-size: 12px; font-weight: 600; color: var(--text-3); margin-bottom: 5px; letter-spacing: .3px; }
.perm-group .chk { display: flex; padding: 3px 0; }
.perm-group .chk input:disabled + span { color: var(--text-3); }
.perm-group .chk span { flex: 1; }
@media (max-width: 560px) {
  .perm-grid { grid-template-columns: 1fr; }
}

.mini-line { font-size: 12.5px; color: var(--text-2); line-height: 1.55; }
.mini-line + .mini-line { border-top: 1px dashed #eef1f6; }

/* 列表里的长文本（订单处理页的「问题面料登记」）—— 截断成一行，鼠标悬停看全文，
   不然一段话会把整列撑得没法看。 */
.issue-text { color: var(--red); }
/* 空的「问题面料登记」不该也是红的 —— 用 :placeholder-shown 认「空」：
   有 placeholder 又没输入时它才为真，所以空格子保持普通输入框的样子，填了才标红。 */
input.cell.issue-text { font-weight: 600; text-overflow: ellipsis; }
input.cell.issue-text:placeholder-shown { color: var(--text); font-weight: 400; }
/* 「另有 N」徽标：一单多批 / 多片时，除主值外的其余值挂在这，悬停看具体值 */
.cell-more {
  display: inline-block;
  font-size: 11.5px; color: var(--text-3); background: #f1f3f7; border-radius: 999px;
  padding: 1px 7px; white-space: nowrap; cursor: help;
}

/* 只读列也能挂小徽标（如「订单处理」里汇总来的米数：合计 + 「N 批」）——
   可编辑格的 .cell-wrap 样式只写在 td.ed 下，这里给只读格补一份，横排、不换行。 */
table.dt td:not(.ed) .cell-wrap { display: flex; align-items: center; gap: 6px; }
table.dt td:not(.ed) .cell-wrap > :first-child { flex: 0 1 auto; min-width: 0; }
table.dt td:not(.ed) .cell-note { flex: 0 0 auto; }
table.dt td.ta-right:not(.ed) .cell-wrap { justify-content: flex-end; }

/* 「订单处理」的只读汇总列（采购渠道 / 布纱 / 米数）：一单几条采购行就竖着摆几行
   —— 用户 2026-10-21 要求「所有行都要展示」，别再藏进「另有 N」的悬停里。
   米数分几批时最后一行是合计，用一条虚线跟每批的量分开。 */
.cell-stack { display: flex; flex-direction: column; gap: 1px; line-height: 1.5; }
.cell-stack-line { white-space: pre-wrap; word-break: break-word; }
.cell-stack .total {
  color: var(--text-3); font-weight: 600;
  margin-top: 1px; padding-top: 1px; border-top: 1px dashed var(--line);
}

/* 订单处理 · 到货日期格（2026-10-29）：一批一行，点行改日期，行尾「×」删这一批。
   × 默认藏起来（悬停那行才出现），免得满屏都是叉；删过内容会有弹窗再确认。 */
.arr-line { display: flex; align-items: center; gap: 3px; }
.arr-line .arr-date { flex: 1 1 auto; min-width: 0; }
.arr-line .arr-del {
  flex: 0 0 auto; border: none; background: none; cursor: pointer;
  color: var(--text-3); font-size: 12px; line-height: 1; padding: 0 3px;
  border-radius: 4px; visibility: hidden;
}
.arr-line:hover .arr-del { visibility: visible; }
.arr-line .arr-del:hover { color: var(--red); background: #fdecec; }
/* 批末尾操作条：＋ 加一格 / 删除这一批。
   「删除这一批」是**删整行采购的唯一入口**（还要过确认窗）—— 日期行的 × 只删日期，两者物理分开，
   免得想删一个日期却把整条采购记录删了。 */
.arr-ops { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.arr-ops .arr-add { cursor: pointer; }
.arr-ops .arr-add:hover .muted { color: var(--text-1); }
.arr-ops .arr-del-batch {
  border: none; background: none; cursor: pointer; padding: 0;
  color: var(--text-3); font: inherit; font-size: 11.5px; line-height: 1.4;
}
.arr-ops .arr-del-batch:hover { color: var(--red); text-decoration: underline; }

.preview-box table.dt { font-size: 12.5px; }
.preview-box table.dt th, .preview-box table.dt td { padding: 7px 9px; white-space: nowrap; }

.detail-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.detail-grid .k { color: var(--text-3); font-size: 12px; }
.detail-grid .v { font-size: 13.5px; word-break: break-word; }

@media (max-width: 900px) {
  .form-grid.cols3, .detail-grid { grid-template-columns: 1fr; }
}

/* ---------- 订单图片（运营录入 / 订单详情） ---------- */
.img-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.img-cell {
  position: relative; margin: 0; width: 104px; height: 104px;
  border: 1px solid var(--line-strong); border-radius: 10px; overflow: hidden; background: #f7f9fd;
}
.img-thumb { width: 100%; height: 100%; display: grid; place-items: center; }
.img-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; }
.img-state { font-size: 12px; color: var(--text-3); }
.img-del {
  position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border: 0; border-radius: 50%;
  background: rgba(15, 23, 38, .6); color: #fff; font-size: 15px; line-height: 1;
  display: grid; place-items: center; cursor: pointer; padding: 0;
}
.img-del:hover { background: var(--red); }
.img-add {
  width: 104px; height: 104px; padding: 0; cursor: pointer;
  border: 1.5px dashed var(--line-strong); border-radius: 10px; background: #fcfdff; color: var(--text-2);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  font-size: 12px; transition: all .15s;
}
.img-add:hover:not(:disabled) { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.img-add:disabled { opacity: .6; cursor: progress; }
.img-add b { font-size: 19px; font-weight: 600; line-height: 1; }
.img-lightbox { text-align: center; }
.img-lightbox img { max-width: 100%; max-height: 74vh; border-radius: 8px; }

/* 外部图片网址：入口按钮、粘贴行、角标 */
.img-add.alt { background: #fffdf7; }
.img-add.alt:hover:not(:disabled) { border-color: var(--amber); background: var(--amber-soft); color: var(--amber); }
.img-url-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.img-url-row .url-input { flex: 1 1 280px; min-width: 180px; }
.img-badge {
  position: absolute; left: 4px; bottom: 4px; padding: 2px 5px; border-radius: 4px;
  background: rgba(15, 23, 38, .62); color: #fff; font-size: 10px; line-height: 1.35;
}

/* 只读缩略图（列表 / 详情里的小图） */
.img-grid.readonly { flex-wrap: nowrap; gap: 5px; }
.img-grid.readonly .img-cell { width: 38px; height: 38px; border-radius: 7px; }
.img-grid.readonly .img-state { font-size: 10px; }
/* 采购页「产品图片」列：一行只露一张（列窄），比别处的列表缩略图稍大一点才看得出是什么布 */
.strip-host.pv-img .img-grid.readonly.pv-1 .img-cell { width: 46px; height: 46px; border-radius: 8px; }
.strip-host.pv-img .img-more { align-self: center; font-size: 11px; color: var(--text-3); }

@media (max-width: 900px) {
  .img-cell, .img-add { width: 84px; height: 84px; }
  .img-grid { gap: 8px; }
}

@media print {
  .sidebar, .topbar, .toolbar, .card-head .btn, .pager, .colpick, .batchbar { display: none !important; }
  body { background: #fff; }
}

/* ---------- 交接单（跟单员用） ---------- */
.hv-tools {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 8px 11px; margin-bottom: 10px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  font-size: 12.5px; color: var(--text-2);
}
.hv-tools-label { font-weight: 600; }
.hv-tool { display: inline-flex; align-items: center; gap: 8px; }
.hv-tool input[type=range] { width: 168px; margin: 0; }
.hv-tool b { color: var(--brand); min-width: 44px; font-variant-numeric: tabular-nums; }
.hv-tools-tip { color: var(--text-3); }
.hv-tools-tip u { text-decoration-style: dotted; }
/* 版式面板：前三行行高 + 五个字号，展开后一行排不下会自己换行 */
.hv-style-panel {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); gap: 8px 18px;
  padding: 10px 11px; margin: -2px 0 10px;
  background: #fbfcfe; border: 1px solid var(--line); border-top: 0;
  border-radius: 0 0 8px 8px; font-size: 12.5px; color: var(--text-2);
}
.hv-style-panel[hidden] { display: none; }
.hv-style-panel .hv-tools-tip { grid-column: 1 / -1; }
/* 列宽（%）：六个数字框 + 平均分配（2026-10-20 用户要求「列宽要可以调节」，
   除了拖表头边框，也能直接填数；六个框永远合计 100%） */
.hv-colw {
  grid-column: 1 / -1; display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap;
  padding-bottom: 6px; border-bottom: 1px dashed var(--line);
}
.hv-colw-item { display: inline-flex; align-items: center; gap: 5px; color: var(--text-3); }
.hv-colw-item input {
  width: 62px; padding: 3px 6px; text-align: right; font-variant-numeric: tabular-nums;
  border: 1px solid var(--line-strong); border-radius: 5px; background: #fff; color: var(--text);
}
.hv-colw-item input:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
.hv-colw .hv-tools-tip { color: var(--text-3); }

.hv-paper {
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 12px;
  overflow-x: auto;
}
table.hv { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: var(--hv-fs-line, 13px); }
table.hv td {
  border: 1px solid #8c98a8;
  padding: 5px 7px;
  text-align: center;
  vertical-align: middle;
  word-break: break-word;
  line-height: 1.45;
}
table.hv td.tl { text-align: left; }
/* 前三行：行高与字号都由版式滑块控制（用户 2026-10-19 要求行距紧凑、国家人名小一号） */
table.hv tr.hv-meta1 > td { height: var(--hv-r1-h, 28px); padding: 2px 7px; font-size: var(--hv-fs1, 12px); }
table.hv tr.hv-meta2 > td { height: var(--hv-r2-h, 22px); padding: 2px 7px; font-size: var(--hv-fs2, 10.5px); }
table.hv tr.hv-meta1 > td.hv-title {
  height: var(--hv-r1-h, 28px);
  font-size: calc(var(--hv-fs1, 12px) * 1.45);
  font-weight: 700; letter-spacing: 3px;
}
table.hv .hv-key { text-align: left; color: var(--text-2); white-space: nowrap; }
table.hv .hv-head td {
  background: #eef1f6; font-weight: 600; position: relative;
  height: var(--hv-r3-h, 22px); padding: 3px 7px; font-size: var(--hv-fs-head, 11.5px);
}
/* 表头文字也是模板内容：点着就能改（第一格默认空着，空的时候给一行浅灰提示，打印不印） */
table.hv .hv-head-txt { display: block; outline: none; cursor: text; min-height: 1em; }
table.hv .hv-head-txt:focus { background: #fffbe9; }
table.hv .hv-head-txt:empty::before { content: attr(data-ph); color: #98a2b3; font-weight: 400; }
table.hv .hv-head-txt.hv-edited { background: #fff8e1; box-shadow: inset 3px 0 0 #f0b429; }
/* 明细行高度由「行高」滑块控制（--hv-row-h 写在 table 的行内样式上） */
table.hv tbody tr.hv-line td { height: var(--hv-row-h, 30px); font-size: var(--hv-fs-line, 14px); }
/* 备注行高度由「备注行行高」滑块控制（2026-10-26 用户要求：备注写得多能单独调高） */
table.hv .hv-remark {
  height: var(--hv-remark-h, 56px); padding: 6px 8px; text-align: left; vertical-align: top;
  min-height: 24px; white-space: pre-wrap; font-size: var(--hv-fs-remark, 12px);
}
/* 单格字号（2026-10-26）：选中哪一格，面板就改哪一格 —— 描一圈虚线标出来，打印去掉 */
table.hv td.hv-cellsel, table.hv .hv-head-txt.hv-cellsel {
  box-shadow: inset 0 0 0 2px #2b6cff;
}
.hv-cellfs {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 4px 0 2px;
}
.hv-cellfs input[type="range"] { width: 160px; }
.hv-cellfs input[type="range"]:disabled { opacity: .45; cursor: not-allowed; }
/* 交接单：每个值格子都能直接点着改（原来只有备注能改）。
   鼠标移上去 / 聚焦给点提示；手改过的格子左边一条黄杠 —— 打印时自动去掉，不会印到纸上。 */
table.hv td.hv-edit { outline: none; cursor: text; }
table.hv td.hv-edit:hover { background: #f5f8ff; }
table.hv td.hv-edit:focus { background: #fffbe9; }
table.hv td.hv-edited { background: #fff8e1; box-shadow: inset 3px 0 0 #f0b429; }
table.hv td.hv-remark:empty::before { content: attr(data-ph); color: var(--text-3); }
.hv-edited-n { color: #8a6a1f; }
/* 表头格右边缘的拖拽手柄：拖动改这一列与下一列的宽度 */
.hv-grip {
  position: absolute; top: 0; right: -3px; width: 9px; height: 100%;
  cursor: col-resize; z-index: 3; border-radius: 2px;
}
.hv-grip:hover { background: rgba(43, 108, 255, .35); }
body.hv-resizing, body.hv-resizing * { cursor: col-resize !important; user-select: none !important; }

/* 合并格子（2026-10-20）：进「合并模式」后在明细区拖选一片，选中的格子描蓝底；
   合并 / 取消合并的按钮在纸面上方的粘条里（明细很长时滚下去也够得着）。 */
.btn.on { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.hv-merge-bar {
  position: sticky; top: 6px; z-index: 6;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 7px 11px; margin: 0 0 10px;
  background: #eef4ff; border: 1px solid #cfdcff; border-radius: 8px;
  font-size: 12.5px; color: var(--text-2);
}
.hv-merge-bar[hidden] { display: none; }
.hv-merge-bar b { color: var(--brand); }
.hv-merge-info { font-variant-numeric: tabular-nums; }
/* 隐藏行（2026-10-26）：隐藏的行不画在纸上，底下留一条灰条写清楚藏了哪几行 ——
   灰条带 no-print，打印时连自己一起消失（这一条不能进 @media print 的例外里）。 */
table.hv tr.hv-hidebar td {
  height: auto; padding: 5px 8px; text-align: left; vertical-align: middle;
  background: #f6f7f9; color: var(--text-3); font-size: 12px;
  border-top: 1px dashed #c9ced6;
}
.hv-hidebar-txt { margin-right: 8px; color: #6b7280; }
.hv-hidechip {
  margin: 0 4px 0 0; padding: 1px 7px; font-size: 12px; cursor: pointer;
  border: 1px solid #cbd2db; border-radius: 10px; background: #fff; color: #4b5563;
}
.hv-hidechip:hover { border-color: var(--brand); color: var(--brand); }
.hv-unhide-all { margin-left: 4px; }

/* 布已到日期多行编辑器（订单处理）：一行一个日期 + 删除 */
.ad-list { display: flex; flex-direction: column; gap: 6px; max-height: 46vh; overflow: auto; }
.ad-row { display: flex; align-items: center; gap: 8px; }
.ad-row input.ad-date { flex: 1; padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; }
.ad-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
table.hv.hv-merging td.hv-edit { cursor: cell; }
table.hv.hv-merging { user-select: none; }
table.hv td.hv-sel, table.hv td.hv-edit.hv-sel {
  background: #dbe7ff !important;
  box-shadow: inset 0 0 0 1px #3f74d8;
}

@media print {
  .no-print { display: none !important; }
  /* 提示气泡是屏幕上的东西：刚点完「隐藏这一行」就按打印，气泡别跟着印到纸上 */
  .toast-layer { display: none !important; }
  .content { padding: 0 !important; }
  .card { border: none !important; box-shadow: none !important; }
  .card-body { padding: 0 !important; }
  .hv-paper { border: none; padding: 0; border-radius: 0; overflow: visible !important; }
  /* 打印管线（真机打印 / 另存 PDF）两个坑都会吃掉第三行（表头行）的竖线：
     ① border-collapse 的共享边框在打印栅格化时可能整段被丢（2026-10-19 用户反馈）；
     ② 不透明背景会把合并边框盖住 —— 表头行是全表唯一带背景的行，所以只有它没竖线。
     免疫方案：改 separate + spacing 0（边框归各格自己画，不共享），
     边框拆成「每格画左/上 + 表格画右/下」，内外粗细均匀都是 1px 不会叠成 2px；
     背景一律透明。 */
  table.hv { border-collapse: separate; border-spacing: 0; border-right: 1px solid #000; border-bottom: 1px solid #000; }
  table.hv td { border: none; border-left: 1px solid #000; border-top: 1px solid #000; }
  table.hv .hv-head td { background: none; }
  table.hv .hv-head-txt:empty::before { content: ''; }
  table.hv .hv-head-txt.hv-edited { background: none; box-shadow: none; }
  table.hv td.hv-edited { background: none; box-shadow: none; }
  table.hv td.hv-sel { background: none !important; box-shadow: none !important; }
  table.hv td.hv-cellsel, table.hv .hv-head-txt.hv-cellsel { box-shadow: none !important; }
  table.hv td.hv-remark:empty::before { content: ''; }
  /* 分页：前三行放在 thead 里，打印 / 存 PDF 时浏览器会把它重复到**每一页的顶上**（页眉）；
     一行明细不被拦腰截断（宁可整行挪到下一页）。 */
  table.hv thead { display: table-header-group; }
  table.hv tbody { display: table-row-group; }
  table.hv tr { break-inside: avoid; page-break-inside: avoid; }
  @page { margin: 12mm; }
}

/* ---------- 宽/高/数量/加工方式的多行格子（Alt+Enter 换行，自动增高） ---------- */
.item-rows table.mini textarea.cell-ml {
  width: 100%;
  box-sizing: border-box;
  resize: none;
  overflow: hidden;
  min-height: 32px;
  line-height: 1.45;
  white-space: pre-wrap;   /* 回车换行保留，长内容自动折行 */
  word-break: break-word;
}

/* ---------- 表单里的多行字段（2026-10-20：采购备注 / 渠道 / 布纱 / 米数） ----------
   一行一个值，回车换行；内容多了自己长高（components.js 的 autoGrowFields） */
.field textarea.cell-ml {
  width: 100%;
  box-sizing: border-box;
  min-height: 38px;
  max-height: 160px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ---------- 批量解析进度（导入 1000+ 单时用；100 秒级任务没进度用户会以为卡死） ---------- */
.batch-progress {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  z-index: 90; width: 420px; max-width: calc(100vw - 32px);
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 10px 32px rgba(15, 23, 42, .16); padding: 14px 16px 15px;
}
.batch-progress .bp-head { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; color: var(--text); }
.batch-progress .bp-head b { color: var(--brand); }
.batch-progress .bp-sub { font-size: 12px; color: var(--text-3); margin-top: 3px; }
.batch-progress .bp-bar { height: 6px; border-radius: 99px; background: #eef1f6; margin-top: 10px; overflow: hidden; }
.batch-progress .bp-bar i { display: block; height: 100%; width: 0; background: var(--brand); border-radius: 99px; transition: width .18s ease; }

/* ---------- 导出 Excel 弹窗（所有列表页共用，见 js/exportx.js） ---------- */
.exp-box { display: flex; flex-direction: column; gap: 10px; }
.exp-lbl { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.exp-range { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.exp-radio { display: flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.exp-radio input { width: 15px; height: 15px; margin: 0; cursor: pointer; }
.exp-head { display: flex; align-items: center; gap: 10px; }
.exp-head .spacer { flex: 1; }
.exp-cols {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 2px 10px;
  max-height: 300px; overflow-y: auto; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--bg-soft, #fafbfc);
}
.exp-item {
  display: flex; align-items: center; gap: 8px; padding: 4px 3px;
  font-size: 13px; border-radius: 6px; cursor: pointer;
}
.exp-item:hover { background: var(--brand-soft); }
.exp-item input { width: 15px; height: 15px; margin: 0; cursor: pointer; }

/* 新加的一行闪一下（采购页「+ 一行」建完滚到眼前，见 views/purchase.js） */
@keyframes rowFlash { 0% { background: #fff6d0; } 100% { background: transparent; } }
tr.row-new td { animation: rowFlash 1.8s ease; }
