/* =============================================================================
   发货拼车工作台 - 全站样式
   设计方向：深色导航 + 浅色工作区 / 青绿品牌色 / 卡片化层级阴影 / 微交互动效
   约束：零 CDN 依赖，完全离线可用（字体走系统字体栈）
   ============================================================================= */

/* -----------------------------------------------------------------------------
   1. 设计令牌
   ----------------------------------------------------------------------------- */
:root {
  /* 品牌青绿 */
  --brand-50:  #E6F7F1;
  --brand-100: #C6EDDF;
  --brand-200: #90DBBF;
  --brand-400: #29B583;
  --brand:     #0E9F6E;
  --brand-600: #0B8A5F;
  --brand-700: #096B4A;
  --brand-900: #06422E;

  /* 导航深色 */
  --nav-900: #0B1F19;
  --nav-800: #0F2A22;
  --nav-700: #143A2E;
  --nav-600: #1C4C3C;

  /* 中性 */
  --bg:        #F5F7FA;
  --surface:   #FFFFFF;
  --surface-2: #FAFBFC;
  --line:      #E7EBF0;
  --line-soft: #F0F3F7;

  /* 文字 */
  --text:      #1F2937;
  --text-2:    #6B7280;
  --text-3:    #9CA3AF;
  --text-inv:  #FFFFFF;

  /* 功能色 */
  --ok:      #16A34A;
  --warn:    #F59E0B;
  --danger:  #DC2626;
  --info:    #2563EB;
  --gold:    #D4A017;

  /* 尺寸 */
  --topbar-h:  56px;
  --sidebar-w: 224px;
  --sidebar-w-collapsed: 64px;
  --radius:    12px;
  --radius-sm: 8px;
  --radius-lg: 16px;

  /* 阴影 */
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, .06);
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-md: 0 4px 12px rgba(16, 24, 40, .08), 0 2px 4px rgba(16, 24, 40, .04);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .12), 0 4px 8px rgba(16, 24, 40, .05);
  --shadow-brand: 0 6px 18px rgba(14, 159, 110, .25);

  /* 动效 */
  --ease: cubic-bezier(.4, 0, .2, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --dur: 180ms;

  /* 字体 */
  --font: "Noto Sans", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB",
          "Source Han Sans SC", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --font-num: "SF Mono", "JetBrains Mono", "Cascadia Mono", Consolas, "Courier New", monospace;
}

/* -----------------------------------------------------------------------------
   2. 基础重置
   ----------------------------------------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 { margin: 0; font-weight: 600; line-height: 1.3; }
p { margin: 0; }
a { color: var(--brand-600); text-decoration: none; }
a:hover { color: var(--brand); }

button, input, select, textarea { font-family: inherit; font-size: inherit; }

/* 内联 SVG 图标：JS 注入的 <svg> 不带 width/height 属性，
   这里给一个安全默认尺寸，各组件再按需覆盖（如 .btn svg / .empty__icon svg） */
svg { width: 1em; height: 1em; display: block; flex: 0 0 auto; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: #CBD5E1;
  border-radius: 6px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: #94A3B8; background-clip: padding-box; }

/* -----------------------------------------------------------------------------
   3. 顶部栏
   ----------------------------------------------------------------------------- */
.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--topbar-h);
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: var(--nav-900);
  color: var(--text-inv);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .06), 0 4px 16px rgba(11, 31, 25, .28);
}

.topbar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.topbar__logo {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--brand-400), var(--brand-700));
  box-shadow: 0 4px 12px rgba(14, 159, 110, .45), inset 0 1px 0 rgba(255, 255, 255, .3);
}
.topbar__logo svg { width: 17px; height: 17px; display: block; }

.topbar__title {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: .2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar__env {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .6px;
  padding: 2px 7px;
  border-radius: 999px;
  color: var(--brand-200);
  background: rgba(14, 159, 110, .16);
  border: 1px solid rgba(14, 159, 110, .32);
}

.topbar__right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.topbar__user {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: rgba(255, 255, 255, .82);
}

.topbar__avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--nav-900);
  background: linear-gradient(135deg, #93E5C5, var(--brand-400));
}

