/* =========================================================
   智仓 WMS · 设计系统
   风格：深色导航 + 浅色工作区，紧凑、克制、数据优先
   ========================================================= */

:root {
  --ink:        #0E1420;
  --ink-2:      #16202F;
  --ink-3:      #1E2A3C;

  --primary:      #2B54E8;
  --primary-dark: #1E40C4;
  --primary-text: #2B54E8;
  --primary-soft: #EEF2FF;
  --primary-line: #D7DEFB;

  --success: #0F9D58;
  --success-soft: #E7F6EE;
  --warn: #C77700;
  --warn-soft: #FDF3E2;
  --danger: #D93B3B;
  --danger-soft: #FDECEC;
  --danger-line: #F0C9C9;
  --info: #4A5C74;
  --info-soft: #EEF2F6;
  --purple: #6D4AC7;
  --purple-soft: #F1ECFB;

  --bg: #F5F6F9;
  --surface: #FFFFFF;
  --surface-2: #FAFBFC;
  --line: #E6E9EF;
  --line-2: #EFF1F5;

  --t1: #101828;
  --t2: #475467;
  --t3: #667085;

  --hover: #F8FAFF;

  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --r-xl: 22px;

  --sh-1: 0 1px 2px rgba(16, 24, 40, .05);
  --sh-2: 0 12px 32px -16px rgba(16, 24, 40, .18);
  --sh-3: 0 24px 64px -24px rgba(11, 18, 32, .28);

  --sidebar-w: 244px;
  --topbar-h: 62px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
          "Microsoft YaHei", "Source Han Sans CN", "Noto Sans CJK SC", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--t1);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

h1, h2, h3, h4, p, figure { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
button { font-family: inherit; }

.num, .tbl td.num, .mono, .figure {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}
.mono { font-family: var(--mono); font-size: 13px; letter-spacing: -.2px; }
.muted { color: var(--t3); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.grow { flex: 1; }
.hidden { display: none !important; }

/* ---------------- 布局骨架 ---------------- */

.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--ink);
  color: #AEB9C9;
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 60;
  transition: transform .26s cubic-bezier(.4, 0, .2, 1);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 20px 20px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, .06);
}
.brand-mark {
  width: 34px; height: 34px;
  border-radius: 10px;
  background: linear-gradient(140deg, #3E68F0, #2B54E8 55%, #1B3AA8);
  display: grid; place-items: center;
  color: #fff; font-weight: 600; font-size: 15px;
  letter-spacing: -.5px;
  box-shadow: 0 6px 16px -6px rgba(43, 84, 232, .8);
}
.brand-txt strong {
  display: block; color: #fff; font-size: 14.5px; font-weight: 600; letter-spacing: .2px;
}
.brand-txt span { display: block; font-size: 11px; color: #6B7789; letter-spacing: .6px; }

.nav { flex: 1; overflow-y: auto; padding: 14px 12px 24px; }
.nav::-webkit-scrollbar { width: 5px; }
.nav::-webkit-scrollbar-thumb { background: #2A3546; border-radius: 4px; }

.nav-group { margin-bottom: 6px; }
.nav-title {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 12px;
  font-size: 12.5px; font-weight: 700;
  color: #D5DCE8;
  letter-spacing: .3px;
  border-radius: 9px;
  cursor: pointer;
  user-select: none;
  transition: background .16s;
}
.nav-title:hover { background: rgba(255, 255, 255, .05); }
.nav-title > span:first-of-type { flex: 1 1 auto; }
.nav-title .ico { opacity: .9; color: #8FA9FF; }
.nav-title .chev { margin-left: auto; transition: transform .2s; opacity: .55; }
.nav-group.closed .chev { transform: rotate(-90deg); }
.nav-group.closed .nav-items { display: none; }

/* 子菜单：缩进 + 左侧引导线，与主菜单拉开层级 */
.nav-items {
  margin: 3px 0 4px 21px;
  padding-left: 8px;
  border-left: 1px solid rgba(255, 255, 255, .10);
}

.nav-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px 8px 12px;
  border-radius: 8px;
  color: #9BA7BB;
  font-size: 13px;
  position: relative;
  transition: background .16s, color .16s;
  margin-bottom: 1px;
}
.nav-item > span { flex: 1 1 auto; }
.nav-item .ico { color: #5B6B85; transition: color .16s; }
.nav-item:hover { background: rgba(255, 255, 255, .06); color: #EEF2F8; }
.nav-item:hover .ico { color: #8FA9FF; }
.nav-item.active {
  background: linear-gradient(90deg, rgba(43, 84, 232, .22), rgba(43, 84, 232, .08));
  color: #fff;
  font-weight: 500;
  box-shadow: inset 0 0 0 1px rgba(91, 126, 245, .18);
}
.nav-item.active::before {
  content: "";
  position: absolute; left: 0; top: 50%;
  width: 3px; height: 16px;
  border-radius: 0 3px 3px 0;
  background: #5B7EF5;
  transform: translateY(-50%);
}
.nav-item .ico { flex: 0 0 auto; opacity: .85; }
.nav-item.active .ico { opacity: 1; color: #8FA9FF; }

.side-foot {
  padding: 12px 16px 16px;
  border-top: 1px solid rgba(255, 255, 255, .06);
  font-size: 11.5px; color: #5A6779;
  display: flex; align-items: center; justify-content: space-between;
}

.main {
  flex: 1;
  min-width: 0;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
}

.topbar {
  height: var(--topbar-h);
  position: sticky; top: 0; z-index: 40;
  background: rgba(255, 255, 255, .86);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 14px;
  padding: 0 22px;
}
.topbar h1 {
  font-size: 16px; font-weight: 600; letter-spacing: -.2px;
  display: flex; align-items: center; gap: 9px;
}
.crumb { font-size: 12.5px; color: var(--t3); display: flex; align-items: center; gap: 6px; }
.crumb span { color: var(--t2); }

.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.icon-btn {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--t2);
  cursor: pointer;
  position: relative;
  transition: background .16s, border-color .16s;
}
.icon-btn:hover { background: var(--info-soft); border-color: var(--line); }
.icon-btn .dot {
  position: absolute; top: 7px; right: 7px;
  min-width: 7px; height: 7px; border-radius: 4px;
  background: var(--danger); box-shadow: 0 0 0 2px #fff;
}

.user-chip {
  display: flex; align-items: center; gap: 9px;
  padding: 4px 10px 4px 4px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  cursor: pointer;
}
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary-text);
  font-size: 12.5px; font-weight: 600;
}
.user-chip .u-name { font-size: 13px; font-weight: 500; line-height: 1.2; }
.user-chip .u-role { font-size: 11px; color: var(--t3); line-height: 1.2; }

.menu-btn { display: none; }

.content { padding: 22px; flex: 1; min-width: 0; }
.content-inner { max-width: 1560px; margin: 0 auto; }

/* ---------------- 页头 ---------------- */

.page-head {
  display: flex; align-items: flex-start; gap: 16px;
  margin-bottom: 18px; flex-wrap: wrap;
}
.page-head .ph-txt h2 { font-size: 20px; font-weight: 600; letter-spacing: -.4px; }
.page-head .ph-txt p { color: var(--t3); font-size: 13px; margin-top: 3px; }
.page-head .ph-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------------- 卡片 ---------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
  overflow: hidden;
}
.card + .card { margin-top: 16px; }
.card-head {
  display: flex; align-items: center; gap: 12px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line-2);
  flex-wrap: wrap;
}
.card-head h3 { font-size: 14.5px; font-weight: 600; }
.card-head .ch-sub { font-size: 12.5px; color: var(--t3); }
.card-head .ch-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.card-body { padding: 18px; }
.card-body.flush { padding: 0; }

/* ---------------- 统计卡 ---------------- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(212px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 16px 18px 14px;
  box-shadow: var(--sh-1);
  position: relative;
  overflow: hidden;
}
.stat-top { display: flex; align-items: center; gap: 8px; color: var(--t2); font-size: 12.5px; }
.stat-top .ico { color: var(--t3); }
.stat-val {
  font-size: 26px; font-weight: 600; letter-spacing: -.8px;
  margin: 8px 0 2px; line-height: 1.15;
  font-variant-numeric: tabular-nums;
}
.stat-val small { font-size: 13px; font-weight: 500; color: var(--t3); margin-left: 4px; letter-spacing: 0; }
.stat-foot { font-size: 12px; color: var(--t3); display: flex; align-items: center; gap: 6px; }
.trend-up { color: var(--success); }
.trend-down { color: var(--danger); }
.stat-accent {
  position: absolute; right: -18px; top: -18px;
  width: 76px; height: 76px; border-radius: 50%;
  background: var(--primary-soft); opacity: .55;
}

/* ---------------- 表格 ---------------- */

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.tbl thead th {
  text-align: left;
  font-weight: 500;
  font-size: 12px;
  color: var(--t3);
  letter-spacing: .3px;
  padding: 10px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  position: sticky; top: 0; z-index: 2;
}
.tbl tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-2);
  color: var(--t2);
  vertical-align: middle;
}
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr { transition: background .12s; }
.tbl tbody tr:hover td { background: var(--hover); }
.tbl tbody tr.is-link { cursor: pointer; }
.tbl td.num, .tbl th.num { text-align: right; }
.tbl .cell-strong { color: var(--t1); font-weight: 500; }
.tbl .doc-no { font-family: var(--mono); font-size: 12.5px; color: var(--primary-text); letter-spacing: -.2px; }
.tbl-compact tbody td { padding: 9px 13px; }
.tbl-footer {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-top: 1px solid var(--line-2);
  font-size: 12.5px; color: var(--t3); flex-wrap: wrap;
}

