/* ═══════════════════════════════════════════════════════════════
   客户工单系统 · 全局样式
   统一字体层级 / 颜色 / 圆角 / 间距，各页面只写差异部分
   ═══════════════════════════════════════════════════════════════ */

:root {
  /* 底色与表面 */
  --bg: #f4f6fa;
  --bg-soft: #eef1f6;
  --card: #ffffff;
  --card-soft: #f8fafc;

  /* 分隔线 */
  --line: #e8ecf3;
  --line-strong: #d5dbe5;

  /* 文字 */
  --text: #161c26;
  --text-2: #3a4351;
  --muted: #5c6573;
  --faint: #858e9c;

  /* 品牌色 */
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --brand-soft: #eef4ff;
  --brand-line: #c7d9ff;

  /* 语义色 */
  --danger: #dc2626;
  --danger-dark: #b91c1c;
  --danger-soft: #fef2f2;
  --danger-line: #fecaca;
  --warn: #b45309;
  --warn-soft: #fffbeb;
  --warn-line: #fde68a;
  --ok: #15803d;
  --ok-soft: #ecfdf5;
  --ok-line: #bbf7d0;

  /* 字号 */
  --fs-xs: 0.75rem;      /* 12 · 角标、辅助 */
  --fs-sm: 0.8125rem;    /* 13 · 标签、说明 */
  --fs-md: 0.9375rem;    /* 15 · 正文 */
  --fs-lg: 1.0625rem;    /* 17 · 小节标题 */
  --fs-xl: 1.25rem;      /* 20 · 页面标题 */
  --fs-2xl: 1.5rem;      /* 24 · 关键数字 */

  /* 控件高度：同页同行必须一致，别再各写各的 */
  --ctl-h: 38px;
  --ctl-h-sm: 32px;

  /* 圆角 */
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 18px;

  /* 阴影 */
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-sm: 0 2px 8px -2px rgba(16, 24, 40, .08), 0 1px 3px rgba(16, 24, 40, .04);
  --shadow: 0 10px 32px -8px rgba(16, 24, 40, .12);
  --shadow-lg: 0 20px 56px rgba(16, 24, 40, .18);

  /* 聚焦圈 */
  --ring: 0 0 0 3px rgba(37, 99, 235, .16);

  --mono: ui-monospace, "Cascadia Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

html, body {
  margin: 0;
  padding: 0;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei",
               "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", sans-serif;
  font-size: var(--fs-md);
  line-height: 1.68;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* 毛玻璃背景：淡蓝渐变 + 极细斜纹，卡片/表格浮在上面（2026-11-21 用户要求，参照 ALLO） */
body {
  background: linear-gradient(135deg, #e4ecfb 0%, #f2f5fb 32%, #f8fafd 58%, #e8effa 100%);
  background-attachment: fixed;
  background-color: var(--bg);
  min-height: 100vh;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg width='64' height='64' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M64 0L0 64' stroke='rgba(37,99,235,0.05)' stroke-width='0.8' fill='none'/%3E%3Cpath d='M0 0L64 64' stroke='rgba(37,99,235,0.03)' stroke-width='0.6' fill='none'/%3E%3Ccircle cx='32' cy='32' r='1.1' fill='rgba(37,99,235,0.05)'/%3E%3C/svg%3E");
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; color: var(--text); letter-spacing: -.01em; }
h1 { font-size: var(--fs-xl); line-height: 1.35; }
h2 { font-size: var(--fs-lg); line-height: 1.4; }
h3 { font-size: var(--fs-md); line-height: 1.45; }
p { margin: 8px 0; }

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.mono { font-family: var(--mono); }
.num, .tnum { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: var(--fs-sm); }
.strong { font-weight: 600; }

/* ── 登录页 ── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background:
    radial-gradient(900px 420px at 50% -10%, #e6efff 0%, rgba(230, 239, 255, 0) 65%),
    var(--bg);
}
.login-card {
  width: 100%;
  max-width: 372px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 30px 26px 24px;
  box-shadow: var(--shadow);
}
.login-card h1 { font-size: 1.375rem; margin-bottom: 4px; }
.login-card .sub { margin: 0 0 24px; color: var(--muted); font-size: var(--fs-sm); }
.login-card label { display: block; margin-bottom: 16px; }
.login-card label span { display: block; font-size: var(--fs-sm); color: var(--text-2); margin-bottom: 6px; font-weight: 500; }
.login-card button.primary { width: 100%; height: 42px; font-size: var(--fs-md); margin-top: 4px; }
.hint { color: var(--muted); font-size: var(--fs-sm); line-height: 1.65; margin: 20px 0 0; }

/* ── 表单控件 ── */
input[type=text], input[type=password], input[type=search], input[type=number],
input[type=date], input[type=tel], input[type=email], select, textarea {
  width: 100%;
  min-height: var(--ctl-h);
  padding: 0 11px;
  line-height: 1.4;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, .82);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  font: inherit;
  font-size: var(--fs-md);
  color: inherit;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
textarea { min-height: 90px; resize: vertical; line-height: 1.6; }
input::placeholder, textarea::placeholder { color: var(--faint); }
input:hover, select:hover, textarea:hover { border-color: #c2cad6; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: var(--ring);
}
input:disabled, select:disabled, textarea:disabled {
  background: var(--card-soft);
  color: var(--muted);
  cursor: not-allowed;
}
input[type=checkbox], input[type=radio] { accent-color: var(--brand); width: 15px; height: 15px; }
label { color: var(--text-2); }

/* ── 按钮 ── */
button {
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--text);
  padding: 0 14px;
  min-height: var(--ctl-h);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-xs);
  transition: background .15s, border-color .15s, box-shadow .15s, color .15s;
  white-space: nowrap;
}
button:hover { background: var(--card-soft); border-color: #c2cad6; }
button:active { box-shadow: none; transform: translateY(.5px); }
button:focus-visible { outline: none; box-shadow: var(--ring); }
button:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }
button.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  font-weight: 500;
  box-shadow: 0 1px 2px rgba(37, 99, 235, .28);
}
button.primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
button.small { padding: 0 11px; min-height: var(--ctl-h-sm); font-size: var(--fs-sm); }
button.link {
  border: none; background: none; color: var(--brand);
  padding: 0; min-height: 0; font-size: var(--fs-sm);
  box-shadow: none;
}
button.link:hover { text-decoration: underline; background: none; }