.topbar__divider {
  width: 1px;
  height: 20px;
  background: rgba(255, 255, 255, .14);
}

.topbar__link {
  font-size: 13px;
  color: rgba(255, 255, 255, .7);
  background: none;
  border: 0;
  cursor: pointer;
  padding: 5px 9px;
  border-radius: 6px;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.topbar__link:hover { background: rgba(255, 255, 255, .1); color: #fff; }

.topbar__toggle {
  display: none;
  background: none;
  border: 0;
  color: rgba(255, 255, 255, .8);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
}
.topbar__toggle:hover { background: rgba(255, 255, 255, .1); }

/* -----------------------------------------------------------------------------
   4. 布局骨架
   ----------------------------------------------------------------------------- */
.layout {
  display: flex;
  min-height: 100%;
  padding-top: var(--topbar-h);
}

.sidebar {
  position: fixed;
  top: var(--topbar-h);
  bottom: 0;
  left: 0;
  width: var(--sidebar-w);
  z-index: 50;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 14px 10px 28px;
  background:
    radial-gradient(1200px 340px at -10% -6%, rgba(14, 159, 110, .22), transparent 62%),
    linear-gradient(180deg, var(--nav-800) 0%, var(--nav-900) 100%);
  border-right: 1px solid rgba(255, 255, 255, .05);
  transition: width var(--dur) var(--ease), transform var(--dur) var(--ease);
}

.sidebar__group {
  margin: 16px 0 6px;
  padding: 0 12px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .32);
}
.sidebar__group:first-child { margin-top: 4px; }

.sidebar__link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  margin-bottom: 2px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  color: rgba(255, 255, 255, .74);
  white-space: nowrap;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease),
              transform var(--dur) var(--ease);
}
.sidebar__link:hover {
  background: rgba(255, 255, 255, .07);
  color: #fff;
  transform: translateX(2px);
}
.sidebar__link.is-active {
  color: #fff;
  font-weight: 500;
  background: linear-gradient(90deg, rgba(14, 159, 110, .3), rgba(14, 159, 110, .08));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06);
}
.sidebar__link.is-active::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, var(--brand-400), var(--brand));
  box-shadow: 0 0 12px rgba(14, 159, 110, .8);
}

.sidebar__icon {
  flex: 0 0 auto;
  width: 17px;
  height: 17px;
  opacity: .85;
}
.sidebar__link.is-active .sidebar__icon { opacity: 1; }

.sidebar__text { overflow: hidden; text-overflow: ellipsis; }

.sidebar__badge {
  margin-left: auto;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(14, 159, 110, .25);
  color: #A7F3D0;
}

.content {
  flex: 1 1 auto;
  min-width: 0;
  margin-left: var(--sidebar-w);
  padding: 22px 24px 48px;
  transition: margin-left var(--dur) var(--ease);
}

.content__inner {
  max-width: 1680px;
  margin: 0 auto;
}

/* -----------------------------------------------------------------------------
   5. 页头
   ----------------------------------------------------------------------------- */
.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.page-head__title {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -.2px;
}

.page-head__desc {
  margin-top: 4px;
  font-size: 13px;
  color: var(--text-2);
}

.page-head__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* 面包屑 */
.crumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-3);
  margin-bottom: 6px;
}
.crumb span + span::before { content: "/"; margin-right: 6px; color: var(--line); }