/* ---------------- 标签 / 徽章 ---------------- */

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 9px;
  border-radius: 999px;
  font-size: 12px; font-weight: 500;
  white-space: nowrap;
  border: 1px solid transparent;
}
.pill-green  { background: var(--success-soft); color: #0B7A45; border-color: #CBEBDA; }
.pill-blue   { background: var(--primary-soft); color: #1E40C4; border-color: var(--primary-line); }
.pill-amber  { background: var(--warn-soft); color: #9A5B00; border-color: #F5E2C3; }
.pill-red    { background: var(--danger-soft); color: #B02A2A; border-color: #F7D4D4; }
.pill-gray   { background: #F3F4F7; color: #5A6373; border-color: #E7E9EE; }
.pill-purple { background: var(--purple-soft); color: #573A9E; border-color: #E1D8F7; }

.badge {
  display: inline-grid; place-items: center;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 6px; background: var(--danger); color: #fff;
  font-size: 11px; font-weight: 600;
}
.tag {
  display: inline-flex; align-items: center;
  height: 20px; padding: 0 7px; border-radius: 5px;
  background: var(--info-soft); color: var(--info);
  font-size: 11.5px; font-weight: 500;
}

/* ---------------- 按钮 ---------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 15px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--t1);
  font-size: 13.5px; font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, border-color .15s, box-shadow .15s, transform .06s;
}
.btn:hover { background: var(--surface-2); border-color: #D8DCE5; }
.btn:active { transform: translateY(.5px); }
.btn-primary {
  background: var(--primary); border-color: var(--primary); color: #fff;
  box-shadow: 0 6px 16px -8px rgba(43, 84, 232, .75);
}
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-danger { background: var(--surface); border-color: #F0C9C9; color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover { filter: brightness(.94); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--t2); }
.btn-ghost:hover { background: var(--info-soft); }
.btn-sm { height: 32px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; }
.btn-xs { height: 27px; padding: 0 9px; font-size: 12px; border-radius: 7px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn .ico { flex: 0 0 auto; }

.btn-group { display: inline-flex; gap: 6px; flex-wrap: wrap; }

/* ---------------- 表单 ---------------- */

.field { margin-bottom: 15px; }
/* 用 :not(.switch) 直接豁免开关标签，从根源上避免
   display:block 压过 .switch 的 inline-flex（任何加载顺序都安全） */
.field > label:not(.switch) {
  display: block; font-size: 12.5px; font-weight: 500;
  color: var(--t2); margin-bottom: 6px;
}
.field > label .req { color: var(--danger); margin-left: 3px; }
.field .hint { font-size: 11.5px; color: var(--t3); margin-top: 5px; }

.input, .select, .textarea {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--t1);
  font-size: 13.5px;
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
  appearance: none;
}
.textarea { height: auto; padding: 9px 12px; min-height: 76px; resize: vertical; line-height: 1.6; }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(43, 84, 232, .12);
}
.input::placeholder { color: #98A1B0; }
.select {
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238A94A6' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  padding-right: 30px;
}
.input-sm, .select-sm { height: 33px; font-size: 13px; border-radius: 8px; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 16px; }
.form-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.form-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.form-grid .full { grid-column: 1 / -1; }

/* .field > label (0,1,1) 会把嵌套的 .switch 标签强制成 block，
   这里用同等特异度夺回，保证轨道正常渲染 */
.switch,
.field > label.switch {
  display: inline-flex; align-items: center; gap: 9px;
  cursor: pointer; user-select: none; height: 38px;
  margin-bottom: 0; font-size: 13px; font-weight: 400; color: var(--t2);
}
.switch input { display: none; }
.switch .track {
  width: 38px; height: 22px; border-radius: 999px;
  background: #DDE1E8; position: relative; transition: background .18s;
}
.switch .track::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--surface); box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
  transition: transform .18s;
}
.switch input:checked + .track { background: var(--primary); }
.switch input:checked + .track::after { transform: translateX(16px); }

.check { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--t2); cursor: pointer; }
.check input { width: 15px; height: 15px; accent-color: var(--primary); }

/* 筛选条 */
.toolbar {
  display: flex; align-items: center; gap: 9px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line-2);
  flex-wrap: wrap;
  background: var(--surface);
}
.toolbar .input, .toolbar .select { width: auto; min-width: 132px; height: 34px; font-size: 13px; }
.toolbar .search { position: relative; }
.toolbar .search .input { padding-left: 32px; min-width: 210px; }
.toolbar .search .ico { position: absolute; left: 10px; top: 9px; color: var(--t3); }
.toolbar .spacer { margin-left: auto; }

/* ---------------- 标签页 ---------------- */

.tabs {
  display: flex; gap: 2px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
  overflow-x: auto;
}
.tab {
  padding: 9px 14px 11px;
  font-size: 13.5px; font-weight: 500; color: var(--t3);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color .15s, border-color .15s;
}
.tab:hover { color: var(--t2); }
.tab.active { color: var(--primary-text); border-bottom-color: var(--primary); }

/* 筛选状态胶囊（订单状态 / 消息箱等） */
.ftabs {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-2);
  overflow-x: auto;
}
.ftabs a {
  display: inline-flex; align-items: center; gap: 7px;
  height: 30px; padding: 0 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--t2);
  font-size: 12.5px; font-weight: 500;
  white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}
