/* ============================================================================
   公路货运财务系统 · 全局样式
   规范：浅色、克制、数字右对齐等宽；类名与其他 agent 的约定严格一致。
   目录：
     0. 变量与基础          1. 应用外壳（顶栏/侧栏/内容区）
     2. 页面标题与卡片      3. 统计卡片
     4. 按钮                5. 表格与数字
     6. 标签                7. 表单
     8. 弹窗                9. 轻提示
    10. 分页               11. 空态/加载/键值对/页签
    12. 登录页             13. 工具类与响应式
   ========================================================================== */

/* ---------------------------------------------------------------- 0. 变量 */
:root {
  --bg: #f4f6fa;
  --panel: #ffffff;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #1f2937;
  --text-soft: #64748b;

  --primary: #1d4ed8;
  --primary-dark: #1e40af;
  --primary-soft: #eef2ff;

  --green: #0f7b3f;
  --green-soft: #e7f6ec;
  --red: #c0392b;
  --red-soft: #fdecea;
  --amber: #b45309;
  --amber-soft: #fdf3e3;
  --blue: #1d4ed8;
  --blue-soft: #e8effd;
  --gray: #64748b;
  --gray-soft: #f1f5f9;

  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --shadow-lg: 0 20px 45px rgba(15, 23, 42, .25);
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei",
               "PingFang SC", "Hiragino Sans GB", "Source Han Sans SC", sans-serif;
  --font-mono: "Cascadia Mono", Consolas, "JetBrains Mono", "Courier New", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0; font-weight: 600; }

[hidden] { display: none !important; }