.error { color: var(--danger); font-size: var(--fs-sm); margin: 12px 0 0; }

/* ── 顶栏 / 布局 ── */
.topbar {
  background: rgba(255, 255, 255, .78);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar .brand {
  font-weight: 600;
  font-size: var(--fs-md);
  color: var(--text);
  letter-spacing: -.01em;
}
.topbar .who { color: var(--muted); font-size: var(--fs-sm); }
.topbar .spacer { flex: 1; }
.topbar button { box-shadow: none; }
.topbar button:hover { box-shadow: var(--shadow-xs); }

/* 流畅模式（老电脑/Win7）：毛玻璃在软件渲染下极慢，关掉模糊改实底（2026-11-21） */
html.perf-lite .card,
html.perf-lite .banner,
html.perf-lite .topbar,
html.perf-lite .modal,
html.perf-lite #side-rail,
html.perf-lite #rail-toggle,
html.perf-lite .stat,
html.perf-lite input,
html.perf-lite select,
html.perf-lite textarea,
html.perf-lite table.items tbody tr {
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}
html.perf-lite .card,
html.perf-lite .banner,
html.perf-lite .modal,
html.perf-lite #side-rail {
  background: #fff !important;
}
html.perf-lite .topbar { background: #fff !important; }
html.perf-lite .stat { background: #f6f8fb !important; }
html.perf-lite input,
html.perf-lite select,
html.perf-lite textarea { background: #fff !important; }
html.perf-lite body {
  background: #f4f6fa !important;
  background-image: none !important;
}
html.perf-lite body::before { display: none !important; }
/* 老电脑：动画、阴影、悬浮、粘性表头全砍掉，能省一点是一点（2026-11-21） */
html.perf-lite *,
html.perf-lite *::before,
html.perf-lite *::after {
  transition: none !important;
  animation: none !important;
  box-shadow: none !important;
  text-shadow: none !important;
  filter: none !important;
}
html.perf-lite .card { border: 1px solid #e8ecf3 !important; }
html.perf-lite tbody tr:hover { background: transparent !important; }
html.perf-lite .stat:hover { background: inherit !important; }
html.perf-lite .tbl-scroll thead th { position: static !important; }
html.perf-lite .modal-bg { background: rgba(17, 24, 39, .35) !important; }
html.perf-lite .submitbar { background: #fff !important; }

/* 右侧竖排面板：宽屏把整条顶栏收进来（标题/登录名/按钮），窄屏回顶栏横排（2026-11-21） */
#side-rail { display: flex; align-items: center; gap: 6px; margin-left: 8px; }
body.has-rail .topbar { display: none; }
body.has-rail #side-rail {
  position: fixed;
  right: 18px;
  top: 16px;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  width: 160px;
  margin: 0;
  padding: 14px 12px;
  background: rgba(255, 255, 255, .9);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  backdrop-filter: saturate(180%) blur(12px);
  border: 1px solid rgba(255, 255, 255, .7);
  border-radius: var(--radius);
  box-shadow: 0 12px 32px -16px rgba(16, 24, 40, .22), 0 1px 3px rgba(16, 24, 40, .05);
  z-index: 30;
}

/* 右侧栏自动收起：默认展开，鼠标离开 0.9 秒缩到右边把手（2026-11-21） */
body.has-rail #side-rail {
  transition: transform .24s ease, opacity .2s ease;
}
body.has-rail.rail-hidden #side-rail {
  transform: translateX(calc(100% + 18px));
  opacity: 0;
  pointer-events: none;
}
#rail-toggle { display: none; }
body.has-rail #rail-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 72px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .8);
  border-right: 0;
  border-radius: 10px 0 0 10px;
  background: rgba(255, 255, 255, .82);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: -2px 2px 12px rgba(16, 24, 40, .12);
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  z-index: 31;
}
body.has-rail #rail-toggle:hover { color: var(--text); background: #fff; }

/* 右侧栏里的统计项 + 操作按钮 */
#side-extra {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}
#side-extra:empty { display: none; }
#side-extra .stats-row { flex-direction: column; gap: 7px; align-items: stretch; }
#side-extra .stats-row .stat { justify-content: space-between; white-space: normal; }
#side-extra .stats-row .stat .v { font-size: var(--fs-xl); }
#side-extra .home-actions { min-width: 0; margin-top: 2px; }
body.has-rail #side-rail .brand {
  font-weight: 600;
  font-size: var(--fs-sm);
  line-height: 1.35;
  color: var(--text);
}
body.has-rail #side-rail .who {
  font-size: var(--fs-xs);
  line-height: 1.45;
  color: var(--muted);
  margin-bottom: 4px;
  white-space: normal;
  word-break: break-all;
}
body.has-rail #side-rail button { width: 100%; }
/* 右侧栏占掉的宽度用 body 内边距让出来，内容在「左边到栏」之间居中，左右空白一样宽 */
body.has-rail { padding-right: 178px; }
body.has-rail .wrap { max-width: min(1560px, calc(100vw - 218px)); }