.ftabs a:hover { border-color: var(--primary-line); background: var(--primary-soft); color: var(--primary-text); }
.ftabs a.on {
  background: var(--primary); border-color: var(--primary);
  color: #fff; font-weight: 600;
  box-shadow: 0 2px 10px -3px rgba(43, 84, 232, .50);
}
.ftabs a .n {
  display: inline-grid; place-items: center;
  min-width: 18px; height: 17px; padding: 0 5px;
  border-radius: 999px;
  background: var(--info-soft); color: var(--t3);
  font-size: 11px; font-weight: 600; font-style: normal;
  line-height: 1;
}
.ftabs a.on .n { background: rgba(255, 255, 255, .24); color: #fff; }
.ftabs a .n.warn { background: var(--danger-soft); color: var(--danger); }
.ftabs a.on .n.warn { background: rgba(255, 255, 255, .24); color: #fff; }
.ftabs a.zero { opacity: .5; }

.seg { display: inline-flex; background: var(--info-soft); border-radius: 9px; padding: 3px; gap: 2px; }
.seg a {
  padding: 5px 12px; border-radius: 7px; font-size: 12.5px; color: var(--t2); font-weight: 500;
}
.seg a.on { background: var(--surface); color: var(--t1); box-shadow: var(--sh-1); }

/* ---------------- 空状态 ---------------- */

.empty { padding: 56px 20px; text-align: center; color: var(--t3); }
.empty .ico-wrap {
  width: 54px; height: 54px; margin: 0 auto 14px;
  border-radius: 16px; background: var(--info-soft);
  display: grid; place-items: center; color: var(--t3);
}
.empty h4 { font-size: 14px; color: var(--t2); font-weight: 500; margin-bottom: 4px; }
.empty p { font-size: 12.5px; }

/* ---------------- 分页 ---------------- */

.pager { display: flex; gap: 4px; margin-left: auto; align-items: center; }
.pager a, .pager span {
  min-width: 30px; height: 30px; padding: 0 8px;
  display: grid; place-items: center;
  border-radius: 7px; font-size: 12.5px;
  color: var(--t2); border: 1px solid var(--line); background: var(--surface);
}
.pager a:hover { border-color: var(--primary-line); color: var(--primary-text); }
.pager .on { background: var(--primary); border-color: var(--primary); color: #fff; }
.pager .disabled { opacity: .4; pointer-events: none; }

/* ---------------- 提示条 ---------------- */

.flashes { position: fixed; top: 16px; right: 16px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.flash {
  display: flex; align-items: flex-start; gap: 9px;
  min-width: 260px; max-width: 420px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--sh-2);
  font-size: 13px;
  animation: slideIn .28s cubic-bezier(.2, .8, .3, 1);
}
.flash .ico { flex: 0 0 auto; margin-top: 1px; }
.flash-success { border-left: 3px solid var(--success); }
.flash-success .ico { color: var(--success); }
.flash-error { border-left: 3px solid var(--danger); }
.flash-error .ico { color: var(--danger); }
.flash-info { border-left: 3px solid var(--primary); }
.flash-info .ico { color: var(--primary-text); }
@keyframes slideIn { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }

.notice {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; border-radius: 12px;
  background: var(--warn-soft); border: 1px solid #F5E2C3;
  font-size: 13px; color: #7A4A00;
  margin-bottom: 16px;
}
.notice.info { background: var(--primary-soft); border-color: var(--primary-line); color: #1E40C4; }
.notice.danger { background: var(--danger-soft); border-color: #F7D4D4; color: #A02A2A; }

/* ---------------- 单据时间线 ---------------- */

.timeline { position: relative; padding-left: 20px; }
.timeline::before {
  content: ""; position: absolute; left: 5px; top: 6px; bottom: 6px;
  width: 1px; background: var(--line);
}
.tl-item { position: relative; padding-bottom: 16px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
  content: ""; position: absolute; left: -19px; top: 5px;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--line);
}
.tl-item.ok::before { border-color: var(--success); background: var(--success); }
.tl-item.cur::before { border-color: var(--primary); background: var(--surface); box-shadow: 0 0 0 3px rgba(43, 84, 232, .14); }
.tl-item.bad::before { border-color: var(--danger); background: var(--danger); }
.tl-head { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.tl-head strong { font-weight: 500; }
.tl-time { font-size: 11.5px; color: var(--t3); margin-left: auto; font-variant-numeric: tabular-nums; }
.tl-body { font-size: 12.5px; color: var(--t3); margin-top: 2px; padding-left: 1px; }

/* ---------------- 明细录入 ---------------- */

.items-table { width: 100%; border-collapse: collapse; font-size: 13px; table-layout: auto; }
.items-table th {
  text-align: left; font-size: 11.5px; font-weight: 500; color: var(--t3);
  padding: 8px 8px; background: var(--surface-2);
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
.items-table td { padding: 6px 6px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.items-table .input, .items-table .select {
  height: 34px; font-size: 13px; border-radius: 8px; padding: 0 9px;
  width: 100%; min-width: 0;   /* 列宽由 th 控制，输入框跟随列宽收缩，避免表格溢出 */
}
.items-table .qty { text-align: right; }
.items-table .qty-wrap { display: flex; align-items: center; gap: 5px; min-width: 0; }
.items-table .qty-wrap .input { flex: 1 1 auto; min-width: 0; }
.items-table .qty-wrap .unit-cell { flex: 0 0 auto; white-space: nowrap; }
.items-table .row-del {
  width: 28px; height: 28px; border-radius: 7px; border: 1px solid transparent;
  background: transparent; color: var(--t3); cursor: pointer; display: grid; place-items: center;
}
.items-table .row-del:hover { background: var(--danger-soft); color: var(--danger); }
.mat-cell { position: relative; }
.mat-hint { font-size: 11px; color: var(--t3); margin-top: 2px; line-height: 1.3; }
.items-foot {
  display: flex; align-items: center; gap: 16px;
  padding: 12px 4px 0;
  font-size: 13px; color: var(--t2); flex-wrap: wrap;
}
.items-foot .tot { margin-left: auto; display: flex; gap: 20px; }
.items-foot .tot b { font-size: 15px; color: var(--t1); font-variant-numeric: tabular-nums; }

/* 扫码录入条 */
.scan-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 0 0 12px; padding: 9px 12px;
  border: 1px dashed var(--primary-line); border-radius: 10px;
  background: var(--primary-soft);
}
.scan-bar .scan-ico { color: var(--primary-text); flex: 0 0 auto; display: grid; place-items: center; }
.scan-bar .input { flex: 1 1 200px; min-width: 0; width: auto; height: 36px; background: var(--surface); }
.scan-bar .scan-tip { flex: 0 0 auto; }

/* ---------------- 详情定义表 ---------------- */

.dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px 24px; }
.dl .dt { font-size: 12px; color: var(--t3); margin-bottom: 3px; }
.dl .dd { font-size: 13.5px; color: var(--t1); font-weight: 500; }
.dl .dd.big { font-size: 18px; letter-spacing: -.3px; }

/* ---------------- 进度条 / 迷你图 ---------------- */

.bar { height: 6px; border-radius: 4px; background: var(--line-2); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 4px; background: var(--primary); }
.bar.warn > i { background: var(--warn); }
.bar.danger > i { background: var(--danger); }
.bar.ok > i { background: var(--success); }

.spark { display: flex; align-items: flex-end; gap: 3px; height: 34px; }
.spark i { flex: 1; background: var(--primary-line); border-radius: 2px 2px 0 0; min-height: 3px; transition: background .15s; }
.spark i.hot { background: var(--primary); }

.chart-bars { display: flex; align-items: flex-end; gap: 10px; height: 190px; padding: 6px 2px 0; }
.chart-bars .col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 5px; height: 100%; }
.chart-bars .bars { display: flex; gap: 3px; align-items: flex-end; height: 100%; width: 100%; justify-content: center; }
.chart-bars .bars i { width: 9px; border-radius: 3px 3px 0 0; display: block; }
.chart-bars .bars i.in { background: #9FB4FF; }
.chart-bars .bars i.out { background: var(--primary); }
.chart-bars .lbl { font-size: 11px; color: var(--t3); white-space: nowrap; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--t2); align-items: center; }
.legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; margin-right: 5px; }

/* ---------------- 登录 ---------------- */

.auth-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 480px;
  background: var(--bg);
}
.auth-side {
  background: var(--ink);
  color: #fff;
  padding: 48px 52px;
  display: flex; flex-direction: column;
  position: relative;
  overflow: hidden;
}
.auth-side::after {
  content: "";
  position: absolute; right: -120px; bottom: -120px;
  width: 380px; height: 380px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(43, 84, 232, .5), transparent 62%);
}
.auth-side h1 { font-size: 30px; font-weight: 600; letter-spacing: -1px; line-height: 1.3; margin-top: 40px; }
.auth-side p { color: #8B97A9; margin-top: 12px; font-size: 14px; max-width: 380px; line-height: 1.75; }
.auth-feats { margin-top: auto; display: grid; gap: 14px; position: relative; z-index: 2; }
.auth-feat { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: #A9B5C6; }
.auth-feat .ico { color: #5B7EF5; flex: 0 0 auto; margin-top: 1px; }
.auth-form-side { display: flex; align-items: center; justify-content: center; padding: 32px; }
.auth-card { width: 100%; max-width: 356px; }
.auth-card h2 { font-size: 22px; font-weight: 600; letter-spacing: -.4px; }
.auth-card .sub { color: var(--t3); font-size: 13px; margin: 6px 0 26px; }
.auth-card .field > label { font-size: 12.5px; }
.auth-foot { margin-top: 22px; text-align: center; font-size: 12px; color: var(--t3); }

/* ---------------- 安装 ---------------- */

.install-wrap { min-height: 100vh; display: grid; place-items: center; padding: 32px; }
.install-card {
  width: 100%; max-width: 720px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-xl);
  box-shadow: var(--sh-3); overflow: hidden;
}
.install-head { padding: 30px 32px 24px; border-bottom: 1px solid var(--line-2); }
.install-head h1 { font-size: 22px; font-weight: 600; letter-spacing: -.5px; margin-top: 14px; }
.install-head p { color: var(--t3); font-size: 13px; margin-top: 6px; }
.install-body { padding: 24px 32px 30px; }
.req-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--line-2); font-size: 13px; }
.req-row:last-child { border-bottom: 0; }
.req-row .st { margin-left: auto; font-size: 12px; font-weight: 500; }
.req-ok { color: var(--success); }
.req-no { color: var(--danger); }

/* ---------------- 响应式 ---------------- */

@media (max-width: 1180px) {
  .auth-wrap { grid-template-columns: 1fr 420px; }
}

@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--sh-3); }
  .sidebar.open { transform: none; }
  .main { margin-left: 0; }
  .menu-btn { display: grid; }
  .nav-mask {
    position: fixed; inset: 0; background: rgba(11, 18, 32, .42);
    z-index: 50; opacity: 0; pointer-events: none; transition: opacity .24s;
  }
  .nav-mask.show { opacity: 1; pointer-events: auto; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-side { display: none; }
}