/* ------------------------------------------------------- 1. 应用外壳 */
.app-view { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  height: 56px;
  flex: 0 0 56px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-title { font-size: 15px; font-weight: 700; letter-spacing: .3px; }

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.topbar-user {
  font-size: 13px;
  color: #475569;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 前端版本号：小字灰显，平时不抢眼，排查"改动没生效"时一眼可读 */
.topbar-build {
  font-size: 11px;
  color: #94a3b8;
  font-family: var(--font-mono);
  margin-left: 10px;
  user-select: text;
}

.layout { display: flex; flex: 1; min-height: 0; align-items: stretch; }

.sidebar {
  flex: 0 0 216px;
  width: 216px;
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 6px 0;
  overflow-y: auto;
}

/* 桌面端：点 ☰ 收起侧栏 */
#app-view.sidebar-collapsed .sidebar { display: none; }

.content {
  flex: 1;
  min-width: 0;
  padding: 16px 20px 40px;
}

/* 左侧菜单 */
.menu { display: flex; flex-direction: column; padding: 4px 8px; }

.menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  margin-bottom: 2px;
  border-radius: 8px;
  color: #334155;
  font-size: 13px;
  text-decoration: none;
}
.menu-item:hover { background: var(--gray-soft); text-decoration: none; }
.menu-item.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.menu-icon { width: 18px; text-align: center; flex: 0 0 18px; }
.menu-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-badge {
  background: var(--red);
  color: #fff;
  border-radius: 999px;
  font-size: 11px;
  line-height: 16px;
  padding: 0 6px;
  font-weight: 600;
}

/* --------------------------------------------- 2. 页面标题与卡片 */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.page-title { font-size: 18px; font-weight: 600; }

.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.page-body { min-width: 0; }

/* 每次 renderPage 生成的页面根容器。
   存在的意义是"事件隔离"：换页时整体替换这个元素，
   旧页面挂在它上面的监听器随之被丢弃，不会串到新页面。
   这里只保证它不改变原有布局（块级、占满宽度、不产生额外间距）。 */
.page-root { display: block; width: 100%; min-width: 0; }

/* 身份切换（降权）提示条：常驻在顶栏下方，用醒目的琥珀色，
   避免使用者忘了自己正在以较低身份操作、却找不到某些菜单时的困惑。 */
.impersonate-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 16px;
  background: var(--amber-soft, #fef3c7);
  border-bottom: 1px solid #f0d7a8;
  color: #7c2d12;
  font-size: 13px;
}
.impersonate-bar b { font-weight: 700; }
.impersonate-bar .btn { margin-left: auto; }
@media (max-width: 720px) {
  .impersonate-bar { padding: 8px 12px; }
  .impersonate-bar .btn { margin-left: 0; }
}

/* 身份切换弹窗里的身份列表 */
.switch-role-list { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.switch-role-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.switch-role-item:hover { background: #f8fafc; border-color: var(--primary, #2563eb); }
.switch-role-item.is-active {
  border-color: var(--primary, #2563eb);
  background: var(--blue-soft, #e8f0fe);
}
.switch-role-item input { accent-color: var(--primary, #2563eb); }
.switch-role-name { font-weight: 600; font-size: 13.5px; }
.switch-role-note { color: var(--text-soft, #64748b); font-size: 12px; }
@media (max-width: 560px) {
  .switch-role-item { grid-template-columns: auto 1fr; }
  .switch-role-note { grid-column: 2; }
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 14px;
  min-width: 0;
}
.card:last-child { margin-bottom: 0; }

.card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  font-weight: 600;
}

.card-body { padding: 14px 16px; min-width: 0; }

/* ------------------------------------------------------- 3. 统计卡片 */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.stat-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: var(--shadow);
  min-width: 0;
}

.stat-label { font-size: 12px; color: var(--text-soft); margin-bottom: 6px; }

.stat-value {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  word-break: break-all;
}

.stat-hint { font-size: 12px; color: var(--text-soft); margin-top: 4px; }

.tone-green .stat-value { color: var(--green); }
.tone-red .stat-value { color: var(--red); }
.tone-amber .stat-value { color: var(--amber); }
.tone-blue .stat-value { color: var(--blue); }
.tone-gray .stat-value { color: var(--gray); }

/* ----------------------------------------------------------- 4. 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}

.btn:hover:not(:disabled) { border-color: #94a3b8; background: #f8fafc; }

.btn:disabled {
  opacity: .55;
  cursor: not-allowed;
  background: #f1f5f9;
  color: #94a3b8;
  border-color: var(--border);
}

.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-primary:disabled { background: #93a9dd; border-color: #93a9dd; color: #fff; }

.btn-ghost { background: #fff; border-color: var(--border-strong); color: #334155; }
.btn-ghost:hover:not(:disabled) { background: var(--gray-soft); }

.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #a5311f; border-color: #a5311f; }
.btn-danger:disabled { background: #e0a49b; border-color: #e0a49b; color: #fff; }

.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; }

/* 绿色实底按钮：用于"导出"这类希望被一眼看到的操作（比 ghost 明显得多） */
.btn-success { background: var(--green); border-color: var(--green); color: #fff; }
.btn-success:hover:not(:disabled) { background: #0b6332; border-color: #0b6332; }
.btn-success:disabled { background: #8fc0a4; border-color: #8fc0a4; color: #fff; }

.btn-block { width: 100%; height: 36px; }

/* -------------------------------------------------- 5. 表格与数字 */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: var(--panel);
}

.table th {
  text-align: left;
  padding: 10px 12px;
  background: #f8fafc;
  color: #475569;
  font-weight: 600;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}

.table td {
  padding: 9px 12px;
  border-bottom: 1px solid #eef2f7;
  vertical-align: middle;
}

.table tbody tr:hover { background: #f8fbff; }
.table tbody tr:last-child td { border-bottom: none; }

/* 金额/数字：右对齐 + 等宽 + 表格数字对齐 */
.num {
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* 数字但**不换字体**：整数（件数/方数）不需要对齐小数点，用等宽字体只会跟同一行里的
   中文列显得字号不齐（等宽字形本来就更窄更小）。用 tabular-nums 保证位数对齐即可。 */
.num-plain {
  text-align: right;
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* 列宽可控的表格：配合列定义里的 width 使用，避免列宽被内容随机撑开（"列宽看着歪"） */
.table-fixed { table-layout: fixed; }
.table-fixed td { overflow-wrap: anywhere; }
/* 编号这类不该折行的短字段：超长就省略号，折断的编号比省略号更难认 */
.table-fixed td.cell-ellipsis {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.center { text-align: center; }

/* ----------------------------------------------------------- 6. 标签 */
.tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 18px;
  border: 1px solid transparent;
  white-space: nowrap;
}

.tag-green { background: var(--green-soft); color: var(--green); border-color: #bfe3cb; }
.tag-red { background: var(--red-soft); color: var(--red); border-color: #f3c2bb; }
.tag-amber { background: var(--amber-soft); color: var(--amber); border-color: #f0d7a8; }
.tag-blue { background: var(--blue-soft); color: var(--blue); border-color: #c3d4f7; }
.tag-gray { background: var(--gray-soft); color: var(--gray); border-color: #dde3ea; }

/* ----------------------------------------------------------- 7. 表单 */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(236px, 1fr));
  gap: 12px 16px;
}

.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }

.field-label { font-size: 13px; font-weight: 600; color: #475569; }

.field-required { color: var(--red); margin-left: 2px; }

.input, .select, .textarea {
  width: 100%;
  padding: 6px 10px;
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

.input { height: 32px; }
.select { height: 32px; }
.textarea { min-height: 72px; resize: vertical; line-height: 1.5; }

.input:focus, .select:focus, .textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, .12);
}

.input:disabled, .select:disabled, .textarea:disabled {
  background: #f1f5f9;
  color: #94a3b8;
  cursor: not-allowed;
}

.input[type="number"] { font-family: var(--font-mono); text-align: right; }

.checkbox { width: 16px; height: 16px; accent-color: var(--primary); }

.form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}

/* 表单错误提示。
   刻意做成"块级告警条 + 图标 + 抖动动画"，而不是一行小字：
   用户点按钮失败时最容易忽略的恰恰是角落里那行小红字，
   会误以为"按钮没反应"。 */
.field-error {
  color: #7f1d1d;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.5;
}
.field-error:not([hidden]) {
  display: block;
  margin: 10px 0 0;
  padding: 10px 12px 10px 34px;
  background: var(--red-soft);
  border: 1px solid #f3c2bb;
  border-left: 4px solid var(--red);
  border-radius: 6px;
  position: relative;
  animation: frt-shake 0.32s ease-in-out 1;
}
/* 用一个"!"圆点作为图标，避免引入图片或图标字体 */
.field-error:not([hidden])::before {
  content: "!";
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  line-height: 16px;
  text-align: center;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}
/* 出错的字段本身也要标出来，让用户一眼看到该改哪里 */
.field.has-error .input,
.field.has-error .select,
.field.has-error .textarea,
.input.has-error,
.select.has-error {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
}
@keyframes frt-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

.field-hint { color: var(--text-soft); font-size: 12px; }

/* ------------------------------------------------- 7.1 日期 / 时间输入 */
/* 原生 date/time 控件默认只有文字那一点点可点区域，很难点中。
   这里让它铺满整个输入框，并把日历图标放大、放在右侧固定位置，
   整块区域都可点开选择器。 */
.input[type="date"],
.input[type="time"],
.input[type="datetime-local"] {
  cursor: pointer;
  padding-right: 38px;
  min-height: 38px;
  /* 自绘日历图标：整块背景定位在右侧，配合下面放大的原生图标热区 */
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='1.8' stroke-linecap='round'%3E%3Crect x='3' y='5' width='18' height='16' rx='2'/%3E%3Cpath d='M8 3v4M16 3v4M3 10h18'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  background-size: 19px 19px;
}
.input[type="date"]::-webkit-calendar-picker-indicator,
.input[type="time"]::-webkit-calendar-picker-indicator,
.input[type="datetime-local"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0;
  /* 热区放大到整个右侧区域，随便点哪儿都能打开选择器 */
  width: 38px;
  height: 100%;
  margin: 0 -10px 0 0;
  padding: 0;
}
.input[type="date"]:hover,
.input[type="time"]:hover,
.input[type="datetime-local"]:hover {
  border-color: var(--primary);
}
/* 日期为空时浏览器会显示 "年/月/日" 占位文字，颜色调淡一点更像占位符 */
.input[type="date"]:invalid,
.input[type="date"]:not(:focus):placeholder-shown {
  color: var(--text-soft);
}

/* 日期/时间字段的外层包裹：自带一个明显的"打开选择器"按钮 */
.date-wrap { position: relative; display: block; width: 100%; }
/* ⚠️ 这里**不要**给 .input 加 padding-right。
   加过 34px（想给右侧按钮腾位置），结果字段宽度从 173px 变成 169px，
   同一行后面的控件整体左移 —— 用户看到的就是"日期的显示位置变了"。
   日期文本（如 2026-09-22）本身只有约 80px，即使按钮占住右侧 34px 也不会重叠，
   所以保持原样即可。改布局前先做 A/B 量一下，别凭感觉动。 */
.date-wrap > .input { width: 100%; }

/* 筛选条里手写的日期框：包裹层必须收缩到输入框自身宽度。
   flex 子项会被"块化"，width:auto 并不保证收缩到内容宽度，
   所以显式写明不参与伸缩，尺寸完全由输入框自身决定。 */
.date-wrap--inline {
  display: inline-block;
  width: auto;
  flex: 0 0 auto;
  vertical-align: middle;
}
.date-wrap--inline > .input { width: auto; }

/* 空值时的占位文案。
   原生 date 控件会忽略 placeholder 属性、自己显示 "yyyy/mm/dd" 那种格式骨架，
   又丑又像填错了。做法是：
     · 空值且**没有焦点**时，把输入框自己的文字设为透明 → 骨架看不见；
     · 同时用包裹层的伪元素画中文提示，并盖在输入框之上。
   聚焦时（键盘 Tab 进来）两条规则都撤掉，恢复原生骨架，让人知道该往哪输。
   ⚠️ 这里刻意**不用** `::-webkit-datetime-edit { color: transparent }`：
      实测那条规则不生效（取计算样式仍是 rgb(31,41,55)，骨架照样显示），
      是个"看着对、其实没用"的写法，改用可测量的 color 方案。
   伪元素要 z-index 提升才盖得住输入框背景；right 留出按钮位置；
   pointer-events:none 保证点击穿透到输入框和按钮。 */
.date-wrap.is-empty:not(:focus-within)::before {
  content: attr(data-placeholder);
  position: absolute;
  z-index: 2;
  left: 10px;
  right: 34px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-soft, #94a3b8);
  font-size: 13px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}
.date-wrap.is-empty > .input:not(:focus) { color: transparent; }
.date-pick-btn {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  padding: 0;
}
.date-pick-btn:hover { background: var(--primary-soft, #e8f0fe); }
.date-pick-icon {
  width: 17px;
  height: 17px;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='1.8' stroke-linecap='round'%3E%3Crect x='3' y='5' width='18' height='16' rx='2'/%3E%3Cpath d='M8 3v4M16 3v4M3 10h18'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
}

/* ------------------------------------------------- 7.2 自绘日历面板 */
.dp-panel {
  position: absolute;
  z-index: 60;
  top: calc(100% + 6px);
  left: 0;
  width: 268px;
  padding: 10px;
  background: var(--panel, #fff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.16);
  animation: dp-pop 0.12s ease-out;
}
@keyframes dp-pop {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
.dp-head {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 8px;
}
.dp-nav {
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  color: var(--text, #0f172a);
}
.dp-nav:hover { background: #f1f5f9; }
.dp-title { flex: 1 1 auto; font-weight: 600; font-size: 13px; }
.dp-year, .dp-month {
  height: 26px;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 6px;
  background: transparent;
  font-size: 12px;
  cursor: pointer;
  padding: 0 2px;
}
.dp-year { flex: 0 0 74px; }
.dp-month { flex: 1 1 auto; }
.dp-week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  margin-bottom: 4px;
}
.dp-week span {
  text-align: center;
  font-size: 11px;
  color: var(--text-soft, #64748b);
  padding: 2px 0;
}
.dp-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.dp-day {
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  color: var(--text, #0f172a);
  cursor: pointer;
  padding: 0;
}
button.dp-day:hover { background: #eef2f7; }
.dp-day.is-out { color: #cbd5e1; cursor: default; }
.dp-day.is-today { box-shadow: inset 0 0 0 1px var(--primary, #2563eb); font-weight: 600; }
.dp-day.is-sel,
.dp-day.is-sel:hover {
  background: var(--primary, #2563eb);
  color: #fff;
  font-weight: 600;
}
.dp-foot {
  display: flex;
  gap: 6px;
  margin-top: 9px;
  padding-top: 9px;
  border-top: 1px solid var(--border, #e2e8f0);
}
.dp-btn {
  flex: 1 1 auto;
  height: 28px;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 6px;
  background: transparent;
  font-size: 12px;
  cursor: pointer;
}
.dp-btn:hover { background: #f1f5f9; }
.dp-btn-primary {
  background: var(--primary, #2563eb);
  border-color: var(--primary, #2563eb);
  color: #fff;
}
.dp-btn-primary:hover { filter: brightness(1.06); background: var(--primary, #2563eb); }
.dp-times {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 3px;
  max-height: 208px;
  overflow: auto;
}
.dp-time {
  height: 26px;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 6px;
  background: transparent;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.dp-time:hover { background: #eef2f7; }
.dp-time.is-sel { background: var(--primary, #2563eb); border-color: var(--primary, #2563eb); color: #fff; }

/* ----------------------------------------------------------- 8. 弹窗 */
/* 弹窗打开时锁住页面滚动（core.js 的 openModal 会加这个类） */
body.modal-open { overflow: hidden; }

.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 48px 16px;
  overflow: auto;
  background: rgba(15, 23, 42, .45);
  opacity: 0;
  transition: opacity .15s ease-out;
}
.modal-mask.modal-in { opacity: 1; }

.modal {
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - 96px);
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.modal-lg { max-width: 900px; }

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
  font-weight: 600;
}

.modal-x {
  border: none;
  background: none;
  font-size: 20px;
  line-height: 1;
  color: var(--text-soft);
  cursor: pointer;
  padding: 0 4px;
}
.modal-x:hover { color: var(--text); }

.modal-body { padding: 16px 18px; overflow: auto; min-width: 0; }

.modal-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  background: #fbfcfe;
  flex-wrap: wrap;
}

.confirm-text { font-size: 14px; line-height: 1.7; word-break: break-word; }

/* --------------------------------------------------------- 9. 轻提示 */
.toast-wrap {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(420px, 90vw);
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--gray);
  background: #fff;
  box-shadow: var(--shadow);
  font-size: 13px;
  line-height: 1.5;
  cursor: pointer;
  word-break: break-word;
  animation: toast-in .18s ease-out;
}

.toast-ok { border-left-color: var(--green); background: #f4fbf6; color: #14532d; }
.toast-error { border-left-color: var(--red); background: #fff5f4; color: #7f1d1d; }
.toast-out { opacity: 0; transform: translateX(12px); transition: opacity .2s, transform .2s; }

@keyframes toast-in {
  from { opacity: 0; transform: translateX(16px); }
  to { opacity: 1; transform: none; }
}

/* ----------------------------------------------------------- 10. 分页 */
.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 2px;
}

.pager-info { font-size: 12px; color: var(--text-soft); }

.pager-btns { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.pager-input { width: 68px; text-align: center; height: 28px; }

/* --------------------------------- 11. 空态 / 加载 / 键值对 / 页签 */
.empty {
  padding: 30px 12px;
  text-align: center;
  color: var(--text-soft);
  font-size: 13px;
}

.loading {
  padding: 30px 12px;
  text-align: center;
  color: var(--text-soft);
  font-size: 13px;
}

.loading::before {
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 8px;
  vertical-align: -2px;
  border: 2px solid #cbd5e1;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.kv {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(268px, 1fr));
  gap: 0 18px;
}

.kv-row {
  display: flex;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px dashed #eef2f7;
  font-size: 13px;
  min-width: 0;
}

.kv-key { flex: 0 0 104px; color: var(--text-soft); }
.kv-val { flex: 1; min-width: 0; word-break: break-all; }

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
  overflow-x: auto;
}

.tab {
  padding: 8px 14px;
  border: none;
  border-bottom: 2px solid transparent;
  background: none;
  font-family: inherit;
  font-size: 13px;
  color: var(--text-soft);
  cursor: pointer;
  white-space: nowrap;
}

.tab:hover { color: var(--text); }

.tab-active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* --------------------------------------------------------- 12. 登录页 */
/*
   2026-10-24 改版（使用者："太简陋，不够简洁大气时尚"）：
     左：深蓝渐变品牌区（极淡路线纹理 + 三条能力说明），
     右：干净白卡表单（图标输入框、密码可切换明文、记住用户名）。
   窄屏（≤ 960px）：品牌区收成顶部横幅，表单占满，不出现横向滚动。
*/
.login-view {
  --login-ink: #0f172a;
  --login-line: #e3e9f2;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  background: #f6f8fc;
  /* 品牌区的光晕与路线纹理是溢出的装饰，必须裁掉，否则窄屏会多出横向滚动条 */
  overflow: hidden;
}

/* ---------------- 左：品牌区 ---------------- */
.login-aside {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 56px 56px 28px;
  color: #eaf2ff;
  background:
    radial-gradient(900px 520px at 12% 8%, rgba(56, 132, 255, .38), transparent 62%),
    radial-gradient(760px 520px at 92% 96%, rgba(16, 185, 168, .26), transparent 60%),
    linear-gradient(152deg, #0a1b33 0%, #102c4f 46%, #143a63 100%);
}

.login-aside-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(46px);
  pointer-events: none;
}
.login-aside-glow-a {
  width: 380px; height: 380px; left: -120px; top: -90px;
  background: rgba(74, 144, 255, .28);
}
.login-aside-glow-b {
  width: 320px; height: 320px; right: -110px; bottom: -110px;
  background: rgba(45, 212, 191, .20);
}

.login-aside-route {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: .55;
  pointer-events: none;
}

.login-aside-inner { position: relative; z-index: 1; max-width: 520px; }

.login-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 52px; }
.login-logo-mark {
  width: 42px; height: 42px; flex: 0 0 42px;
  display: grid; place-items: center;
  border-radius: 13px;
  background: linear-gradient(140deg, #4f8cff, #2f6ef0);
  box-shadow: 0 10px 26px rgba(47, 110, 240, .38);
  color: #fff;
}
.login-logo-mark svg { width: 24px; height: 24px; }
.login-logo-text { font-size: 15px; font-weight: 600; letter-spacing: .06em; color: #dce9ff; }

.login-aside-title {
  margin: 0 0 16px;
  font-size: 38px;
  line-height: 1.32;
  font-weight: 700;
  letter-spacing: .01em;
  color: #fff;
}

.login-aside-sub {
  margin: 0 0 40px;
  max-width: 460px;
  font-size: 14px;
  line-height: 1.85;
  color: rgba(226, 238, 255, .74);
}

.login-feats { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; }
.login-feats li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 13px;
  line-height: 1.7;
  color: rgba(226, 238, 255, .8);
}
.login-feats b { display: block; color: #fff; font-weight: 600; font-size: 13.5px; margin-bottom: 2px; }
.login-feat-ico {
  flex: 0 0 30px; width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 9px;
  background: rgba(255, 255, 255, .1);
  border: 1px solid rgba(255, 255, 255, .16);
  color: #9ec5ff;
}
.login-feat-ico svg { width: 16px; height: 16px; }

.login-aside-foot {
  position: relative;
  z-index: 1;
  font-size: 12px;
  color: rgba(203, 222, 248, .5);
  letter-spacing: .02em;
}

/* ---------------- 右：表单区 ---------------- */
.login-main {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}

.login-panel {
  width: 100%;
  max-width: 384px;
}

/* 入场：品牌区文字与表单轻微上浮淡入（"时尚"一点的动效；用户开了"减少动效"就不动） */
@keyframes loginRise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.login-aside-inner > * { animation: loginRise .5s cubic-bezier(.22,.61,.36,1) both; }
.login-aside-inner > *:nth-child(2) { animation-delay: .06s; }
.login-aside-inner > *:nth-child(3) { animation-delay: .12s; }
.login-aside-inner > *:nth-child(4) { animation-delay: .18s; }
.login-panel { animation: loginRise .5s cubic-bezier(.22,.61,.36,1) both; animation-delay: .08s; }

@media (prefers-reduced-motion: reduce) {
  .login-aside-inner > *, .login-panel { animation: none; }
}

.login-head { margin-bottom: 28px; }
.login-head-mark {
  width: 44px; height: 44px;
  display: none;
  place-items: center;
  border-radius: 13px;
  background: linear-gradient(140deg, #4f8cff, #2f6ef0);
  color: #fff;
  margin-bottom: 18px;
}
.login-head-mark svg { width: 24px; height: 24px; }

.login-title {
  margin: 0 0 8px;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: .01em;
  color: var(--login-ink, #0f172a);
}
.login-sub { margin: 0; font-size: 13.5px; color: #7c8aa0; }

.login-form { display: flex; flex-direction: column; gap: 16px; }

.login-field { display: flex; flex-direction: column; gap: 7px; }
.login-label { font-size: 13px; font-weight: 600; color: #48566b; }

.login-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  height: 48px;
  border: 1px solid var(--login-line, #e3e9f2);
  border-radius: 12px;
  background: #fff;
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}
.login-input-wrap:hover { border-color: #cfdaea; }
.login-input-wrap:focus-within {
  border-color: #3b7cff;
  box-shadow: 0 0 0 4px rgba(59, 124, 255, .13);
  background: #fff;
}

.login-input-ico {
  flex: 0 0 46px;
  display: grid;
  place-items: center;
  color: #9aa8bd;
  pointer-events: none;
}
.login-input-ico svg { width: 19px; height: 19px; }
.login-input-wrap:focus-within .login-input-ico { color: #3b7cff; }

.login-input {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  padding: 0 14px 0 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 14.5px;
  color: var(--login-ink, #0f172a);
  font-family: inherit;
  letter-spacing: .01em;
}
.login-input::placeholder { color: #aab6c8; }
.login-input:-webkit-autofill {
  -webkit-text-fill-color: var(--login-ink, #0f172a);
  box-shadow: inset 0 0 0 60px #fff;
}

.login-pwd-toggle {
  flex: 0 0 44px;
  height: 100%;
  border: 0;
  background: transparent;
  color: #97a5ba;
  cursor: pointer;
  display: grid;
  place-items: center;
  border-radius: 0 12px 12px 0;
  transition: color .15s ease, background .15s ease;
}
.login-pwd-toggle svg { width: 19px; height: 19px; }
.login-pwd-toggle:hover { color: #3b7cff; background: #f5f8ff; }
.login-pwd-toggle.is-on { color: #3b7cff; }

.login-row { display: flex; align-items: center; justify-content: space-between; margin-top: -2px; }
.login-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #66758c;
  cursor: pointer;
  user-select: none;
}
.login-check input {
  width: 15px; height: 15px;
  accent-color: #3b7cff;
  cursor: pointer;
}

.login-error {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: #fff1f0;
  border: 1px solid #ffd7d3;
  color: #c0362c;
  font-size: 13px;
  line-height: 1.6;
}
.login-error[hidden] { display: none; }

.login-submit {
  position: relative;
  height: 48px;
  width: 100%;
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .16em;
  text-indent: .16em;
  color: #fff;
  background: linear-gradient(135deg, #3f7dff 0%, #2f6ef0 55%, #2a63df 100%);
  box-shadow: 0 12px 26px rgba(47, 110, 240, .28);
  transition: transform .14s ease, box-shadow .16s ease, filter .16s ease;
}
.login-submit:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 16px 30px rgba(47, 110, 240, .34);
  filter: saturate(1.05);
}
.login-submit:active:not(:disabled) { transform: translateY(0); box-shadow: 0 8px 18px rgba(47, 110, 240, .26); }
.login-submit:disabled { cursor: default; filter: grayscale(.15); opacity: .72; box-shadow: none; }
.login-submit:focus-visible { outline: 3px solid rgba(59, 124, 255, .35); outline-offset: 2px; }

.login-foot {
  margin-top: 26px;
  padding-top: 20px;
  border-top: 1px solid #edf1f7;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #8895a8;
}
.login-foot-label { color: #a5b1c2; margin-right: 2px; }
.login-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  background: #f2f6fd;
  border: 1px solid #e4ecf9;
  color: #53657e;
  font-size: 11.5px;
  line-height: 1.6;
}
.login-chip .mono { color: #2f6ef0; font-size: 11.5px; }
.login-foot-tip { flex: 1 1 100%; color: #a5b1c2; font-size: 11.5px; }

/* 平板：品牌区收窄 */
@media (max-width: 1180px) {
  .login-aside { padding: 44px 36px 24px; }
  .login-aside-title { font-size: 32px; }
  .login-logo { margin-bottom: 40px; }
}

/* 窄屏：上下布局（品牌区变顶部横幅） */
@media (max-width: 960px) {
  /*
    窄屏下浏览器会把装饰性光晕/纹理算进"可滚动区域"，手机能左右拖动一点。
    这里直接掐掉横向滚动（数据表格自己有 .table-wrap 内部滚动，不受影响）。
  */
  html, body { overflow-x: hidden; }
  .login-view { grid-template-columns: 1fr; }
  .login-aside {
    padding: 26px 22px 22px;
    justify-content: flex-start;
  }
  .login-aside-inner { max-width: none; }
  .login-logo { margin-bottom: 16px; }
  .login-aside-title { font-size: 22px; margin-bottom: 10px; }
  .login-aside-title br { display: none; }
  .login-aside-sub { margin-bottom: 0; font-size: 13px; }
  .login-feats, .login-aside-foot { display: none; }
  .login-main { align-items: flex-start; padding: 28px 18px 40px; }
  .login-head-mark { display: grid; }
}

@media (max-width: 420px) {
  .login-title { font-size: 22px; }
  .login-panel { max-width: none; }
}

/* ------------------------------------------- 13. 工具类与响应式 */
.neg { color: var(--red); font-weight: 600; }
.muted { color: var(--text-soft); }
.mono { font-family: var(--font-mono); }
.nowrap { white-space: nowrap; }

.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-amber { color: var(--amber); }

.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.mt-12 { margin-top: 12px; }
.mb-12 { margin-bottom: 12px; }

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px 16px; }

.section-title { font-size: 14px; font-weight: 600; margin: 14px 0 8px; }

.divider { height: 1px; background: var(--border); margin: 12px 0; border: none; }

.alert {
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  border: 1px solid var(--border);
  background: var(--gray-soft);
  margin-bottom: 12px;
}
.alert-info { background: var(--blue-soft); border-color: #c3d4f7; color: #1e3a8a; }
.alert-warn { background: var(--amber-soft); border-color: #f0d7a8; color: #7c2d12; }
.alert-danger { background: var(--red-soft); border-color: #f3c2bb; color: #7f1d1d; }

/* 窄屏：侧栏改为抽屉式，表格横向滚动，统计卡片两列 */
@media (max-width: 900px) {
  .content { padding: 12px 12px 32px; }

  .topbar { padding: 0 10px; gap: 8px; }
  .topbar-title { font-size: 14px; }
  .topbar-user { display: none; }

  .sidebar {
    position: fixed;
    top: 56px;
    bottom: 0;
    left: 0;
    z-index: 60;
    width: 232px;
    transform: translateX(-100%);
    transition: transform .2s ease-out;
    box-shadow: none;
  }

  #app-view.sidebar-open .sidebar {
    transform: none;
    box-shadow: 0 12px 32px rgba(15, 23, 42, .22);
  }

  /* 窄屏下 ☰ 控制抽屉，不再用 sidebar-collapsed 隐藏 */
  #app-view.sidebar-collapsed .sidebar { display: block; }

  .stat-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }

  .modal-mask { padding: 16px 10px; }
  .modal { max-height: calc(100vh - 32px); }

  .login-hint-grid { grid-template-columns: 1fr; }
}

/* --------------------------------------------------------------------------
   往来单位搜索式下拉（combobox）
   --------------------------------------------------------------------------
   原来是一个纯 <select>，单位多了要一页页翻；现在输入关键字，
   匹配结果**直接列在下面**（浮层），点一下或回车即选中。
   原生 select 仍在 DOM 里（display:none），只当取值来源用。
   -------------------------------------------------------------------------- */
.org-combo { position: relative; }

.org-combo-native { display: none !important; }

.org-combo-input.is-empty { color: #64748b; }

.org-combo-panel {
  position: fixed;
  z-index: 200;                 /* 高于 .modal-mask(100) */
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, .18);
  overflow: auto;
  padding: 4px 0;
}

.org-combo-item {
  padding: 7px 12px;
  font-size: 14px;
  line-height: 1.4;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.org-combo-item:hover,
.org-combo-item.is-active { background: #eef2ff; }

.org-combo-item.is-selected { font-weight: 600; color: var(--primary); }

.org-combo-item.org-combo-new { color: var(--primary); border-top: 1px solid var(--border); }

.org-combo-empty { padding: 9px 12px; font-size: 13px; color: #64748b; }

.org-combo-more { padding: 7px 12px; font-size: 12px; color: #64748b; background: #fbfcfe; }
/* 运踪列表：横向展示"昨天/今天/最新"，单元格两行（时间+状态 / 位置·进度） */
.track-cell { line-height: 1.35; }
.track-head { display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.track-head .tag { font-size: 12px; }
.track-stale { color: #b45309; font-weight: 600; }
/* --------------------------------------------------------------------------
   运踪关键节点（2026-10-15）
   --------------------------------------------------------------------------
   节点是**有顺序**的流程位置：未入库 → 已入库 → … → 已卸货。
   进度条把 9 步并排画出来，当前步高亮，一眼看出走到哪、还剩几步。
   -------------------------------------------------------------------------- */
.node-stepper-wrap { margin: 10px 0 4px; overflow-x: auto; padding-bottom: 4px; }

.node-stepper { display: flex; align-items: stretch; gap: 4px; min-width: max-content; }

.node-step {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  color: #475569;
  background: #fff;
  white-space: nowrap;
}

.node-step-no {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #eef2f7;
  font-size: 11px;
  font-weight: 600;
}

.node-step.is-current {
  border-color: var(--primary);
  background: #eef2ff;
  color: var(--primary);
  font-weight: 600;
}

.node-step.is-current .node-step-no { background: var(--primary); color: #fff; }

.node-step-arrow { display: flex; align-items: center; color: #cbd5e1; font-size: 12px; }
/* 关键节点时间线：9 个节点各自的时间（2026-10-15） */
.node-timeline {
  margin: 6px 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  background: #fbfcfe;
}
.node-timeline .kv-row { padding: 3px 0; }
.node-timeline .kv-key { min-width: 132px; color: #475569; }
.node-timeline .kv-val { font-variant-numeric: tabular-nums; }
/* --------------------------------------------------------------------------
   订单备忘事项（2026-10-19）
   -------------------------------------------------------------------------- */
.memo-list { display: flex; flex-direction: column; gap: 8px; margin: 6px 0 2px; }

.memo-item {
  border: 1px solid var(--border);
  border-left: 3px solid var(--warn, #f59e0b);
  border-radius: 6px;
  padding: 8px 10px;
  background: #fffdf5;
}

.memo-item.memo-deleted { border-left-color: #cbd5e1; background: #f8fafc; opacity: 0.8; }
.memo-item .memo-text { font-size: 14px; color: #1f2937; white-space: pre-wrap; word-break: break-word; }
.memo-item .memo-meta { margin-top: 4px; font-size: 12px; color: #64748b; }
.memo-item .memo-meta .btn { margin-left: 6px; }

.memo-targets { display: flex; flex-wrap: wrap; gap: 6px; }
.memo-badge { margin-left: 6px; }
.selection-bar { background: #eef2ff; border: 1px solid #c7d2fe; border-radius: 8px; }

/* 批量备忘提示：按订单分组的标题（2026-10-19） */
.memo-group { margin-bottom: 12px; }
.memo-group-title {
  font-weight: 600;
  font-size: 13px;
  color: #334155;
  margin: 4px 0 4px;
  padding-left: 2px;
  border-left: 3px solid var(--primary);
  padding-left: 8px;
}

/* 审核 / 付款弹窗里常驻的备忘提示块（2026-10-19） */
.memo-inline-alert {
  border: 1px solid #fcd34d;
  border-left: 4px solid #f59e0b;
  background: #fffbeb;
  border-radius: 8px;
  padding: 10px 12px 6px;
  margin: 0 0 12px;
}
.memo-inline-head {
  font-weight: 600;
  font-size: 13px;
  color: #92400e;
  margin-bottom: 8px;
}
.memo-inline-alert .memo-item { background: #fff; }

/* 固定 3 列的键值区（审核支付申请弹窗用：第一行 工编号/车号/申请人，第二行 货物/件数/方数） */
.kv.kv-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 720px) {
  .kv.kv-3 { grid-template-columns: 1fr; }
}

/* --------------------------------------------------------------------------
   运踪列表的流程进度条（2026-10-21）
   --------------------------------------------------------------------------
   10 个格子横排：走过的实心、当前节点加深并描边、没到的浅灰。
   第二行是节点时间，第三行是"第 N/10 步 · 节点名"。
   -------------------------------------------------------------------------- */
.np-wrap { min-width: 0; }

/* 逐个节点：每个节点 = 圆点 + 节点名 + 到达时间（三行小字） */
.np-nodes {
  position: relative;        /* 让底轨/fill 绝对定位在节点后面 */
  display: flex;
  align-items: flex-start;
  gap: 0;
}

/* 贯穿所有节点的直线：浅灰底轨 + 淡绿已走部分（圆点不透明，看起来线从节点中间穿过） */
.np-rail,
.np-rail-fill {
  position: absolute;
  top: 8px;                  /* 圆点高 18px，线放在圆心高度 */
  height: 2px;
  border-radius: 1px;
  z-index: 0;
}

.np-rail {
  left: 5%;                  /* 第一个圆心在 5%，最后一格圆心在 95% */
  right: 5%;
  background: #e2e8f0;
}

.np-rail-fill {
  left: 5%;
  background: #80FF00;       /* 节点前的线段跟着变色（使用者指定的绿） */
}

.np-item {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;        /* 高于底轨 */
  z-index: 1;
}

.np-name {
  margin-top: 3px;
  /* 9 个节点、名字又长，缩 0.5px 才不会换行（2026-10-24） */
  font-size: 9.5px;
  line-height: 1.15;
  color: #94a3b8;
  overflow-wrap: anywhere;   /* 万一还有长名，宁可自己换行也别压到邻格 */
  padding: 0 1px;
}

.np-name.is-on { color: #2f6b00; font-weight: 600; }

.np-time {
  margin-top: 1px;
  font-size: 10px;
  line-height: 1.15;
  color: #a8b3c2;
  white-space: nowrap;
  letter-spacing: -0.2px;
}

.np-time.is-on { color: #475569; }

.np-node {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  background: #f1f5f9;
  color: #94a3b8;
  border: 1px solid #e2e8f0;
  cursor: default;
}

/* 已通过：使用者指定绿色 #80FF00（亮绿），配深色字才看得清 */
.np-node.is-passed {
  background: #80FF00;
  color: #17320a;
  border-color: #80FF00;
}

/* 当前（最新）节点：同色、不加暗框、**不做动画**
   （2026-10-21 使用者："那么多车的动效放一起看着会眼花"）。
   靠"加粗 + 一圈淡的同色光环"把它挑出来，静悄悄但不失辨识度。 */
.np-node.is-current {
  background: #80FF00;
  color: #17320a;
  border-color: #80FF00;
  font-weight: 700;
  box-shadow: 0 0 0 2px rgba(128, 255, 0, 0.30);
  z-index: 2;
}





/* 最新节点的备注气泡（2026-10-21）：挂在 body、position:fixed，避免被表格 overflow 裁掉 */
.np-bubble {
  position: fixed;
  z-index: 400;
  max-width: 320px;
  padding: 8px 11px;
  border-radius: 8px;
  background: #1f2937;
  color: #fff;
  font-size: 12px;
  line-height: 1.55;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.28);
  pointer-events: none;
}

.np-bubble[hidden] { display: none; }

.np-bubble-text { white-space: pre-wrap; word-break: break-word; }
.np-bubble-when { margin-top: 4px; font-size: 11px; color: #cbd5e1; }

/* --------------------------------------------------------------------------
   备注气泡：从"最新节点"图标上冒出来（2026-10-21 使用者要求）
   --------------------------------------------------------------------------
   绝对定位挂在 .np-item 里、向上展开，尾巴朝下指着圆点。
   表格容器放开垂直裁剪（.np-table-open），否则第一行的气泡会被切掉。
   -------------------------------------------------------------------------- */
.np-table-open .table-wrap { overflow: visible; }

.np-callout {
  position: absolute;
  left: 50%;
  top: -7px;
  transform: translate(-50%, -100%);
  z-index: 60;
  /* 关键：绝对定位元素的"可用宽度"会被父格限制（这里父格只有列宽的 1/10），
     不写 width 就会缩成一条竖线。max-content 按文字自然撑开，再用 max-width 封顶。 */
  width: max-content;
  /* 气泡宽度 = 文字宽度 + 内边距。**不要设 min-width**（2026-10-22 使用者反馈：
     短备注只有 3 个字，气泡却被撑到 96px，"长度跟备注字数不匹配"）。 */
  max-width: 340px;
  padding: 5px 9px;
  border: 1px solid #fde68a;
  border-radius: 9px;
  background: #fffbeb;
  color: #92400e;
  font-size: 11px;
  line-height: 1.4;
  text-align: left;
  /* 单行：文字层做省略号；气泡本体不能 overflow:hidden，否则尾巴被裁 */
  white-space: nowrap;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.14);
}

.np-callout-text {
  display: block;
  /* 上限与气泡对齐：340 − 左右内边距 18 − 边框 2 = 320；超过就省略号，悬停看全文 */
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 朝下的小尾巴：指向最新节点的圆点 */
.np-callout::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -5px;
  width: 8px;
  height: 8px;
  margin-left: -4px;
  background: #fffbeb;
  border-right: 1px solid #fde68a;
  border-bottom: 1px solid #fde68a;
  transform: rotate(45deg);
}
/* ⚠️ 所有气泡**一律向上**（2026-10-21 修）：
   之前给第一行做了"翻到下方"，结果第一行朝下、第二行朝上，两个气泡在行间撞在一起，
   看起来像"气泡下面多了一个框"。现在统一向上。 */

/* 有备注气泡的行：顶部多留一条"停车位"给气泡（2026-10-21 使用者要求：
   "每行高度多加一些，现在气泡会挡住上一行的时间点"）。
   只加在**有气泡的行**上，没有备注的行高度不变。 */
.np-table-open tbody tr:has(.np-callout) > td {
  padding-top: 36px;
}

/* --------------------------------------------------------------------------
   运踪列表：货名可点设置余货 + 节点可点看信息（2026-10-22）
   -------------------------------------------------------------------------- */
.link-btn {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: #2563eb;
  cursor: pointer;
  text-align: left;
  border-bottom: 1px dashed #93c5fd;
  line-height: 1.3;
}

.link-btn:hover { color: #1d4ed8; border-bottom-color: #1d4ed8; }

/* 余货数量：小胶囊，明显但不抢眼；0 件（已全部卸完）用绿色 */
.remaining-chip {
  display: inline-block;
  margin-top: 2px;
  padding: 0 6px;
  border-radius: 999px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  font-size: 11px;
  line-height: 17px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.remaining-chip.is-zero { background: #ecfdf5; border-color: #a7f3d0; color: #047857; }

/* 进度条上的节点：可点（看信息 / 更正） */
.np-item { cursor: pointer; border-radius: 6px; transition: background-color .12s ease; }
.np-item:hover { background: rgba(37, 99, 235, 0.06); }

/* 节点信息弹窗里的登记记录块 */
.node-rec {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 8px;
  background: #f8fafc;
}

.node-rec-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.node-rec-ops { margin-left: auto; }
.node-rec-line { margin-top: 3px; font-size: 13px; color: #334155; }

.btn-xs {
  padding: 2px 8px;
  font-size: 12px;
  line-height: 18px;
  border-radius: 6px;
}


/* 仓库名称：挂在「货物入库」节点名字下面（2026-10-22） */
.np-wh {
  margin-top: 1px;
  max-width: 100%;
  padding: 0 3px;
  border-radius: 4px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 9px;
  line-height: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 单行省略的小字：td 上的 .cell-ellipsis 管不到 td 内部元素（2026-10-23 折行问题） */
.hint-line {
  font-size: 11px;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 「提回 / 撤回」这类"把东西拿回来"的动作：橙黄，区别于提交（蓝）与作废（红） */
.btn-amber { background: #d97706; border-color: #d97706; color: #fff; }
.btn-amber:hover:not(:disabled) { background: #b45309; border-color: #b45309; }
.btn-amber:disabled { background: #f0c08a; border-color: #f0c08a; color: #fff; }

/* --------------------------------------------------------------------------
   表格列宽拖动把手（2026-10-24）
   --------------------------------------------------------------------------
   表头右侧那条竖线：按住左右拖 = 调列宽，双击 = 恢复默认。
   平时几乎看不见（只有浅灰细线），鼠标移上去才明显，避免表格变"花"。
   -------------------------------------------------------------------------- */
.table th.has-resizer { position: relative; }

.col-resizer {
  position: absolute;
  top: 0;
  right: -4px;
  width: 9px;
  height: 100%;
  cursor: col-resize;
  z-index: 3;
  touch-action: none;
  user-select: none;
  background: transparent;
}

/* 视觉提示：一条 1px 竖线，hover / 拖动时变蓝变粗 */
/* 平时是一条很淡的竖线（让人知道这里能拖），鼠标移到表头或把手上就变蓝变粗 */
.col-resizer::after {
  content: '';
  position: absolute;
  top: 22%;
  right: 3px;
  width: 1px;
  height: 56%;
  background: rgba(148, 163, 184, .35);
  transition: background .15s ease, width .15s ease, top .15s ease, height .15s ease;
}

.table th.has-resizer:hover .col-resizer::after,
.col-resizer:hover::after,
.col-resizer:focus-visible::after {
  background: #3b7cff;
  width: 2px;
  top: 12%;
  height: 76%;
}

.col-resizer:focus-visible {
  outline: 2px solid rgba(59, 124, 255, .45);
  outline-offset: -2px;
  border-radius: 2px;
}

/* 整个页面在拖动时：光标统一变成拖列宽，且不选中文字 */
body.col-resizing { cursor: col-resize; }
body.col-resizing * { cursor: col-resize !important; user-select: none !important; }

/* 表格里长文本"单行省略 + 悬停看全称"的单元格（客户名这类长字段） */
table td.cell-clip,
table th.cell-clip {
  max-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   列表字段自选（2026-10-24）：被勾掉的列整列隐藏（th + td 一起）
   -------------------------------------------------------------------------- */
.table th.col-hidden,
.table td.col-hidden { display: none; }

/* 表格上方的工具条：目前只放「⚙ 字段」按钮，靠右 */
.table-tools {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  padding: 0 0 8px;
}
.table-tools-btn { color: #475569; }
.table-tools-btn:hover { color: var(--primary); border-color: var(--primary); }

/* --------------------------------------------------------------------------
   运踪列表：列多、节点名长，横向内边距收到 6px，把空间让给内容
   -------------------------------------------------------------------------- */
.tk-tight th,
.tk-tight td { padding-left: 6px; padding-right: 6px; }
.tk-tight th { white-space: nowrap; }

/* 校验没过时把对应输入框标红（2026-10-25：保存失败要一眼看出是哪一格没填） */
.input-error,
.input-error:focus {
  border-color: #dc2626 !important;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, .12) !important;
  background: #fffafa;
}
/* 当前节点是"已下线节点"时的说明（2026-10-26）：进度条上没有它的格子，
   用一行小字告诉使用者真实进度停在哪，别误读成已经到换装。 */
.np-legacy {
  margin-top: 2px;
  font-size: 10px;
  color: #b45309;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* 运踪联动：一行 = 节点名 + 日期 + 时间；「国内在途」再多一行车辆信息（2026-10-28） */
.bulk-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px 12px;
  padding: 6px 0;
}
.bulk-row-name { flex: 0 0 130px; font-size: 13px; color: #334155; line-height: 32px; }
.bulk-row-date { flex: 0 0 170px; }
.bulk-row-time { flex: 0 0 120px; }
.bulk-row-extra {
  flex: 1 1 100%;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px 12px;
  padding: 8px 0 2px;
  border-top: 1px dashed #e2e8f0;
  margin-top: 2px;
}
.bulk-row-extra .bulk-extra-field { display: flex; flex-direction: column; gap: 4px; }
.bulk-row-extra .field-label { font-size: 12px; color: #475569; }
@media (max-width: 1100px) {
  .bulk-row-extra { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* 审核弹窗：一行 = 一个收付款对象（客户 / 承运商 / 派车人）——2026-10-29 使用者要求
   每行最后是它自己的币种，避免金额和对象对不上号。 */
.approve-row {
  display: grid;
  gap: 10px 16px;
  margin-bottom: 12px;
  align-items: start;
}
.approve-row-3 { grid-template-columns: 5fr 4fr 3fr; }      /* 对象 / 金额 / 币种 */
.approve-row-4 { grid-template-columns: 4fr 3fr 2fr 3fr; }  /* 对象 / 总运费 / 预付款 / 币种 */
.approve-row .field { margin-bottom: 0; }
@media (max-width: 1000px) {
  .approve-row-3, .approve-row-4 { grid-template-columns: 1fr 1fr; }
}