/* 主流 1920 宽屏留 ~180 边距；小屏自动收窄（2026-11-21 用户要求利用左右空白） */
.wrap { max-width: min(1560px, 94vw); margin: 0 auto; padding: 22px 20px 64px; }

/* 首页顶部统计条：统计项 + 操作按钮一行（2026-11-21 去掉「概览」大框） */
.home-stats {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.stats-row {
  flex: 1 1 auto;
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
  align-items: baseline;
  min-width: 0;
}
/* 首页统计项：不要框、不要底色，直接一行「标题 数字」（2026-11-21 用户要求） */
.stats-row .stat {
  flex: 0 0 auto;
  display: flex;
  align-items: baseline;
  gap: 6px;
  white-space: nowrap;
  padding: 0;
  background: none;
  border: 0;
  box-shadow: none;
  border-radius: 0;
}
.stats-row .stat:hover { background: none; box-shadow: none; }
.stats-row .stat .k {
  margin: 0;
  font-size: var(--fs-md);
  font-weight: 500;
  color: var(--text-2);
}
.stats-row .stat .v {
  font-size: var(--fs-2xl);
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}
/* 操作按钮右侧竖排（2026-11-21 用户要求） */
.home-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
  min-width: 132px;
}
.home-actions > button { width: 100%; }