@media (max-width: 768px) {
  .content { padding: 14px 13px 28px; }
  .topbar { padding: 0 13px; height: 56px; }
  .topbar h1 { font-size: 15px; }
  .crumb { display: none; }
  .user-chip .u-role { display: none; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat { padding: 13px 14px 12px; border-radius: var(--r); }
  .stat-val { font-size: 21px; }
  .card-body { padding: 14px; }
  .card { border-radius: var(--r); }
  .page-head h2 { font-size: 17px; }
  .page-head .ph-actions { width: 100%; }
  .form-grid, .form-grid.cols-2, .form-grid.cols-3 { grid-template-columns: 1fr; }
  .toolbar { padding: 10px 12px; gap: 7px; }
  .toolbar .input, .toolbar .select { min-width: 0; flex: 1 1 44%; }
  .toolbar .search, .toolbar .search .input { width: 100%; min-width: 0; flex: 1 1 100%; }
  .toolbar .spacer { display: none; }

  /* 表格转卡片 */
  table.tbl.responsive thead { display: none; }
  table.tbl.responsive tbody tr {
    display: block;
    padding: 11px 13px;
    border-bottom: 1px solid var(--line);
    position: relative;
  }
  table.tbl.responsive tbody tr:last-child { border-bottom: 0; }
  table.tbl.responsive tbody td {
    display: flex; align-items: center; gap: 10px;
    padding: 3px 0; border: 0; font-size: 13px;
  }
  table.tbl.responsive tbody td::before {
    content: attr(data-label);
    flex: 0 0 84px;
    font-size: 11.5px; color: var(--t3);
  }
  table.tbl.responsive tbody td.cell-main {
    font-size: 14.5px; font-weight: 500; color: var(--t1);
    padding-bottom: 6px;
  }
  table.tbl.responsive tbody td.cell-main::before { display: none; }
  table.tbl.responsive tbody td.num { text-align: left; }
  table.tbl.responsive tbody td.cell-actions { justify-content: flex-end; padding-top: 8px; }
  table.tbl.responsive tbody td.cell-actions::before { display: none; }

  /* 明细录入表：转卡片，每个字段带名称（data-label） */
  .items-table thead { display: none; }
  .items-table, .items-table tbody { display: block; max-width: 100%; }
  .items-table tr {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 9px 12px;
    padding: 12px; border: 1px solid var(--line); border-radius: 10px;
    margin-bottom: 8px; background: var(--surface);
  }
  .items-table td { border: 0; padding: 0; min-width: 0; }
  .items-table td[data-label]::before {
    content: attr(data-label);
    display: block; font-size: 11px; font-weight: 500;
    color: var(--t3); margin-bottom: 4px; text-align: left;
  }
  .items-table .mat-cell { grid-column: 1 / -1; }
  .items-table .mat-cell::before { content: none; }
  .items-table td.cell-del { grid-column: 1 / -1; display: flex; justify-content: flex-end; padding-top: 2px; }
  .items-table td.cell-del::before { display: none; }
  .chart-bars { height: 150px; }
}

@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .stat-val { font-size: 19px; }
}