/* -----------------------------------------------------------------------------
   6. 卡片
   ----------------------------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease);
}

.card--hover:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-soft);
  flex-wrap: wrap;
}

.card__title {
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card__subtitle { font-size: 12px; color: var(--text-3); font-weight: 400; }

.card__body { padding: 18px; }
.card__body--flush { padding: 0; }
.card__foot {
  padding: 12px 18px;
  border-top: 1px solid var(--line-soft);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

/* 统计卡片 */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.stat {
  position: relative;
  overflow: hidden;
  padding: 18px 18px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.stat::before {
  content: "";
  position: absolute;
  left: 0;
  top: 14px;
  bottom: 14px;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background: var(--stat-color, var(--brand));
}
.stat::after {
  content: "";
  position: absolute;
  right: -34px;
  top: -34px;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: var(--stat-color, var(--brand));
  opacity: .06;
}
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.stat--brand  { --stat-color: var(--brand); }
.stat--blue   { --stat-color: var(--info); }
.stat--amber  { --stat-color: var(--warn); }
.stat--violet { --stat-color: #7C3AED; }

.stat__label {
  font-size: 12.5px;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 6px;
}
.stat__value {
  margin-top: 6px;
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -1px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.stat__unit { font-size: 13px; font-weight: 400; color: var(--text-3); margin-left: 3px; }
.stat__foot { margin-top: 6px; font-size: 12px; color: var(--text-3); }

/* -----------------------------------------------------------------------------
   7. 按钮
   ----------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease),
              color var(--dur) var(--ease), box-shadow var(--dur) var(--ease),
              transform var(--dur) var(--ease);
}
.btn svg { width: 15px; height: 15px; flex: 0 0 auto; }
.btn:hover { border-color: #D3DAE3; background: var(--surface-2); box-shadow: var(--shadow-xs); }
.btn:active { transform: translateY(1px); }
.btn:disabled,
.btn.is-disabled {
  opacity: .55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn--primary {
  border-color: transparent;
  color: #fff;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-700) 100%);
  box-shadow: var(--shadow-brand);
}
.btn--primary:hover {
  background: linear-gradient(135deg, var(--brand-400) 0%, var(--brand-600) 100%);
  box-shadow: 0 8px 22px rgba(14, 159, 110, .34);
}

.btn--ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-2);
}
.btn--ghost:hover { background: var(--line-soft); color: var(--text); }

.btn--danger { color: var(--danger); border-color: #F5C9C9; background: #FEF5F5; }
.btn--danger:hover { background: #FDEBEB; border-color: #EFBABA; }

.btn--sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn--lg { height: 44px; padding: 0 22px; font-size: 15px; border-radius: 10px; }
.btn--block { width: 100%; }

/* 加载态：内嵌旋转点 */
.btn.is-loading {
  pointer-events: none;
  position: relative;
  color: transparent !important;
}
.btn.is-loading::after {
  content: "";
  position: absolute;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .38);
  border-top-color: #fff;
  animation: fw-spin .7s linear infinite;
}
.btn--ghost.is-loading::after,
.btn:not(.btn--primary):not(.btn--danger).is-loading::after {
  border-color: rgba(31, 41, 55, .25);
  border-top-color: var(--brand);
}

@keyframes fw-spin { to { transform: rotate(360deg); } }

/* 涟漪 */
.btn--ripple { position: relative; overflow: hidden; }
.ripple {
  position: absolute;
  border-radius: 50%;
  transform: scale(0);
  background: rgba(255, 255, 255, .45);
  animation: fw-ripple .6s var(--ease-out) forwards;
  pointer-events: none;
}
@keyframes fw-ripple { to { transform: scale(2.6); opacity: 0; } }

/* -----------------------------------------------------------------------------
   8. 表单
   ----------------------------------------------------------------------------- */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
}
.form-grid--1 { grid-template-columns: minmax(0, 1fr); }
.form-grid .span-2 { grid-column: 1 / -1; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }

.field__label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 4px;
}
.field__label .req { color: var(--danger); }
.field__hint { font-size: 11.5px; color: var(--text-3); }
.field__error { font-size: 11.5px; color: var(--danger); }

.input,
.select,
.textarea {
  width: 100%;
  height: 36px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.textarea { height: auto; min-height: 76px; padding: 8px 11px; resize: vertical; line-height: 1.5; }

.input:hover, .select:hover, .textarea:hover { border-color: #D3DAE3; }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(14, 159, 110, .16);
}
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:disabled, .select:disabled { background: var(--surface-2); color: var(--text-3); cursor: not-allowed; }

.select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 30px;
  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='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  background-size: 15px;
  cursor: pointer;
}

.input-group { display: flex; align-items: center; gap: 6px; }
.input-group .input { flex: 1 1 auto; }

/* 筛选条 */
.filterbar {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(180deg, #FCFDFE, var(--surface));
}
.filterbar .field { min-width: 158px; }
.filterbar .field--grow { flex: 1 1 200px; }
.filterbar__actions { display: flex; gap: 8px; margin-left: auto; }

/* 工具栏 */
.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-soft);
}
.toolbar__spacer { margin-left: auto; }