/* 首页：宽屏左右分栏，右列高度由 JS 对齐到退单列表（2026-11-21） */
.home-grid { display: grid; grid-template-columns: 1fr; }
@media (min-width: 1280px) {
  .home-grid {
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
    gap: 0 20px;
    align-items: stretch;
    /* 一屏填满，不留底部大块空白 */
    min-height: calc(100vh - 100px);
  }
  /* 左右两列都撑满再由内侧表格滚动，底边齐平 */
  .home-grid > .hg-main {
    display: flex;
    flex-direction: column;
    min-height: 0;
  }
  .home-grid > .hg-main > .tbl-scroll {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none !important;
    overflow: auto;
  }
  .hg-side { display: flex; flex-direction: column; min-height: 0; }
  /* 右列最后一张卡吃掉剩余高度，表格内部滚动，底边和左列齐平 */
  .hg-side > .card:last-child {
    flex: 1 1 auto;
    min-height: 220px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  .hg-side > .card:last-child > .tbl-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
  }
}

/* ── 卡片 ── */
.card {
  background: rgba(255, 255, 255, .86);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  backdrop-filter: saturate(180%) blur(12px);
  border: 1px solid rgba(255, 255, 255, .7);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 20px;
  box-shadow: 0 12px 32px -16px rgba(16, 24, 40, .22), 0 1px 3px rgba(16, 24, 40, .05);
}
.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.card-head h2 { font-size: var(--fs-lg); }
.card-head .spacer { flex: 1; }
.card-head .muted { font-size: var(--fs-sm); }
.card > .card-head:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }

/* ── 表格 ── */
table { width: 100%; border-collapse: collapse; font-size: var(--fs-md); }
th, td { text-align: left; padding: 13px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
thead th {
  color: var(--text-2);
  font-weight: 600;
  font-size: var(--fs-sm);
  background: rgba(248, 250, 252, .9);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
thead th:first-child { border-top-left-radius: var(--radius-sm); }
thead th:last-child { border-top-right-radius: var(--radius-sm); }
tbody tr { transition: background .12s; }
tbody tr:hover { background: rgba(37, 99, 235, .05); }
tr:last-child td { border-bottom: none; }
td.r, th.r { text-align: right; }
td.mono, th.mono { font-family: var(--mono); font-size: var(--fs-sm); }

/* ── 标签 ── */
.tag {
  display: inline-block;
  padding: 1px 9px;
  border-radius: 999px;
  font-size: var(--fs-xs);
  font-weight: 500;
  line-height: 1.65;
  background: var(--brand-soft);
  color: #3730a3;
  white-space: nowrap;
  vertical-align: middle;
}
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.off { background: var(--bg-soft); color: var(--muted); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.red { background: var(--danger-soft); color: var(--danger); }
.tag.esc { background: var(--danger); color: #fff; }

/* ── 横幅 / 提示 ── */
.banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  margin-bottom: 18px;
  border: 1px solid rgba(255, 255, 255, .7);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .86);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  backdrop-filter: saturate(180%) blur(12px);
  box-shadow: var(--shadow-xs);
}
.banner .grow, .banner > div:first-child { flex: 1; min-width: 0; }
.banner-title { font-weight: 600; font-size: var(--fs-md); line-height: 1.45; }
.banner-sub { font-size: var(--fs-sm); margin-top: 4px; opacity: .9; }
.banner-danger { background: var(--danger-soft); border-color: var(--danger-line); color: #991b1b; }
.banner-warn { background: var(--warn-soft); border-color: var(--warn-line); color: #92400e; }
.banner-info { background: var(--brand-soft); border-color: var(--brand-line); color: #1e40af; }
.banner-ok { background: var(--ok-soft); border-color: var(--ok-line); color: #166534; }

.warnbox {
  background: var(--warn-soft);
  border: 1px solid var(--warn-line);
  color: #92400e;
  padding: 10px 13px;
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  line-height: 1.7;
  margin-bottom: 12px;
}
.panel-soft {
  background: var(--card-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 13px;
  margin-bottom: 12px;
}
.panel-info {
  background: var(--brand-soft);
  border: 1px solid var(--brand-line);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  color: #1e40af;
  font-size: var(--fs-sm);
  line-height: 1.7;
}

/* ── 行内元素 / 工具类 ── */
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.row > * { flex: 0 0 auto; }
.row .grow { flex: 1 1 160px; min-width: 140px; }
.row label span { display: block; font-size: var(--fs-sm); color: var(--muted); margin-bottom: 4px; }

.empty { text-align: center; color: var(--muted); padding: 46px 12px; }
.empty .big { font-size: var(--fs-md); color: var(--text); font-weight: 500; margin-bottom: 6px; }

.copybox { display: flex; gap: 8px; margin-top: 8px; }
.copybox input { font-size: var(--fs-sm); font-family: var(--mono); }

/* ── 提示条 ── */
#toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(16px);
  background: #111827;
  color: #fff;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s, transform .18s;
  max-width: min(90vw, 520px);
  text-align: center;
  z-index: 100;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.bad { background: var(--danger); }

/* ── 弹窗 ── */
.modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, .42);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 50;
}
.modal {
  background: rgba(255, 255, 255, .96);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  backdrop-filter: saturate(180%) blur(16px);
  border: 1px solid rgba(255, 255, 255, .8);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 100%;
  max-width: 460px;
  max-height: 88vh;
  /* 退货详情这类内容多的用 wide，460px 看明细表太挤（2026-11-19） */
  overflow: auto;
  box-shadow: var(--shadow-lg);
}
.modal.wide { max-width: min(1240px, 94vw); }
@media (max-width: 640px) { .modal.wide { max-width: 100%; } }
.modal h2 { font-size: var(--fs-lg); margin-bottom: 18px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.modal label { display: block; margin-bottom: 14px; }
.modal label span { display: block; font-size: var(--fs-sm); color: var(--muted); margin-bottom: 5px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.modal .actions button.primary { width: auto; }
.modal .copybox { margin-top: 10px; }

/* ── 列表工具条 ── */
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filters select, .filters input {
  width: auto;
  min-width: 106px;
  min-height: 32px;
  padding: 5px 9px;
  font-size: var(--fs-sm);
}
.filters select { max-width: 150px; }
.filters input[type=date] { width: 128px; min-width: 0; }
.filters input, .filters select, .filters button { min-height: var(--ctl-h-sm); height: var(--ctl-h-sm); padding: 0 10px; font-size: var(--fs-sm); }

/* ── KPI / 数值块 ── */
.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.kpi {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow-xs);
}
.kpi .k { font-size: var(--fs-sm); color: var(--muted); margin-bottom: 4px; }
.kpi .v { font-size: var(--fs-2xl); font-weight: 600; line-height: 1.2; font-variant-numeric: tabular-nums; }
.kpi .s { font-size: var(--fs-sm); color: var(--muted); margin-top: 4px; }
.kpi.bad .v { color: var(--danger); }
.kpi.warn .v { color: var(--warn); }
.kpi.ok .v { color: var(--ok); }

/* 概览小方块（首页） */
.stat {
  flex: 1 1 130px;
  background: rgba(248, 250, 252, .8);
  border: 1px solid rgba(255, 255, 255, .8);
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
  border-radius: var(--radius-sm);
  padding: 13px 15px;
  transition: background .15s, box-shadow .15s;
}
.stat:hover { background: rgba(255, 255, 255, .95); box-shadow: var(--shadow-xs); }
.stat .k { font-size: var(--fs-sm); color: var(--muted); margin-bottom: 3px; }
.stat .v { font-size: var(--fs-2xl); font-weight: 600; line-height: 1.2; font-variant-numeric: tabular-nums; }

/* ── 网格布局 ── */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.grid label span, .grid4 label span { display: block; font-size: var(--fs-sm); color: var(--muted); margin-bottom: 4px; }
.grid input, .grid select { width: 100%; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }

/* ── 缩略图 / 拖放 ── */
.thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
  min-height: 10px;
  border-radius: var(--radius-sm);
  transition: background .15s, box-shadow .15s;
}
.thumbs.dragover { background: var(--brand-soft); box-shadow: inset 0 0 0 2px var(--brand-line); }
.thumb {
  position: relative;
  width: 92px;
  height: 92px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  box-shadow: var(--shadow-xs);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb button {
  position: absolute; top: 3px; right: 3px;
  width: 22px; height: 22px; min-height: 0;
  border-radius: 50%; border: none;
  background: rgba(0, 0, 0, .62); color: #fff;
  font-size: 13px; line-height: 1; padding: 0;
  box-shadow: none;
}
.thumb button:hover { background: rgba(0, 0, 0, .82); }
.thumb .sz {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, .55), rgba(0, 0, 0, 0));
  color: #fff; font-size: var(--fs-xs); text-align: center; padding: 3px 2px 2px;
}

/* ═══ 仓库退单扫描：大字、少点鼠标 ═══ */
#track {
  font-size: 1.3rem;
  padding: 15px 16px;
  font-weight: 600;
  font-family: var(--mono);
  letter-spacing: .04em;
  text-transform: uppercase;
}
.scan-input {
  min-width: 260px;
  font-size: 1.05rem;
  padding: 11px 12px;
}
.track-input { font-size: 1.15rem; font-family: var(--mono); letter-spacing: .04em; }
.scan-items td, .items td { padding: 7px 6px; vertical-align: middle; }
.scan-items th { white-space: nowrap; }
.scan-items input.sku {
  font-size: 1rem;
  padding: 9px 10px;
  text-transform: uppercase;
  letter-spacing: .02em;
  font-family: var(--mono);
}
.scan-items input.qty {
  width: 88px;
  padding: 9px 6px;
  font-size: 1.05rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.scan-items select, .scan-items input { min-height: var(--ctl-h-sm); height: var(--ctl-h-sm); padding: 0 8px; min-width: 90px; font-size: var(--fs-sm); }
/* 类别 / 问题类型两个下拉：选项文字长（如「三支装一双勾丝两双完整」），
   32px 高 + 90px 宽会把字截掉，单独放宽放高（2026-11-19 用户反馈） */
.scan-items td select {
  height: auto; min-height: 38px; min-width: 132px; max-width: 190px;
  padding: 7px 8px; line-height: 1.35; font-size: var(--fs-md);
}
.scan-items th:nth-child(5), .scan-items td:nth-child(5),
.scan-items th:nth-child(6), .scan-items td:nth-child(6) { min-width: 140px; }
/* 小屏（1366 这类仓库电脑）收紧一点，保证整表不出横向滚动条 */
@media (max-width: 1440px) {
  .scan-items td select { min-width: 108px; max-width: 150px; font-size: var(--fs-sm); }
  .scan-items th:nth-child(5), .scan-items td:nth-child(5),
  .scan-items th:nth-child(6), .scan-items td:nth-child(6) { min-width: 112px; }
}
.scan-items td.n { text-align: center; white-space: nowrap; }

/* ═══ 手机补拍页 ═══ */
.mitem {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
  background: var(--card);
  box-shadow: var(--shadow-xs);
}
.mitem .grow { flex: 1; min-width: 0; }
.mitem .sku { font-weight: 600; font-size: var(--fs-md); word-break: break-all; }
.mitem .qty { color: var(--muted); font-size: var(--fs-sm); margin-top: 3px; }
.mthumbs { display: flex; gap: 6px; overflow-x: auto; margin-top: 10px; padding-bottom: 2px; }
.mthumbs img {
  width: 64px; height: 64px; object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  flex: 0 0 auto;
}
.mbtn { padding: 12px 16px; min-height: 46px; font-size: var(--fs-md); border-radius: var(--radius); }
.mitem .mbtn { width: 100%; }

/* ── 响应式 ── */
@media (max-width: 720px) {
  .grid4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .topbar { height: 52px; padding: 0 14px; gap: 8px; }
  .topbar .who { display: none; }
  .wrap { padding: 14px 12px 52px; }
  .card { padding: 15px; border-radius: var(--radius-sm); }
  .card-head { margin-bottom: 13px; padding-bottom: 10px; }
  th, td { padding: 8px 7px; }
  .hide-sm { display: none; }
  .grid4 { grid-template-columns: 1fr 1fr; }
}

/* ── 打印 ── */
@media print {
  body, body::before { background: #fff !important; }
  body::before { display: none !important; }
  .topbar, #toast, #side-rail, .no-print { display: none !important; }
  .wrap { max-width: none; padding: 0; }
  .card {
    box-shadow: none; border: none; padding: 0;
    background: #fff; -webkit-backdrop-filter: none; backdrop-filter: none;
  }
  thead th { background: #fff !important; }
}

/* ── 长列表：默认露 10 行，超出滚动（2026-11-19 用户要求）── */
.tbl-scroll {
  overflow-y: auto;
  overflow-x: auto;
  border-radius: var(--radius-sm);
}
.tbl-scroll thead th { position: sticky; top: 0; z-index: 2; background: var(--card-soft); }