/* ---------------- 打印 ---------------- */

@media print {
  .sidebar, .topbar, .page-head .ph-actions, .toolbar, .pager, .flashes, .no-print { display: none !important; }
  .main { margin: 0 !important; }
  body { background: var(--surface); }
  .content { padding: 0; }
  .card { border: 0; box-shadow: none; }
  .print-page { width: 100%; }
  table { page-break-inside: avoid; }
}

/* ================= 工作台 / 详情 / 弹层 ================= */

.dash-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.dash-grid > div > .card + .card { margin-top: 16px; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.detail-grid > div > .card + .card { margin-top: 16px; }

/* 待办条目 */
.todo-item { display: block; padding: 11px 16px; border-bottom: 1px solid var(--line-2); transition: background .14s; }
.todo-item:last-child { border-bottom: 0; }
.todo-item:hover { background: var(--hover); }
.ti-top { display: flex; align-items: center; gap: 7px; }
.ti-no { font-size: 12.5px; color: var(--primary-text); margin-top: 3px; }
.ti-sub { font-size: 11.5px; color: var(--t3); margin-top: 1px; }

/* 库存分布 */
.dist-row { margin-bottom: 14px; }
.dist-row:last-child { margin-bottom: 0; }
.dr-top { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 5px; }
.dr-top span:last-child { font-variant-numeric: tabular-nums; color: var(--t2); }
.dr-sub { font-size: 11px; color: var(--t3); margin-top: 4px; }

/* 快捷入口 */
.quick-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(88px, 1fr)); gap: 8px; }
.quick-grid a {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  padding: 13px 6px; border-radius: 11px; border: 1px solid var(--line);
  color: var(--t2); font-size: 12px; text-align: center;
  transition: all .15s;
}
.quick-grid a:hover { border-color: var(--primary-line); background: var(--primary-soft); color: var(--primary-text); }

/* 单据类型选择卡 */
.type-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(268px, 1fr)); gap: 12px; }
.type-card {
  display: flex; gap: 13px; align-items: flex-start;
  padding: 15px 16px; border: 1px solid var(--line); border-radius: 13px;
  color: inherit; transition: all .18s; position: relative;
}
.type-card:hover { border-color: var(--primary-line); box-shadow: var(--sh-2); transform: translateY(-1px); }
.tc-icon {
  width: 38px; height: 38px; flex: 0 0 auto; border-radius: 11px;
  background: var(--primary-soft); color: var(--primary-text);
  display: grid; place-items: center;
}
.tc-body strong { font-size: 14px; font-weight: 600; display: block; }
.tc-body p { font-size: 12px; color: var(--t3); margin-top: 3px; line-height: 1.55; }
.tc-meta { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.tc-arrow { margin-left: auto; color: var(--t3); align-self: center; }

/* 用户菜单 */
.user-menu {
  position: absolute; top: calc(100% + 8px); right: 0;
  min-width: 186px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--sh-3); padding: 6px;
  opacity: 0; visibility: hidden; transform: translateY(-4px);
  transition: all .16s; z-index: 80;
}
.user-chip:hover .user-menu, .user-menu:hover { opacity: 1; visibility: visible; transform: none; }
.um-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--line-2); margin-bottom: 5px; }
.um-head strong { display: block; font-size: 13px; }
.um-head span { font-size: 11.5px; color: var(--t3); }
.user-menu a, .user-menu button {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 8px 10px; border: 0; background: transparent; border-radius: 8px;
  font-size: 13px; color: var(--t2); cursor: pointer; text-align: left;
}
.user-menu a:hover, .user-menu button:hover { background: var(--info-soft); color: var(--t1); }