/* 文件导入按钮包装 */
.file-input { display: none; }

/* -----------------------------------------------------------------------------
   9. 表格
   ----------------------------------------------------------------------------- */
.table-wrap { width: 100%; overflow-x: auto; }

.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13.5px;
}

.table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 12.5px;
  color: var(--text-2);
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.table tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
  color: var(--text);
}
.table tbody tr { transition: background var(--dur) var(--ease); }
.table tbody tr:nth-child(even) { background: var(--surface-2); }
.table tbody tr:hover { background: var(--brand-50); }
.table tbody tr.is-selected { background: #EAF8F3; }

.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .nowrap { white-space: nowrap; }
.table .mono { font-family: var(--font-num); font-size: 12.5px; }

/* 紧凑型表格（用于车次装载清单等二级表） */
.table--compact thead th { padding: 8px 12px; }
.table--compact tbody td { padding: 8px 12px; }
.table tfoot td { padding: 8px 12px; }

.cell-ellipsis {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
}

/* 操作列：必须是 table-cell，否则行内 flex 会让该列脱离表格单元格对齐（与同行错位） */
.table__actions {
  display: table-cell;
  white-space: nowrap;
  vertical-align: middle;
  text-align: left;
}
.table__actions > .link-btn { margin-right: 4px; }
.table__actions > .link-btn:last-child { margin-right: 0; }

.link-btn {
  display: inline-block;
  vertical-align: middle;
  background: none;
  border: 0;
  padding: 3px 6px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  line-height: 1.4;
  color: var(--brand-600);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.link-btn:hover { background: var(--brand-50); color: var(--brand-700); }
.link-btn--danger { color: var(--danger); }
.link-btn--danger:hover { background: #FEF2F2; color: #B91C1C; }
/* 禁用态（如已发货订单的删除） */
.link-btn:disabled,
.link-btn[disabled] {
  color: var(--text-3);
  background: none;
  cursor: not-allowed;
  opacity: .75;
}
.link-btn:disabled:hover,
.link-btn[disabled]:hover { background: none; color: var(--text-3); }

/* 复选 */
.checkbox {
  width: 15px;
  height: 15px;
  accent-color: var(--brand);
  cursor: pointer;
  vertical-align: middle;
}

/* 表格底部 / 分页 */
.table-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 18px;
  border-top: 1px solid var(--line-soft);
  font-size: 13px;
  color: var(--text-2);
}

.pagination { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.pagination button {
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  font-size: 13px;
  transition: all var(--dur) var(--ease);
}
.pagination button:hover:not(:disabled) { border-color: var(--brand-200); color: var(--brand-700); background: var(--brand-50); }
.pagination button.is-active {
  background: linear-gradient(135deg, var(--brand), var(--brand-600));
  border-color: transparent;
  color: #fff;
  box-shadow: var(--shadow-brand);
}
.pagination button:disabled { opacity: .45; cursor: not-allowed; }
.pagination .ellipsis { padding: 0 4px; color: var(--text-3); }

/* 空状态 */
.empty {
  padding: 52px 20px;
  text-align: center;
  color: var(--text-3);
}
.empty__icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 12px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  border: 1px dashed var(--line);
  color: #C4CDD9;
}
.empty__icon svg { width: 26px; height: 26px; }
.empty__title { font-size: 14px; color: var(--text-2); font-weight: 500; }
.empty__desc { font-size: 12.5px; margin-top: 4px; }

/* 骨架屏 */
.skeleton {
  border-radius: 6px;
  background: linear-gradient(90deg, #EEF1F5 25%, #F7F9FB 50%, #EEF1F5 75%);
  background-size: 200% 100%;
  animation: fw-shimmer 1.3s infinite linear;
}
@keyframes fw-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* -----------------------------------------------------------------------------
   10. 徽章 / 标签 / 进度
   ----------------------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.7;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge--brand  { background: var(--brand-50); color: var(--brand-700); border-color: var(--brand-100); }
.badge--ok     { background: #ECFDF3; color: #15803D; border-color: #BBF7D0; }
.badge--warn   { background: #FFFBEB; color: #B45309; border-color: #FDE68A; }
.badge--danger { background: #FEF2F2; color: #B91C1C; border-color: #FECACA; }
.badge--info   { background: #EFF6FF; color: #1D4ED8; border-color: #BFDBFE; }
.badge--muted  { background: #F3F4F6; color: var(--text-2); border-color: var(--line); }
.badge--gold {
  background: linear-gradient(135deg, #FFFBEB, #FEF3C7);
  color: #92400E;
  border-color: #FDE68A;
  box-shadow: 0 1px 4px rgba(212, 160, 23, .28);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 13px;
  color: var(--text-2);
  box-shadow: var(--shadow-xs);
}
.chip strong { color: var(--text); font-size: 15px; font-variant-numeric: tabular-nums; }
.chip__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--brand); }

.progress {
  position: relative;
  height: 6px;
  border-radius: 999px;
  background: var(--line-soft);
  overflow: hidden;
}
.progress__bar {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand-400), var(--brand));
  transition: width 420ms var(--ease-out);
}
.progress__bar--warn { background: linear-gradient(90deg, #FBBF24, var(--warn)); }
.progress__bar--danger { background: linear-gradient(90deg, #F87171, var(--danger)); }
.progress__bar--ok { background: linear-gradient(90deg, #34D399, var(--ok)); }

.progress-line { display: flex; align-items: center; gap: 8px; }
.progress-line .progress { flex: 1 1 auto; min-width: 46px; }
.progress-line .progress__label {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--text-2);
  min-width: 40px;
  text-align: right;
}

/* 金额 */
.money { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text); }
.money--big { font-size: 26px; letter-spacing: -.6px; }
.money--brand { color: var(--brand-700); }

/* -----------------------------------------------------------------------------
   11. 提示条
   ----------------------------------------------------------------------------- */
.alert {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid;
  font-size: 13px;
  line-height: 1.6;
  margin-bottom: 14px;
}
.alert__icon { flex: 0 0 auto; width: 17px; height: 17px; margin-top: 1px; }
.alert__body { flex: 1 1 auto; min-width: 0; }
.alert__title { font-weight: 600; margin-bottom: 3px; }
.alert ul { margin: 4px 0 0; padding-left: 18px; }
.alert li { margin-bottom: 2px; }
.alert--warn { background: #FFFBEB; border-color: #FDE68A; color: #92400E; }
.alert--danger { background: #FEF2F2; border-color: #FECACA; color: #991B1B; }
.alert--info { background: #EFF6FF; border-color: #BFDBFE; color: #1E40AF; }
.alert--ok { background: #ECFDF3; border-color: #BBF7D0; color: #166534; }

/* -----------------------------------------------------------------------------
   12. 弹窗
   ----------------------------------------------------------------------------- */
.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, .45);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: fw-fade-in 200ms var(--ease-out);
}

.modal {
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - 60px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: fw-modal-in 220ms var(--ease-out);
  overflow: hidden;
}
.modal--lg { max-width: 880px; }
.modal--xl { max-width: 1180px; }

.modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line-soft);
}
.modal__title { font-size: 16px; font-weight: 600; }
.modal__close {
  background: none;
  border: 0;
  cursor: pointer;
  color: var(--text-3);
  padding: 4px;
  border-radius: 6px;
  line-height: 0;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.modal__close:hover { background: var(--line-soft); color: var(--text); }
.modal__close svg { width: 17px; height: 17px; }

.modal__body { padding: 20px; overflow-y: auto; }
.modal__foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--line-soft);
  background: var(--surface-2);
}

@keyframes fw-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes fw-modal-in {
  from { opacity: 0; transform: scale(.96) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* -----------------------------------------------------------------------------
   13. Toast
   ----------------------------------------------------------------------------- */
.toast-host {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  position: relative;
  min-width: 250px;
  max-width: 380px;
  padding: 12px 14px 12px 18px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--line);
  font-size: 13px;
  line-height: 1.55;
  color: var(--text);
  overflow: hidden;
  pointer-events: auto;
  animation: fw-toast-in 260ms var(--ease-out);
}
.toast::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--brand);
}
.toast--ok::before { background: var(--ok); }
.toast--error::before { background: var(--danger); }
.toast--warn::before { background: var(--warn); }
.toast--info::before { background: var(--info); }

.toast__row { display: flex; gap: 9px; align-items: flex-start; }
.toast__icon { flex: 0 0 auto; width: 17px; height: 17px; margin-top: 1px; }
.toast--ok .toast__icon { color: var(--ok); }
.toast--error .toast__icon { color: var(--danger); }
.toast--warn .toast__icon { color: var(--warn); }
.toast--info .toast__icon { color: var(--info); }
.toast__msg { flex: 1 1 auto; word-break: break-word; }

.toast.is-leaving { animation: fw-toast-out 200ms var(--ease) forwards; }
@keyframes fw-toast-in { from { opacity: 0; transform: translateX(24px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes fw-toast-out { to { opacity: 0; transform: translateX(24px) scale(.97); } }

/* -----------------------------------------------------------------------------
   14. 方案卡片（核心页）
   ----------------------------------------------------------------------------- */
.plan-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.plan-card {
  position: relative;
  overflow: hidden;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  cursor: pointer;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease),
              border-color var(--dur) var(--ease);
  animation: fw-card-in 380ms var(--ease-out) backwards;
}
.plan-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.plan-card.is-active {
  border-color: var(--brand-200);
  box-shadow: 0 0 0 3px rgba(14, 159, 110, .12), var(--shadow-md);
}
.plan-card--best {
  border-color: #F2D184;
  background: linear-gradient(180deg, #FFFDF6 0%, var(--surface) 46%);
}
.plan-card--best.is-active {
  box-shadow: 0 0 0 3px rgba(212, 160, 23, .16), var(--shadow-md);
}

.plan-card__badge {
  position: absolute;
  top: 0;
  right: 0;
  padding: 4px 12px 5px;
  font-size: 11.5px;
  font-weight: 600;
  color: #7C2D12;
  background: linear-gradient(135deg, #FDE68A, var(--gold));
  border-bottom-left-radius: 10px;
  box-shadow: 0 2px 8px rgba(212, 160, 23, .3);
}

.plan-card__head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 12px;
}
.plan-card__name { font-size: 15px; font-weight: 600; }
.plan-card__strategy { font-size: 11.5px; color: var(--text-3); }

.plan-card__price {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin-bottom: 14px;
}
.plan-card__price .cur { font-size: 15px; color: var(--text-2); }
.plan-card__price .val {
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -1.2px;
  color: var(--brand-700);
  font-variant-numeric: tabular-nums;
}

.plan-card__metrics { display: grid; gap: 9px; margin-bottom: 14px; }
.plan-card__metrics .metric-row { align-items: center; }
.plan-card__metrics .progress-line { flex: 1 1 auto; min-width: 84px; }
.plan-card__metrics .progress { min-width: 56px; }
.metric-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12.5px;
  color: var(--text-2);
}
.metric-row__val { color: var(--text); font-weight: 500; font-variant-numeric: tabular-nums; }

@keyframes fw-card-in {
  from { opacity: 0; transform: translateY(14px) scale(.985); }
  to   { opacity: 1; transform: none; }
}

/* 车次明细 */
.trip-row { cursor: pointer; }
.trip-row__caret {
  display: inline-block;
  width: 14px;
  color: var(--text-3);
  transition: transform var(--dur) var(--ease);
}
.trip-row.is-open .trip-row__caret { transform: rotate(90deg); color: var(--brand); }

.trip-detail > td {
  padding: 0 !important;
  background: #F8FAFC !important;
  border-bottom: 1px solid var(--line) !important;
}
.trip-detail__inner { padding: 12px 18px 16px; }
.trip-detail__title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 7px;
}
.trip-detail .table { background: var(--surface); border-radius: var(--radius-sm); overflow: hidden; }
.trip-detail .table thead th { background: #F1F5F9; }
/* 装载清单表头兜底：该表插入在 <tbody> 片段中，thead 会被解析器提升，需按 th 直接上色 */
.trip-detail .table th {
  padding: 8px 12px;
  text-align: left;
  font-weight: 600;
  font-size: 12.5px;
  color: var(--text-2);
  background: #F1F5F9;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.trip-detail .table tr:hover th { background: #F1F5F9; }

/* 本车货物构成标签（主表「装载货物」列 + 明细表头） */
.vtag-list { display: flex; flex-wrap: wrap; gap: 4px; }
.vtag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1.75;
  white-space: nowrap;
  background: var(--brand-50);
  color: var(--brand-700);
  border: 1px solid var(--brand-100);
}
.vtag__name { font-weight: 600; }
.vtag__num {
  font-variant-numeric: tabular-nums;
  opacity: .9;
}
.vtag--name {
  background: #F3F4F6;
  color: var(--text-1);
  border-color: var(--line);
}

.trip-goods { max-width: 300px; }

/* 车次装载清单：货物构成摘要行 */
.trip-detail__goods {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: -2px 0 10px;
  font-size: 12.5px;
  color: var(--text-2);
}
.trip-detail__goods-label { font-weight: 600; color: var(--text-3); }
.trip-detail__goods .vtag { background: var(--surface); }

/* 装载清单表尾合计 */
.trip-detail .table tfoot td {
  background: #F8FAFC;
  border-top: 1px solid var(--line);
  font-weight: 600;
  color: var(--text-1);
}
.tfoot__label { text-align: right; }
.tfoot__note { font-weight: 400; font-size: 12.5px; color: var(--text-3); }

/* 卸点顺序链 */
.stop-chain { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: 12.5px; }
.stop-chain__node {
  padding: 1px 7px;
  border-radius: 6px;
  background: var(--brand-50);
  color: var(--brand-700);
  border: 1px solid var(--brand-100);
}
.stop-chain__arrow { color: var(--text-3); font-size: 11px; }

/* -----------------------------------------------------------------------------
   15. 杂项
   ----------------------------------------------------------------------------- */
/* 图标容器：让 1em 的默认 svg 填满既定尺寸 */
.sidebar__icon svg,
.alert__icon svg,
.toast__icon svg { width: 100%; height: 100%; }
.trip-row__caret svg { width: 12px; height: 12px; margin: 0 auto; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 8px !important; }
.mb-2 { margin-bottom: 14px !important; }
.mb-3 { margin-bottom: 20px !important; }
.mt-1 { margin-top: 6px !important; }
.mt-2 { margin-top: 14px !important; }
.text-muted { color: var(--text-2); }
.text-dim { color: var(--text-3); }
.text-sm { font-size: 12.5px; }
.text-right { text-align: right; }
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 14px; }
.hidden { display: none !important; }
.mono { font-family: var(--font-num); }
.tnum { font-variant-numeric: tabular-nums; }
.divider { height: 1px; background: var(--line-soft); margin: 16px 0; }

.kv { display: flex; gap: 8px; font-size: 13px; }
.kv dt { color: var(--text-2); min-width: 84px; }
.kv dd { margin: 0; color: var(--text); }

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  margin: 22px 0 12px;
}
.section-title::before {
  content: "";
  width: 3px;
  height: 15px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--brand-400), var(--brand));
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.quick {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease),
              border-color var(--dur) var(--ease);
}
.quick:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--brand-200);
}
.quick__icon {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--brand-50);
  color: var(--brand-600);
}
.quick__icon svg { width: 17px; height: 17px; }
.quick__title { font-size: 13.5px; font-weight: 500; }
.quick__desc { font-size: 11.5px; color: var(--text-3); }

/* 加载遮罩（局部） */
.loading-block {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 40px;
  color: var(--text-3);
  font-size: 13px;
}
.spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(14, 159, 110, .22);
  border-top-color: var(--brand);
  animation: fw-spin .7s linear infinite;
}
/* 深色/主色按钮内的白色旋转点 */
.spinner--light {
  width: 15px;
  height: 15px;
  border-color: rgba(255, 255, 255, .4);
  border-top-color: #fff;
}

/* -----------------------------------------------------------------------------
   16. 响应式
   ----------------------------------------------------------------------------- */
@media (max-width: 1440px) {
  .content { padding: 20px 20px 44px; }
}

@media (max-width: 1200px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .plan-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quick-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1024px) {
  .sidebar {
    width: var(--sidebar-w-collapsed);
    padding-left: 6px;
    padding-right: 6px;
  }
  .sidebar:hover { width: var(--sidebar-w); }
  .sidebar__text,
  .sidebar__group,
  .sidebar__badge { opacity: 0; transition: opacity 120ms var(--ease); }
  .sidebar:hover .sidebar__text,
  .sidebar:hover .sidebar__badge { opacity: 1; }
  .sidebar:hover .sidebar__group { opacity: 1; margin: 16px 0 6px; }
  .sidebar__link { justify-content: center; }
  .sidebar:hover .sidebar__link { justify-content: flex-start; }
  .content { margin-left: var(--sidebar-w-collapsed); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  .topbar { padding: 0 14px; }
  .content { padding: 16px 14px 40px; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .plan-grid { grid-template-columns: minmax(0, 1fr); }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .quick-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .page-head__title { font-size: 20px; }
  .filterbar__actions { margin-left: 0; width: 100%; }
  .filterbar .field { flex: 1 1 140px; min-width: 0; }
  .modal { max-width: 100%; }
  .toast-host { right: 12px; left: 12px; bottom: 12px; }
  .toast { max-width: none; }
}

@media (max-width: 560px) {
  .stat-grid { grid-template-columns: minmax(0, 1fr); }
  .quick-grid { grid-template-columns: minmax(0, 1fr); }
  .topbar__env { display: none; }
}

/* -----------------------------------------------------------------------------
   17. 页签 + 距离矩阵表格
   ----------------------------------------------------------------------------- */
.tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  margin-bottom: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  width: fit-content;
  max-width: 100%;
  overflow-x: auto;
}
.tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.tab:hover { color: var(--text); background: rgba(16, 24, 40, .04); }
.tab.is-active {
  background: var(--surface);
  color: var(--brand-700);
  font-weight: 600;
  box-shadow: var(--shadow-xs);
}
.tab__count {
  padding: 0 6px;
  border-radius: 999px;
  background: var(--line-soft);
  color: var(--text-3);
  font-size: 11px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.tab.is-active .tab__count { background: var(--brand-50); color: var(--brand-600); }

/* 矩阵表：首列冻结，数值等宽 */
.table--matrix { border-collapse: separate; border-spacing: 0; }
.table--matrix th,
.table--matrix td {
  padding: 7px 10px;
  font-size: 12.5px;
  white-space: nowrap;
  border-bottom: 1px solid var(--line-soft);
}
.table--matrix thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface-2);
  color: var(--text-2);
  font-weight: 600;
  font-size: 12px;
  border-bottom: 1px solid var(--line);
}
.table--matrix tbody th {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--surface);
  text-align: left;
  font-weight: 500;
  color: var(--text);
  border-right: 1px solid var(--line-soft);
}
.table--matrix thead th:first-child {
  left: 0;
  z-index: 3;
  text-align: left;
}
.table--matrix td.num { text-align: right; font-variant-numeric: tabular-nums; }
.table--matrix tbody tr:hover td { background: var(--surface-2); }
.table--matrix tbody tr:hover th { background: var(--surface-2); }
.table--matrix .is-self { color: var(--text-3); }
.table--matrix .is-best { color: var(--brand-700); font-weight: 600; }
.table--matrix .is-best::before {
  content: '';
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-right: 5px;
  border-radius: 50%;
  background: var(--brand);
  vertical-align: 2px;
}
.table--matrix .cell-manual { text-decoration: underline dotted; }
.matrix__town {
  display: block;
  font-size: 11px;
  color: var(--text-3);
  font-weight: 400;
}

/* 可折叠卡片（details） */
details.card > summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
}
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::marker { content: ''; }
details.card .details__toggle-close { display: none; }
details.card[open] .details__toggle-close { display: inline-flex; }
details.card[open] .details__toggle-open { display: none; }
details.card[open] > summary { border-bottom: 1px solid var(--line-soft); }

/* 打印（导出方案时更清晰） */
@media print {
  .topbar, .sidebar, .page-head__actions, .toolbar, .filterbar { display: none !important; }
  .content { margin-left: 0; padding: 0; }
  .card { box-shadow: none; border-color: #ddd; }
}