/* 权限矩阵 */
.matrix { width: 100%; border-collapse: collapse; font-size: 13px; }
.matrix th {
  font-size: 11.5px; font-weight: 500; color: var(--t3);
  padding: 8px 6px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.matrix td { padding: 7px 6px; border-bottom: 1px solid var(--line-2); color: var(--t2); }
.matrix .center { text-align: center; }
.matrix input[type=checkbox] { width: 15px; height: 15px; accent-color: var(--primary); }
.matrix-group td {
  background: var(--surface-2); font-size: 11.5px; font-weight: 600;
  color: var(--t3); letter-spacing: .6px; padding: 6px 10px;
}

/* 角色选择 */
.role-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(232px, 1fr)); gap: 10px; }
.role-item {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 11px;
  cursor: pointer; transition: all .15s;
}
.role-item:hover { border-color: var(--primary-line); }
.role-item input { margin-top: 2px; width: 15px; height: 15px; accent-color: var(--primary); }
.role-item strong { font-size: 13px; font-weight: 500; display: block; }
.role-item span { font-size: 11.5px; color: var(--t3); line-height: 1.5; display: block; margin-top: 2px; }

/* 数据范围 */
.scope-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 9px 14px; }
.scope-grid .check { padding: 5px 0; }

/* 消息 */
.msg-item {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px 18px; border-bottom: 1px solid var(--line-2);
}
.msg-item:last-child { border-bottom: 0; }
.msg-item.unread { background: #FBFCFF; }
.msg-icon {
  width: 34px; height: 34px; flex: 0 0 auto; border-radius: 10px;
  background: var(--info-soft); display: grid; place-items: center;
}
.msg-body { flex: 1; min-width: 0; }
.msg-title { font-size: 13.5px; font-weight: 500; color: var(--t1); display: flex; align-items: center; gap: 7px; }
.dot-new { width: 6px; height: 6px; border-radius: 50%; background: var(--danger); display: inline-block; }
.msg-text { font-size: 12.5px; color: var(--t2); margin-top: 3px; line-height: 1.6; }
.msg-meta { font-size: 11.5px; color: var(--t3); margin-top: 5px; }

/* 单选卡片 */
.radio-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px; }
.radio-card {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 13px 15px; border: 1px solid var(--line); border-radius: 11px; cursor: pointer;
  transition: all .15s;
}
.radio-card:hover { border-color: var(--primary-line); }
.radio-card input { margin-top: 2px; accent-color: var(--primary); }
.radio-card strong { font-size: 13px; display: block; font-weight: 500; }
.radio-card span { font-size: 11.5px; color: var(--t3); }

@media (max-width: 1180px) {
  .dash-grid, .detail-grid { grid-template-columns: 1fr; }
}

/* ---------------- 批量操作 / 批量新增 ---------------- */
.bulk-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 14px; border-bottom: 1px solid var(--line-2);
  background: var(--surface-2);
}
.bulk-bar .btn[disabled] { opacity: .42; pointer-events: none; }
.bulk-bar .chk { font-size: 12.5px; color: var(--t2); }
.chk-col { width: 38px; text-align: center; }
.chk-col input[type=checkbox] { width: 15px; height: 15px; accent-color: var(--primary); cursor: pointer; }

.bulk-wrap { overflow-x: auto; }
.bulk-tbl { min-width: 880px; }
.bulk-tbl .row-no {
  width: 42px; text-align: center; color: var(--t3); font-size: 11.5px;
  font-variant-numeric: tabular-nums; background: var(--surface-2);
}
.bulk-tbl td { padding: 5px 6px; }
.bulk-tbl .input-sm, .bulk-tbl .select-sm { height: 32px; padding: 0 8px; font-size: 12.5px; }
.bulk-tbl .num-in { text-align: right; }
.bulk-tbl .th-hint { display: block; font-size: 10.5px; font-weight: 400; color: var(--t3); margin-top: 2px; }
.bulk-tbl th .req { color: var(--danger); margin-left: 2px; }
.bulk-foot {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px 14px; border-top: 1px solid var(--line-2);
}

.paste-row { display: flex; gap: 10px; align-items: stretch; }
.paste-box {
  flex: 1 1 auto; min-width: 0; min-height: 88px;
  font-family: var(--mono); font-size: 12.5px; line-height: 1.7;
}
.paste-side { display: flex; flex-direction: column; gap: 8px; flex: 0 0 112px; }
.paste-side .btn { justify-content: center; }
.paste-hint {
  margin-top: 10px; font-size: 11.5px; color: var(--t3);
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center; line-height: 1.9;
}
.paste-hint .tag {
  display: inline-block; padding: 2px 7px; border-radius: 6px;
  background: var(--surface-2); border: 1px solid var(--line);
  color: var(--t2); font-size: 11px; white-space: nowrap;
}
.note {
  margin-top: 10px; padding: 9px 12px; border-radius: 9px;
  background: var(--warn-soft); color: var(--warn); font-size: 12px; line-height: 1.6;
}

@media (max-width: 768px) {
  .bulk-bar { gap: 8px; padding: 9px 12px; }
  .bulk-bar .btn { flex: 1 1 auto; justify-content: center; }
  .bulk-bar .small { order: -1; }
  .paste-row { flex-direction: column; }
  .paste-side { flex: 0 0 auto; flex-direction: row; }
  .paste-side .btn { flex: 1; }
  .bulk-foot .btn { flex: 1 1 auto; justify-content: center; }
}

/* 批量勾选标签 */
.chk { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; user-select: none; }
.chk input[type=checkbox] { width: 15px; height: 15px; accent-color: var(--primary); cursor: pointer; }

/* ===================== 消息中心 / 强制弹窗提醒 ===================== */
.msg-badge {
  position: absolute; top: -4px; right: -6px; min-width: 17px; height: 17px;
  padding: 0 4px; border-radius: 9px; background: var(--danger); color: #fff;
  font-size: 10.5px; font-weight: 700; line-height: 17px; text-align: center;
  font-style: normal; box-shadow: 0 0 0 2px var(--bg);
}

/* 弹窗容器：全屏遮罩层容器，弹窗在其中逐条弹出 */
.msg-popup-wrap { position: fixed; inset: 0; z-index: 1300; pointer-events: none; }

/* 强制弹窗：半透明遮罩 + 居中模态框，不点按钮不消失 */
.msg-overlay {
  pointer-events: auto;
  position: absolute; inset: 0;
  background: rgba(15, 23, 42, .45);
  backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: msgFade .2s ease both;
}
.msg-overlay.out { animation: msgOut .18s ease both; }
@keyframes msgFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes msgOut { from { opacity: 1; } to { opacity: 0; } }

.msg-modal {
  width: 420px; max-width: calc(100vw - 40px);
  background: var(--card, #fff);
  border: 1px solid var(--line-2); border-radius: 14px;
  box-shadow: 0 24px 64px rgba(15, 23, 42, .30);
  overflow: hidden;
  animation: msgPop .26s cubic-bezier(.34, 1.4, .64, 1) both;
}
@keyframes msgPop {
  from { opacity: 0; transform: translateY(14px) scale(.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.msg-modal .mp-head {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 18px 0; font-size: 14.5px; color: var(--t1);
}
.msg-modal .mp-ico {
  flex: 0 0 auto; width: 34px; height: 34px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--warn-soft, #fff7e6); font-size: 17px;
}
.msg-modal .mp-head strong {
  flex: 1 1 auto; font-weight: 600; line-height: 1.45;
  overflow: hidden; text-overflow: ellipsis; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.msg-modal .mp-count {
  flex: 0 0 auto; font-size: 11px; font-weight: 600; color: var(--t3);
  background: var(--line, #f1f5f9); border-radius: 999px; padding: 3px 9px;
}
.msg-modal .mp-body {
  padding: 10px 18px 4px 62px; font-size: 13px; color: var(--t2);
  line-height: 1.7; max-height: 220px; overflow: auto;
  white-space: pre-wrap; word-break: break-word;
}
.msg-modal .mp-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 16px 18px 18px;
}
.msg-modal .mp-time { font-size: 11.5px; color: var(--t3); }
.msg-modal .mp-btns { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.msg-modal .mp-btns .btn { margin: 0; }
.msg-modal .mp-ok { font-weight: 600; }

@media (max-width: 768px) {
  .msg-modal { width: 100%; }
  .msg-modal .mp-body { padding-left: 18px; }
}

/* ===================== 主题切换（浅色 / 深色） ===================== */
.theme-ico-dark { display: none; }
html[data-theme="dark"] .theme-ico-dark { display: inline-flex; }
html[data-theme="dark"] .theme-ico-light { display: none; }

/* 深色主题：翻转内容区变量（侧边栏本为深色，两套主题通用） */
html[data-theme="dark"] {
  --bg:        #0F1522;
  --surface:   #171E2E;
  --surface-2: #1B2334;
  --line:      #273349;
  --line-2:    #212B3F;

  --t1: #E8EDF6;
  --t2: #A8B3C6;
  --t3: #8C99B0;

  --hover: #1E2941;

  --primary-soft: #1D2A55;
  --primary-line: #2E3F79;
  --primary-text: #8FA9FF;

  --success-soft: #14301F;
  --warn-soft:    #33270D;
  --warn:         #E5A54B;
  --danger-soft:  #33191A;
  --danger-line:  #5A2A2C;
  --info-soft:    #1B2430;
  --purple-soft:  #26203A;

  --sh-1: 0 1px 2px rgba(0, 0, 0, .35);
  --sh-2: 0 12px 32px -16px rgba(0, 0, 0, .55);
  --sh-3: 0 24px 64px -24px rgba(0, 0, 0, .70);
}
html[data-theme="dark"] body { background: var(--bg); color: var(--t1); }
html[data-theme="dark"] ::selection { background: rgba(43, 84, 232, .45); }
html[data-theme="dark"] .topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
html[data-theme="dark"] .nav::-webkit-scrollbar-thumb { background: #2E3A50; }
html[data-theme="dark"] img { opacity: .92; }
html[data-theme="dark"] .msg-overlay { background: rgba(2, 6, 16, .62); }

/* 深色主题：彩色标签 / 提示条文字与边框（浅色主题的硬编码色在深色下不可读） */
html[data-theme="dark"] .pill-green  { color: #52D69B; border-color: #2B5940; }
html[data-theme="dark"] .pill-amber  { color: #F0B35C; border-color: #5F4718; }
html[data-theme="dark"] .pill-red    { color: #F28B8B; border-color: #5A2A2C; }
html[data-theme="dark"] .pill-gray   { background: #222B3D; color: #9BA7BB; border-color: #2F3B52; }
html[data-theme="dark"] .pill-purple { color: #BCA4F2; border-color: #413666; }
html[data-theme="dark"] .notice      { color: #F0B35C; border-color: #5F4718; }
html[data-theme="dark"] .notice.info { color: #9DB8FF; }
html[data-theme="dark"] .notice.danger { color: #F28B8B; border-color: #5A2A2C; }
html[data-theme="dark"] .btn:hover { border-color: #3A4A66; }
html[data-theme="dark"] .btn-danger { border-color: #5A2A2C; }
html[data-theme="dark"] .input::placeholder { color: #55617A; }

/* ===================== 附件（订单/单据详情） ===================== */
.att-hint { font-size: 12px; color: var(--t3); margin-bottom: 12px; }
.att-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
.att-item {
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface-2); padding: 10px;
  display: flex; flex-direction: column; gap: 7px;
  transition: box-shadow .16s, border-color .16s;
}
.att-item:hover { border-color: var(--primary-line); box-shadow: var(--sh-1); }
.att-thumb {
  display: flex; align-items: center; justify-content: center;
  height: 96px; border-radius: 9px; overflow: hidden;
  background: var(--line-2); text-decoration: none;
}
.att-thumb img { width: 100%; height: 100%; object-fit: cover; }
.att-thumb-file { color: var(--t2); gap: 6px; flex-direction: column; }
.att-thumb-file .ico { color: var(--primary-text); }
.att-ext { font-size: 11px; font-weight: 700; letter-spacing: .5px; color: var(--t3); }
.att-name {
  font-size: 12.5px; color: var(--t1); font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.att-meta { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--t3); }
.att-ops { display: flex; gap: 6px; }
.att-ops .btn { flex: 1 1 auto; justify-content: center; }
.pill-blue { background: var(--primary-soft); color: var(--primary-text); }

/* ---------------- 一键复制按钮 ---------------- */
.copy-btn {
  display: inline-flex; align-items: center; gap: 4px;
  margin-left: 6px; padding: 2px 11px;
  border: none; border-radius: 999px;
  background: var(--primary); color: #fff;
  font-size: 11.5px; line-height: 1.8; font-family: inherit; font-weight: 600;
  cursor: pointer; vertical-align: middle; white-space: nowrap;
  box-shadow: 0 1px 3px rgba(43, 84, 232, .25);
  transition: background .15s, box-shadow .15s, transform .1s;
}
.copy-btn .ico { width: 12px; height: 12px; flex: 0 0 auto; }
.copy-btn:hover { background: var(--primary-dark); color: #fff; box-shadow: 0 2px 6px rgba(43, 84, 232, .35); }
.copy-btn:active { transform: translateY(1px); box-shadow: none; }
.copy-btn.copied { background: #12B76A; color: #fff; box-shadow: 0 1px 3px rgba(18, 183, 106, .3); }
html[data-theme="dark"] .copy-btn { box-shadow: 0 1px 4px rgba(0, 0, 0, .4); }
html[data-theme="dark"] .copy-btn:hover { box-shadow: 0 2px 7px rgba(0, 0, 0, .5); }

/* 复制文案模板编辑 */
.tpl-vars { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.tpl-var {
  padding: 3px 9px; border: 1px dashed var(--line); border-radius: 999px;
  background: var(--surface-2); color: var(--t2);
  font-size: 11.5px; font-family: var(--mono); cursor: pointer;
  transition: .15s;
}
.tpl-var:hover { border-style: solid; border-color: var(--primary-line); color: var(--primary-text); background: var(--primary-soft); }
.tpl-var.tpl-reset { font-family: inherit; color: var(--t3); }
.tpl-preview {
  margin: 0; padding: 11px 13px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px;
  font-family: inherit; font-size: 13px; line-height: 1.75; color: var(--t1);
  white-space: pre-wrap; word-break: break-all; min-height: 46px;
}

/* ---------------- 发货页自定义快递公司 ---------------- */
.chip-add {
  display: inline-flex; align-items: center; gap: 2px;
  padding: 2px 9px;
  border: 1px dashed var(--line); border-radius: 999px;
  background: transparent; color: var(--t3);
  font-size: 11.5px; line-height: 1.7; font-family: inherit;
  cursor: pointer; transition: .15s;
}
.chip-add .ico { width: 11px; height: 11px; }
.chip-add:hover, .chip-add.active {
  border-style: solid; border-color: var(--primary-line);
  color: var(--primary-text); background: var(--primary-soft);
}
.exp-add-box {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  margin-top: 9px; padding: 9px 11px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface-2);
}
.exp-add-box .input { flex: 1 1 180px; min-width: 150px; }
.exp-remember {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; color: var(--t2); cursor: pointer; white-space: nowrap;
}
.exp-remember input { accent-color: var(--primary); }

/* ---------------- 纯文本可选中复制（客户名称等） ---------------- */
.pick {
  user-select: all; -webkit-user-select: all;
  cursor: text; border-radius: 4px; padding: 0 2px; margin: 0 -1px;
}
.pick:hover { background: var(--primary-soft); }

/* ---------------- 订单金额与欠款 ---------------- */
.pay-sum { display: flex; flex-direction: column; gap: 9px; }
.pay-sum .ps-row {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 13px; color: var(--t2);
}
.pay-sum .ps-row b {
  color: var(--t1); font-size: 13.5px; font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.pay-sum .ps-due {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-top: 3px; padding-top: 11px; border-top: 1px dashed var(--line);
}
.pay-sum .ps-due span { font-size: 12.5px; color: var(--t2); }
.pay-sum .ps-due b {
  font-size: 20px; font-weight: 700; letter-spacing: -.4px;
  font-variant-numeric: tabular-nums;
}
.pay-sum .ps-due.due b { color: var(--danger); }
.pay-sum .ps-due.ok b { color: var(--success); }

/* ---------- 订单表单：客户搜索下拉 + 快捷新建客户 ---------- */
.cus-row{display:flex;gap:8px;align-items:flex-start}
.cus-box{position:relative;flex:1;min-width:0}
.cus-drop{position:absolute;top:calc(100% + 4px);left:0;right:0;z-index:60;
  background:var(--surface);border:1px solid var(--line);border-radius:10px;
  box-shadow:0 12px 32px rgba(15,23,42,.14);max-height:240px;overflow:auto;padding:4px}
.cus-opt{display:flex;justify-content:space-between;align-items:center;gap:10px;
  padding:8px 10px;border-radius:8px;cursor:pointer}
.cus-opt:hover{background:var(--hover)}
.cus-opt .nm{font-weight:500;color:var(--t1);min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.cus-opt .sub{font-size:12px;color:var(--t3);white-space:nowrap;flex-shrink:0}
.cus-opt.none{color:var(--t3);cursor:default;font-size:13px;justify-content:center}
.cus-opt.none:hover{background:transparent}
.cus-add-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
#cusAddBox{border:1px dashed var(--primary-line);background:var(--primary-soft);border-radius:12px;padding:12px 14px}
@media (max-width:720px){.cus-add-grid{grid-template-columns:1fr}}

/* ---------- 公司 Logo ---------- */
.brand-mark.brand-logo{background:transparent;box-shadow:none;overflow:hidden;padding:0}
.brand-mark.brand-logo img{width:100%;height:100%;object-fit:contain;display:block}
.auth-logo{text-align:center;margin-bottom:14px}
.auth-logo img{height:56px;max-width:200px;object-fit:contain}
.logo-row{display:flex;gap:18px;align-items:flex-start;flex-wrap:wrap}
.logo-preview{width:120px;height:120px;border:1px dashed var(--line);border-radius:12px;
  display:flex;align-items:center;justify-content:center;background:var(--hover);overflow:hidden;flex-shrink:0}
.logo-preview img{max-width:100%;max-height:100%;object-fit:contain}
.logo-preview.empty{border-style:dashed}
.logo-empty-txt{font-size:12px;color:var(--t3)}
.logo-ops{flex:1;min-width:240px}
.print-logo{max-height:46px;max-width:180px;object-fit:contain;display:block;margin:0 auto 6px}

/* ---------- 站点页脚 + 备案信息 ---------- */
.site-foot{display:flex;align-items:center;justify-content:center;flex-wrap:wrap;gap:6px;
  padding:14px 24px 20px;font-size:12.5px;color:var(--t3);line-height:1.7}
.site-foot a{color:var(--t3);text-decoration:none;display:inline-flex;align-items:center;gap:4px}
.site-foot a:hover{color:var(--primary-text,#2563EB)}
.site-foot .foot-sep{opacity:.45}
.site-foot .police-ico{flex-shrink:0;opacity:.8}
.auth-foot a{color:var(--t3);text-decoration:none}
.auth-foot a:hover{color:var(--primary-text,#2563EB)}
@media (max-width:720px){.site-foot{padding:12px 16px 18px;font-size:11.5px}}
