:root {
  --side-bg: #1e2b3c;
  --side-hover: #26374d;
  --side-active: #2b6df0;
  --primary: #2b6df0;
  --primary-dark: #1f58c8;
  --primary-bg: #e9f0fe;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --card: #ffffff; /* .tq-clock / .tq-presets button / .tq-range 引用（此前漏定义导致背景回退透明） */
  --line: #e3e8ef;
  --text: #1f2733;
  --muted: #7b8798;
  --green: #17a05e;
  --green-bg: #e6f6ee;
  --red: #e0473c;
  --red-bg: #fdeceb;
  --amber: #d97706;
  --amber-bg: #fdf2e2;
  --gray-bg: #eef1f5;
  --shadow: 0 1px 3px rgba(31, 39, 51, .06), 0 4px 14px rgba(31, 39, 51, .05);
  --radius: 8px;
  --font: "PingFang SC", "Helvetica Neue", "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
/* 禁止页面级横向滚动：顶部筛选/统计区永远固定，宽表格只在 .table-wrap 内部左右滚动 */
html, body { overflow-x: hidden; max-width: 100%; }
body {
  font-family: var(--font); background: var(--bg); color: var(--text);
  font-size: 13px; display: flex;
}

/* ================= 左侧导航 ================= */
.sidebar {
  width: 210px; flex-shrink: 0; background: var(--side-bg); color: #cfd8e3;
  display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; left: 0; z-index: 50;
}
.side-logo {
  display: flex; align-items: center; gap: 10px; padding: 18px 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.side-logo .logo {
  width: 36px; height: 36px; border-radius: 8px; flex-shrink: 0;
  background: linear-gradient(135deg, #2b6df0, #7a5cff);
  color: #fff; font-weight: 700; font-size: 14px; letter-spacing: -.5px;
  display: flex; align-items: center; justify-content: center;
}
.side-title { color: #fff; font-size: 15px; font-weight: 600; }
.side-sub { font-size: 11px; color: #8fa0b3; margin-top: 1px; }

.side-nav { flex: 1; padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; }
.side-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: 7px; cursor: pointer; color: #b9c6d4; font-size: 13.5px;
  transition: all .15s; user-select: none;
}
.side-item:hover { background: var(--side-hover); color: #fff; }
.side-item.active { background: var(--side-active); color: #fff; font-weight: 500; box-shadow: 0 2px 8px rgba(43,109,240,.35); }
.side-ico { font-size: 15px; width: 20px; text-align: center; }

.side-foot {
  padding: 12px 16px; border-top: 1px solid rgba(255,255,255,.08);
  font-size: 11.5px; color: #8fa0b3; display: flex; flex-direction: column; align-items: stretch; gap: 6px;
}
.side-foot .dot { width: 7px; height: 7px; border-radius: 50%; background: #35c47c; display: inline-block; }
.side-foot .side-user {
  font-size: 12px; color: #c7d4e2; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.side-foot .side-logout {
  border-color: rgba(255,255,255,.18); color: #c7d4e2;
}
.side-foot .side-logout:hover { border-color: var(--danger, #e35d6a); color: var(--danger, #e35d6a); background: rgba(227,93,106,.08); }
.side-foot .side-status { display: flex; align-items: center; gap: 7px; }

/* ================= 右侧主区 ================= */
/* min-width:0 是关键——flex 子项默认 min-width:auto 不会收缩，宽表格会把主区撑出视口，
   导致页面级横向滚动、顶部筛选统计区跟着滑走；设为 0 后主区锁在视口宽，表格只在 table-wrap 内滚 */
.main-wrap {
  flex: 1; margin-left: 210px; min-height: 100vh; display: flex; flex-direction: column;
  min-width: 0; max-width: 100%;
}
.view { display: none; flex-direction: column; flex: 1; min-width: 0; }
.view.active { display: flex; }

.page-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px 14px; flex-wrap: wrap; gap: 10px;
}
/* 标题块：内部 h2 + p 横排（参考领星：小字副标题在大字右边） */
.page-head > div:first-child {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 12px;
}
.page-title { font-size: 22px; font-weight: 700; color: var(--text); letter-spacing: .5px; }
.page-desc { font-size: 12px; color: var(--muted); font-weight: 400; }
.head-actions { display: flex; gap: 8px; }

/* ================= 按钮 ================= */
.btn {
  border: 1px solid var(--line); background: var(--panel); color: var(--text);
  padding: 7px 13px; border-radius: 6px; cursor: pointer; font-size: 12.5px;
  font-family: var(--font); transition: all .15s;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); color: #fff; }
.btn.ghost { background: transparent; }
.btn.icon { padding: 7px 10px; }
.btn.sm { padding: 3px 9px; font-size: 12px; border-radius: 5px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ================= 统计卡 ================= */
.stats {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px;
  padding: 0 24px 14px;
}
.stat-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 13px 16px; box-shadow: var(--shadow);
}
.stat-card .num { font-size: 24px; font-weight: 700; line-height: 1.2; }
.stat-card .label { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.stat-card.total .num { color: var(--text); }
.stat-card.transit .num { color: var(--primary); }
.stat-card.delivered .num { color: var(--green); }
.stat-card.exception .num { color: var(--red); }
.stat-card.pending .num { color: var(--muted); }

/* ================= 卡片与筛选 ================= */
/* ============ 智能筛选栏（物流追踪 / FBA发货 顶部两行式） ============ */
.sf-panel {
  padding: 12px 14px 10px; border-bottom: 1px solid var(--line);
  background: #f6f8fb; display: flex; flex-direction: column; gap: 8px;
}
.sf-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sf-row .sf-q {
  flex: 1 1 260px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 6px;
  outline: none; font-size: 12.5px; font-family: var(--font); background: #fff; color: var(--text);
}
.sf-row select {
  padding: 7px 10px; border: 1px solid var(--line); border-radius: 6px; outline: none;
  font-size: 12.5px; font-family: var(--font); background: #fff; color: var(--text);
  max-width: 200px; cursor: pointer;
}
.sf-row .sf-q:focus, .sf-row select:focus { border-color: var(--primary); }

/* ================ 多选筛选下拉（msf） ================ */
.msf { position: relative; display: inline-flex; }
.msf-trigger {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 10px; border: 1px solid var(--line); border-radius: 6px;
  background: #fff; color: var(--text); font-size: 12.5px; font-family: var(--font);
  cursor: pointer; max-width: 220px; min-width: 120px;
  transition: border-color .15s;
}
.msf-trigger:hover { border-color: #c4d2e6; }
.msf.open .msf-trigger { border-color: var(--primary); }
.msf-trigger .msf-label {
  flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--muted);
}
.msf-trigger .msf-label.has { color: var(--primary); font-weight: 600; }
.msf-trigger .msf-caret { font-size: 10px; color: var(--muted); transition: transform .15s; }
.msf.open .msf-caret { transform: rotate(180deg); }
.msf-panel {
  position: fixed; z-index: 1000;
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 6px 24px rgba(20, 33, 61, .12);
  padding: 6px 0 4px; min-width: 180px; max-width: 320px; max-height: 360px;
  display: flex; flex-direction: column;
}
/* hidden 优先于 flex：未展开时面板必须隐藏（否则会一直显示在页面上） */
.msf-panel[hidden] { display: none !important; }
.msf-panel.flip-up { box-shadow: 0 -6px 24px rgba(20, 33, 61, .12); }
.msf-search-row { padding: 0 8px 6px; border-bottom: 1px solid var(--line); }
.msf-search-row .msf-search {
  width: 100%; padding: 5px 10px; border: 1px solid var(--line); border-radius: 5px;
  font-size: 12px; outline: none; background: #f6f8fb;
}
.msf-search-row .msf-search:focus { border-color: var(--primary); background: #fff; }
.msf-list {
  flex: 1 1 auto; overflow-y: auto; max-height: 240px; padding: 4px 0;
}
.msf-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px; cursor: pointer; font-size: 12.5px; color: var(--text);
  transition: background-color .1s;
}
.msf-item:hover { background: #f6f8fb; }
.msf-item .msf-box {
  flex: 0 0 14px; width: 14px; height: 14px; border: 1.5px solid var(--line); border-radius: 3px;
  background: #fff; position: relative;
}
.msf-item.checked .msf-box {
  border-color: var(--primary); background: var(--primary);
}
.msf-item.checked .msf-box::after {
  content: ''; position: absolute; left: 3px; top: 0px; width: 4px; height: 8px;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.msf-item .msf-text { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 搜索过滤时 hidden 优先于 flex（否则输入关键字选项不隐藏，过滤失效） */
.msf-item[hidden] { display: none !important; }
.msf-foot {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 10px 4px; border-top: 1px solid var(--line); font-size: 12px;
}
.msf-foot .msf-summary { margin-left: auto; color: var(--muted); }
.sf-date { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.sf-date input[type="date"] {
  padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; outline: none;
  font-size: 12px; font-family: var(--font); background: #fff; color: var(--text);
}
.sf-reset { margin-left: auto; }
/* 等宽编码（SKU / 单号等） */
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; }

/* 关键字搜索行（物流追踪：FBA货件/转单号/追踪号/MSKU/SKU 模糊搜索） */
.sf-row.sf-search-row { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; }
.sf-row.sf-search-row .sf-search-ico { flex: 0 0 auto; font-size: 13px; color: var(--muted); }
.sf-row.sf-search-row .sf-search {
  flex: 1 1 0; min-width: 0; max-width: none; height: 32px;
  padding: 6px 12px; border: 1px solid var(--line); border-radius: 6px;
  font-size: 12.5px; font-family: var(--font); background: #fff; color: var(--text);
}
.sf-row.sf-search-row .sf-search::placeholder { color: var(--muted); }
.sf-row.sf-search-row .sf-search:focus { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-bg); }
.sf-row.sf-search-row .sf-search-clear { flex: 0 0 auto; }
.sf-row.sf-search-row .sf-search-hint { flex: 0 0 auto; font-size: 12px; color: var(--muted); white-space: nowrap; padding-left: 2px; }

/* 筛选条件行：与仪表盘 .db-filter-row 同款（带 label 的标签 + 字段） */
.sf-row.sf-filter-row { display: flex; flex-wrap: nowrap; gap: 10px; align-items: center; }
.sf-row.sf-filter-row .sf-filter-label {
  font-size: 12.5px; color: var(--muted); font-weight: 500; flex: 0 0 auto;
  padding-left: 4px; white-space: nowrap;
}
.sf-row.sf-filter-row select {
  flex: 1 1 0; min-width: 0; max-width: none;
  padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px;
  font-size: 12.5px; font-family: var(--font); background: #fff; color: var(--text);
  cursor: pointer; outline: none;
}
.sf-row.sf-filter-row .sf-reset { flex: 0 0 auto; margin-left: 6px; }
/* 时间选择栏与仪表盘完全同款：保留外框 + 面板背景（用户要求统一格式，勿再剥离） */

.card {
  margin: 0 24px 24px; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.filter-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; gap: 10px;
}
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tab {
  border: none; background: transparent; padding: 6px 13px; border-radius: 6px;
  cursor: pointer; color: var(--muted); font-size: 12.5px; font-family: var(--font);
}
.tab.active { background: var(--primary-bg); color: var(--primary); font-weight: 500; }
.tab:not(.active):hover { background: var(--gray-bg); color: var(--text); }
.tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tools input[type="text"], .tools select {
  padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px;
  outline: none; font-size: 12.5px; font-family: var(--font); background: var(--panel);
}
.tools input[type="text"]:focus, .tools select:focus { border-color: var(--primary); }
#search, #plans-search { width: 260px; }
.date-range { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.date-range input[type="date"] {
  padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px;
  font-size: 12px; font-family: var(--font); outline: none; background: var(--panel); color: var(--text);
}
.date-range input[type="date"]:focus { border-color: var(--primary); }
.auto { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 5px; cursor: pointer; }

/* ================= 表格 ================= */
/* 数据明细横向滚动唯一发生地：表格超出容器宽时在此内部左右滚动，绝不撑破页面 */
.table-wrap { overflow-x: auto; overflow-y: hidden; max-width: 100%; -webkit-overflow-scrolling: touch; }
.grid { width: 100%; border-collapse: collapse; font-size: 12.5px; }
/* 走 renderHead+colgroup 的数据大表用 fixed 布局（列宽由拖拽/默认值决定）。
   width:auto + min-width:100% 是「滚动条恢复」关键：
   - 列宽总和 > 容器 → 表格=列宽总和 → 撑出横向滚动条（可大幅拉宽，越拉表格越宽）
   - 列宽总和 < 容器 → 表格填满 100% 容器（无滚动条属正常，列窄是用户自己拖的）
   若用 width:100%，fixed 布局下多余空间会按比例放大各列，表格永远锁死容器宽 →
   横向滚动条消失 + 拖宽一列其他列被压缩（"拉不宽"），2026-09-01 已踩坑。
   设置页等无 colgroup 的静态表格保持 auto，避免列被均分错乱 */
#grid-tracking-us, #grid-tracking-eu, #grid-plans, #grid-lxproducts, #grid-customs, #grid-carriers {
  table-layout: fixed; width: max-content; min-width: 100%;
}
/* fixed 布局下列宽完全由 <col>/拖拽决定；内容超宽省略号截断，防止撑破 */
.grid thead th {
  text-align: left; font-size: 12px; color: var(--muted); font-weight: 500;
  padding: 9px 12px; background: #fafbfd; border-bottom: 1px solid var(--line);
  white-space: nowrap; position: relative; user-select: none;
  overflow: hidden; text-overflow: ellipsis;
}
.grid thead th { position: relative; user-select: none; }
.grid thead th[draggable="true"] { cursor: grab; }
.grid thead th[draggable="true"]:active { cursor: grabbing; }
.grid thead th.dragging { opacity: .35; }
.grid thead th.drop-before { box-shadow: inset 3px 0 0 var(--primary); }
.grid thead th.drop-after { box-shadow: inset -3px 0 0 var(--primary); }
.grid thead th .th-resizer {
  position: absolute; right: 0; top: 0; bottom: 0; width: 5px; cursor: col-resize; z-index: 2;
}
.grid thead th .th-resizer:hover { background: var(--primary); opacity: .35; }
/* 列点击排序：sortable 加手型，th-sort 显示方向箭头 */
.grid thead th.sortable { cursor: pointer; }
.grid thead th.sortable:hover { background: #eef3fc; color: var(--primary); }
.grid thead th .th-sort {
  display: inline-block; margin-left: 4px; font-size: 10px; line-height: 1;
  color: #c8d0dc; transition: color .15s;
}
.grid thead th.sortable:hover .th-sort { color: var(--primary); }
.grid thead th.sorted { color: var(--primary); background: #eef3fc; }
.grid thead th.sorted .th-sort { color: var(--primary); font-weight: 600; }
.grid tbody td {
  padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.grid tbody tr { cursor: pointer; transition: background .1s; }
.grid tbody tr:hover { background: #f6f9fe; }
.track-no { font-weight: 600; color: var(--primary); }
.sub { font-size: 11px; color: var(--muted); margin-top: 2px; }

.latest-event { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 4px; font-size: 11.5px; font-weight: 500; }
.badge.blue { background: var(--primary-bg); color: var(--primary); }
.badge.green { background: var(--green-bg); color: var(--green); }
.badge.red { background: var(--red-bg); color: var(--red); }
.badge.gray { background: var(--gray-bg); color: var(--muted); }
.badge.amber { background: var(--amber-bg); color: var(--amber); }
.type-tag { font-size: 12px; color: var(--muted); }
.type-tag.head { color: var(--amber); font-weight: 500; }

.op-cell { display: flex; gap: 5px; flex-wrap: wrap; }

.empty { text-align: center; padding: 54px 0; color: var(--muted); }
.empty .hint { font-size: 12px; margin-top: 6px; }

/* ================= 分页（居中） ================= */
.pager {
  display: flex; align-items: center; justify-content: center; gap: 18px;
  padding: 11px 14px; border-top: 1px solid var(--line); flex-wrap: wrap;
}

/* ================= 合计底栏（参考领星） =================
   关键：放在 .table-wrap 外面，所以不参与横向滚动，表格横滚到最右
   这条仍然一直可见，避免用户得手动拉回去看总数。 */
.totals-bar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px 18px;
  padding: 10px 16px; border-top: 2px solid var(--primary);
  background: linear-gradient(180deg, #f5f8ff 0%, #eef3fc 100%);
  font-size: 12.5px; color: var(--text);
  position: sticky; bottom: 0; z-index: 4;
  box-shadow: 0 -2px 6px rgba(20, 60, 130, 0.06);
}
.totals-bar .tb-item { display: inline-flex; align-items: center; gap: 6px; }
.totals-bar .tb-label { color: var(--muted); font-size: 12px; }
.totals-bar .tb-val { font-weight: 600; color: var(--text); }
.totals-bar .tb-val.big { font-size: 16px; color: var(--primary); font-weight: 700; }
.totals-bar .tb-sep { color: var(--line); user-select: none; }
.totals-bar .tb-status {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 10px; background: var(--panel);
  border: 1px solid var(--line); font-size: 12px;
}
.totals-bar .tb-status .num { font-weight: 700; }
.totals-bar .tb-status.NOT_ASSIGNED .num { color: #6b7280; }
.totals-bar .tb-status.IN_TRANSIT .num { color: #2563eb; }
.totals-bar .tb-status.DELIVERED .num { color: #16a34a; }
.totals-bar .tb-status.EXCEPTION .num { color: #dc2626; }
.totals-bar .tb-status.PENDING .num { color: #d97706; }
.pager .count { font-size: 12px; color: var(--muted); }
.pager .pages { display: flex; align-items: center; gap: 4px; }
.pager .page-btn {
  min-width: 28px; height: 28px; padding: 0 7px;
  border: 1px solid var(--line); border-radius: 6px;
  background: var(--panel); color: var(--text);
  font-size: 12.5px; cursor: pointer; font-family: var(--font);
  display: inline-flex; align-items: center; justify-content: center; transition: all .15s;
}
.pager .page-btn:hover:not(:disabled):not(.active) { border-color: var(--primary); color: var(--primary); }
.pager .page-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.pager .page-btn:disabled { opacity: .4; cursor: not-allowed; }
.pager .ellipsis { color: var(--muted); padding: 0 3px; font-size: 12px; }
.pager .per-page { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.pager .per-page select {
  height: 28px; padding: 0 8px; border: 1px solid var(--line); border-radius: 6px;
  font-size: 12.5px; font-family: var(--font); outline: none; background: var(--panel);
  color: var(--text); cursor: pointer;
}
.pager .per-page select:focus { border-color: var(--primary); }

/* ================= 弹窗 ================= */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .45);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.modal-mask[hidden] { display: none; }
.modal {
  background: var(--panel); border-radius: 10px; width: 760px; max-width: 100%;
  max-height: 88vh; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
.modal.sm-modal { width: 500px; }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--line);
}
.modal-head h2 { font-size: 14.5px; font-weight: 600; }
.modal-body { padding: 16px 18px; overflow-y: auto; }

.info-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 16px;
  background: #fafbfd; border: 1px solid var(--line); border-radius: 8px; padding: 13px 15px;
  margin-bottom: 16px;
}
.info-item .k { font-size: 11px; color: var(--muted); }
.info-item .v { font-size: 13px; font-weight: 500; margin-top: 2px; word-break: break-all; }

.tl-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.tl-head h3 { font-size: 13px; font-weight: 600; }

/* 详情弹窗 · 多SKU明细表（同一FBA货件编号下领星的全部SKU行） */
#d-skus { margin-bottom: 16px; }
#d-skus .tl-head { margin-top: 2px; }
.d-sku-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.d-sku-table th, .d-sku-table td { border: 1px solid var(--line); padding: 7px 9px; text-align: left; white-space: nowrap; }
.d-sku-table th { background: #f3f5f9; font-weight: 600; color: var(--muted); font-size: 11.5px; }
.d-sku-table td.sku-name { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.d-sku-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.d-sku-table tr.total td { background: #fafbfd; font-weight: 600; }
.d-sku-table td.sub { color: var(--muted); }

.timeline { position: relative; padding-left: 6px; }
.tl-item { display: flex; gap: 14px; padding: 0 0 20px 0; position: relative; }
.tl-item:last-child { padding-bottom: 4px; }
.tl-dot {
  width: 28px; height: 28px; border-radius: 50%; background: var(--gray-bg);
  display: flex; align-items: center; justify-content: center; font-size: 13px;
  flex-shrink: 0; z-index: 1;
}
.tl-item:not(:last-child)::after {
  content: ''; position: absolute; left: 14px; top: 30px; bottom: 0;
  width: 2px; background: var(--line);
}
.tl-item.EXCEPTION .tl-dot { background: var(--red-bg); }
.tl-item.DELIVERED .tl-dot { background: var(--green-bg); }
.tl-content .desc { font-size: 13px; font-weight: 500; }
.tl-item.EXCEPTION .desc { color: var(--red); }
.tl-item.DELIVERED .desc { color: var(--green); }
.tl-content .meta { font-size: 11.5px; color: var(--muted); margin-top: 3px; }

/* ================= 表单 ================= */
#add-form label, #assign-form label { display: block; margin-bottom: 12px; font-size: 13px; }
#add-form input, #add-form select, #assign-form input, #assign-form select {
  display: block; width: 100%; margin-top: 5px; padding: 8px 11px;
  border: 1px solid var(--line); border-radius: 6px; font-size: 13px; font-family: var(--font);
  outline: none; background: var(--panel);
}
#add-form input:focus, #add-form select:focus, #assign-form input:focus, #assign-form select:focus { border-color: var(--primary); }
.form-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* ================= 多转单号子行 ================= */
.grid tbody tr.sub-row td { background: #f8fafc; border-top: none; padding: 6px 14px; }
.sub-track-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 12px; }
.sub-track-row .sub-no { color: var(--muted); font-weight: 600; min-width: 26px; }
.sub-track-row .sub-ev { flex: 1; min-width: 200px; color: var(--text); max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sub-track-row .sub-t { color: var(--muted); }
.act-expand { margin-left: 6px; padding: 1px 8px; font-size: 11px; }

/* ================= 产品属性表格弹窗 ================= */
.lg-modal { max-width: 1100px; width: 95vw; }
.prod-grid th, .prod-grid td { white-space: nowrap; vertical-align: middle; }
.prod-grid thead th { background: #f5f7fa; font-size: 12px; }
.prod-grid tbody td { padding: 4px 6px; }
.prod-grid input,
.prod-grid textarea {
  width: 100%; min-width: 80px; padding: 4px 6px; border: 1px solid var(--line);
  border-radius: 4px; font-size: 12px; background: #fff; box-sizing: border-box;
}
.prod-grid input[readonly] { background: #f5f7fa; color: var(--muted); cursor: default; }
.prod-grid input[type="number"] { text-align: right; }
.prod-grid tbody tr:first-child td { background: #fafbfd; }
.prod-grid tbody tr:last-child td { background: #fff; }

/* ================= 列设置 ================= */
.col-list { display: flex; flex-direction: column; gap: 6px; }
.col-row {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px;
  border: 1px solid var(--line); border-radius: 6px; background: #fafbfd;
}
.col-row.custom { border-style: dashed; background: #fdf6e6; }
.col-row .col-check { display: flex; align-items: center; gap: 8px; flex: 1; font-size: 13px; cursor: pointer; }
.col-row .col-check input { accent-color: var(--primary); }
.col-row .col-move { display: flex; gap: 4px; }
.col-row .col-move .btn { padding: 2px 8px; font-size: 12px; }
.col-row .col-tag { font-size: 10px; padding: 1px 5px; background: #fdf2e2; color: #d97706; border-radius: 3px; margin-left: 4px; }
.col-add { display: flex; gap: 8px; margin-top: 12px; align-items: center; padding: 8px 10px; background: #f5f8ff; border: 1px dashed #2b6df0; border-radius: 6px; }
.col-add input, .col-add select { padding: 5px 8px; border: 1px solid var(--line); border-radius: 5px; font-size: 12px; font-family: var(--font); outline: none; background: var(--panel); }
.col-add input { flex: 1; min-width: 100px; }
.col-add select { min-width: 160px; }

/* ================= MSKU 产品属性 ================= */
#product-form label { display: block; margin-bottom: 10px; font-size: 12.5px; color: var(--text); }
#product-form input {
  display: block; width: 100%; margin-top: 4px; padding: 7px 10px;
  border: 1px solid var(--line); border-radius: 6px; font-size: 13px; font-family: var(--font);
  outline: none; background: var(--panel);
}
#product-form input:focus { border-color: var(--primary); }
#product-form input[readonly] { background: var(--gray-bg); color: var(--muted); }
.prod-sec {
  font-size: 12px; font-weight: 600; color: var(--primary);
  margin: 14px 0 8px; padding-bottom: 4px; border-bottom: 1px dashed var(--line);
}
.prod-auto {
  font-size: 12px; color: var(--muted); margin: 6px 0;
  padding: 6px 10px; background: #f5f8ff; border-radius: 5px;
}
.prod-auto .v { color: var(--primary); font-weight: 600; margin-right: 4px; }
.prod-link { cursor: pointer; text-decoration: underline dotted; }

/* ================= 配置 ================= */
.cfg-note { font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.cfg-list { margin-bottom: 14px; }
.cfg-row {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
  padding: 8px 0; border-bottom: 1px dashed var(--line);
}
.cfg-row .name { font-weight: 500; font-size: 13px; }
.cfg-row .note { font-size: 11px; color: var(--muted); margin-top: 2px; }
.modal-body h3 { font-size: 13px; margin-bottom: 4px; }
.hint { font-size: 12px; color: var(--muted); line-height: 1.7; }
code { background: var(--gray-bg); padding: 1px 6px; border-radius: 4px; font-size: 12px; }

/* ================= Toast ================= */
#toast-wrap { position: fixed; top: 20px; right: 24px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: #1f2733; color: #fff; padding: 10px 16px; border-radius: 7px;
  font-size: 12.5px; box-shadow: 0 8px 24px rgba(0,0,0,.18); animation: fadein .18s; max-width: 340px;
}
.toast.ok::before { content: '✓ '; color: #4ade80; }
.toast.err { background: #7f1d1d; }
.toast.err::before { content: '✕ '; }
@keyframes fadein { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ================= 二级内容导航（内容区顶部） ================= */
.sub-bar {
  display: flex; gap: 2px; padding: 0 24px 2px; flex-wrap: wrap;
}
.sub-tab {
  border: none; background: transparent; padding: 7px 14px; border-radius: 6px 6px 0 0;
  cursor: pointer; font-size: 13px; color: var(--muted); font-family: var(--font);
  border-bottom: 2px solid transparent;
}
.sub-tab:hover { color: var(--text); background: var(--gray-bg); }
.sub-tab.active { color: var(--primary); font-weight: 600; border-bottom-color: var(--primary); }

/* ================= 仪表盘 ================= */
.db-filters {
  display: flex; flex-wrap: wrap; gap: 12px 16px; padding: 12px 14px; align-items: center;
}
/* 单卡片平铺容器：time-quick 独占一行，下面 5 项 select + 重置 全部在一行（禁止换行） */
.db-filters-inline .time-quick { flex: 1 1 100%; min-width: 100%; }
.db-filters-inline .db-filter-row {
  flex: 1 1 100%; min-width: 100%;
  display: flex; flex-wrap: nowrap; gap: 12px; align-items: center;
}
.db-filters-inline .db-filter-row .db-filter-group { flex: 1 1 0; min-width: 0; }
.db-filters-inline .db-filter-row .db-filter-group.db-filter-actions { flex: 0 0 auto; }
.db-filter-group { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.db-filter-group .k { white-space: nowrap; }
.db-filter-group select, .db-filter-group input[type="date"] {
  padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px;
  font-size: 12.5px; font-family: var(--font); outline: none; background: var(--panel);
  width: 100%; min-width: 0; max-width: 100%;
}
.db-filter-group select { cursor: pointer; }
.db-filter-group select:focus, .db-filter-group input[type="date"]:focus { border-color: var(--primary); }

/* 时间快速选择器 */
.time-quick {
  display: flex; flex-direction: column; gap: 6px;
  padding: 6px 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
}
.time-quick .tq-icon {
  width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 14px; flex: 0 0 auto;
}
.tq-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tq-clocks { display: flex; align-items: center; gap: 8px; justify-content: flex-end; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.tq-clock {
  padding: 3px 10px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--card); color: var(--text);
  display: inline-flex; align-items: center; gap: 6px;
  font-variant-numeric: tabular-nums;
}
.tq-clock .t { color: var(--text); font-weight: 500; }
.tq-row.tq-main { justify-content: flex-end; }
.tq-presets { display: flex; align-items: center; gap: 0; }
.tq-presets button {
  padding: 5px 12px; border: 1px solid var(--line); background: var(--card);
  color: var(--text); font-size: 13px; font-family: var(--font); cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
  white-space: nowrap; line-height: 1.4;
}
.tq-presets button:first-child { border-radius: 4px 0 0 4px; }
.tq-presets button:last-child { border-radius: 0 4px 4px 0; }
.tq-presets button + button { border-left: none; }
.tq-presets button:hover { color: var(--primary); }
/* 选中态：蓝底白字，颜色"留住"在点中的按钮上（与自定义激活态统一，一眼可辨） */
.tq-presets button.active,
.tq-presets button.active:hover {
  background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 600;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.18);
}
.tq-range {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 10px; border: 1px solid var(--line); border-radius: 6px;
  background: var(--card); font-size: 13px; color: var(--text);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
/* 自定义激活时——范围容器蓝边 + 阴影，给"这里立刻可点"的视觉提示 */
.tq-range.is-custom {
  border-color: var(--primary);
  background: #f0f7ff;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}
.tq-range input[type="date"] {
  border: none; background: transparent; font-size: 13px; outline: none;
  font-family: var(--font); color: var(--text); padding: 0; width: 130px;
  font-variant-numeric: tabular-nums;
  cursor: pointer; pointer-events: auto;
  text-align: center;
}
.tq-range input[type="date"]:disabled { color: var(--muted); cursor: pointer; }
.tq-range input[type="date"]:not(:disabled) { color: var(--primary); font-weight: 600; }
.tq-range .tq-sep { color: var(--muted); }
/* 📅 图标——无论是否自定义激活，都是可点击（点击切到自定义） */
.tq-range .tq-cal {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 4px;
  color: var(--primary); font-size: 14px;
  cursor: pointer; user-select: none;
  transition: background .12s, transform .12s;
  background: transparent;
}
.tq-range .tq-cal:hover { background: rgba(59,130,246,0.12); transform: scale(1.06); }
.tq-range .tq-cal:active { background: rgba(59,130,246,0.22); transform: scale(0.96); }
/* 当范围处于非自定义（disabled）时，图标稍微降饱和，提示"点这里也会激活" */
.tq-range:not(.is-custom) .tq-cal { color: var(--primary); opacity: .85; }

.db-charts {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px;
  padding: 0 24px 14px;
}
.db-chart-card { margin: 0; }
.db-chart-head { display: flex; align-items: center; justify-content: space-between; padding: 11px 14px; border-bottom: 1px solid var(--line); }
.db-chart-head h3 { font-size: 13px; font-weight: 600; }
.db-chart-title { display: flex; align-items: center; gap: 10px; }
/* 走势图汇总粒度切换（日/月/年） */
.db-gran { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.db-gran-btn { border: none; background: transparent; padding: 3px 11px; font-size: 11.5px; color: var(--muted); cursor: pointer; line-height: 1.5; }
.db-gran-btn + .db-gran-btn { border-left: 1px solid var(--line); }
.db-gran-btn:hover { color: var(--text); background: var(--gray-bg); }
.db-gran-btn.active { background: var(--primary); color: #fff; }
.db-legend { display: flex; gap: 12px; font-size: 11.5px; color: var(--muted); align-items: center; }
.db-legend .lg { display: inline-block; width: 10px; height: 10px; border-radius: 2px; vertical-align: middle; margin-right: 4px; }
.db-legend-hint { color: var(--muted); opacity: .8; }
.lg-blue { background: var(--primary); }
.lg-green { background: var(--green); }
.lg-red { background: var(--red); }
.lg-orange { background: #f59e0b; }
.lg-purple { background: #8b5cf6; }

.db-line { padding: 14px; position: relative; }
.db-line svg { width: 100%; height: 200px; display: block; }
.db-line .axis text { fill: var(--muted); font-size: 10px; }
.db-line .grid-line { stroke: var(--line); stroke-width: 1; }
.db-line .label { font-size: 10px; fill: var(--muted); }
/* 点击折线图：高亮参考线 + 当日数据浮层 */
.db-line .hl-line { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.db-line-tip {
  position: absolute; top: 18px; z-index: 6; min-width: 118px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: var(--shadow); padding: 8px 11px; font-size: 12px;
  pointer-events: none;
}
.db-line-tip .tip-date { font-weight: 600; font-size: 12.5px; margin-bottom: 5px; }
.db-line-tip .tip-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; line-height: 1.7; }
.db-line-tip .tip-row .name { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.db-line-tip .tip-row b { font-weight: 600; }
.db-line-tip .td { display: inline-block; width: 8px; height: 8px; border-radius: 2px; }
.td-blue { background: var(--primary); }
.td-orange { background: #f59e0b; }
.td-purple { background: #8b5cf6; }

.db-pie { padding: 14px; display: flex; align-items: center; gap: 14px; min-height: 200px; }
.db-pie svg { width: 130px; height: 130px; flex-shrink: 0; }
.db-pie-legend { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.db-pie-legend .item { display: flex; align-items: center; justify-content: space-between; font-size: 12px; }
.db-pie-legend .item .name { display: flex; align-items: center; gap: 6px; }
.db-pie-legend .item .dot { width: 10px; height: 10px; border-radius: 2px; }
.db-pie-legend .item .num { color: var(--muted); font-size: 11.5px; }

.db-bar { padding: 10px 14px; min-height: 200px; }
.db-bar-row { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; font-size: 12px; }
.db-bar-row .name { width: 110px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex-shrink: 0; }
.db-bar-row .track { flex: 1; background: var(--gray-bg); height: 16px; border-radius: 3px; overflow: hidden; }
.db-bar-row .fill { height: 100%; background: var(--primary); border-radius: 3px; transition: width .3s; min-width: 1px; }
.db-bar-row .fill.green { background: var(--green); }
.db-bar-row .fill.red { background: var(--red); }
.db-bar-row .fill.amber { background: var(--amber); }
.db-bar-row .num { width: 50px; text-align: right; color: var(--muted); font-size: 11.5px; }
.db-bar-empty { text-align: center; color: var(--muted); padding: 30px 0; font-size: 12px; }

@media (max-width: 1200px) { .db-charts { grid-template-columns: repeat(2, 1fr); } .db-chart-card[style*="span 2"] { grid-column: span 2 !important; } }
@media (max-width: 760px) { .db-charts { grid-template-columns: 1fr; } .db-chart-card[style*="span 2"] { grid-column: span 1 !important; } }

@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(3, 1fr); }
  .info-grid { grid-template-columns: 1fr 1fr; }
}

/* ============ 登录页 ============ */
#login-page {
  position: fixed; inset: 0; z-index: 300;
  display: none; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1e2b3c 0%, #26364d 60%, #2b3f5c 100%);
}
.login-card {
  width: 380px; max-width: 92vw; background: var(--panel);
  border-radius: 14px; box-shadow: 0 24px 64px rgba(0,0,0,.35);
  padding: 36px 34px 26px;
}
.login-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.login-logo .logo {
  width: 46px; height: 46px; border-radius: 10px; background: var(--primary);
  color: #fff; font-weight: 700; font-size: 18px;
  display: flex; align-items: center; justify-content: center;
}
.login-title { font-size: 19px; font-weight: 600; color: var(--text); }
.login-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.login-label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 14px; }
.login-label input {
  display: block; width: 100%; margin-top: 6px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 8px; outline: none;
  font-size: 14px; font-family: var(--font); background: #fff; color: var(--text);
  box-sizing: border-box;
}
.login-label input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-bg); }
.login-btn { width: 100%; margin-top: 6px; padding: 10px; font-size: 14px; border-radius: 8px; }
#login-test-btn { margin-top: 8px; color: var(--muted); }
.login-error { color: #dc2626; font-size: 12.5px; margin: 4px 0 10px; }
.login-foot { text-align: center; font-size: 11.5px; color: var(--muted); margin-top: 20px; }

/* ============ 筛选卡 / 联动统计 / 图表（物流追踪、FBA发货） ============ */
.sf-card { margin: 0 24px 14px; padding: 0; }
.sf-card .sf-panel { border-bottom: none; border-radius: var(--radius); }
.stats { margin: 0 24px 14px; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat-card.arranged .num { color: var(--primary); }
.stat-card.pending .num { color: #f59e0b; }
.stat-card.total { background: linear-gradient(135deg, #f0f4ff, #fff); }
.stat-card.arranged { background: linear-gradient(135deg, #eef6ff, #fff); }
.stat-card.pending { background: linear-gradient(135deg, #fff8ec, #fff); }
.stat-card.transit { background: linear-gradient(135deg, #eef6ff, #fff); }
.stat-card.delivered { background: linear-gradient(135deg, #eefaf3, #fff); }
.stat-card.exception { background: linear-gradient(135deg, #fff0f0, #fff); }
.chart-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; flex-wrap: wrap; }
.chart-legend { display: flex; flex-direction: column; gap: 3px; }
.chart-legend-item { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text); white-space: nowrap; }
.chart-legend-item .dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.chart-empty { padding: 16px 10px; text-align: center; color: var(--muted); font-size: 11.5px; }

/* ============ 智能图表（饼图/柱状图/条形图自适应） ============ */

/* ============ 产品管理：编辑弹窗 + 自定义字段 + 行操作 ============ */
#lxp-form .lxp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
#lxp-form label { display: block; margin-bottom: 12px; font-size: 12.5px; color: var(--muted); }
#lxp-form label input, #lxp-form label select {
  display: block; width: 100%; margin-top: 5px; padding: 8px 11px;
  border: 1px solid var(--line); border-radius: 6px; font-size: 13px; font-family: var(--font);
  outline: none; background: var(--panel); color: var(--text); box-sizing: border-box;
}
#lxp-form label input:focus, #lxp-form label select:focus { border-color: var(--primary); }
#lxp-form .lxp-full { margin-top: 2px; }
#lxp-form .lxp-cf-block { margin-top: 6px; padding: 10px 12px; background: #f5f8ff; border: 1px dashed #2b6df0; border-radius: 8px; }
#lxp-form .lxp-cf-head { display: flex; align-items: center; justify-content: space-between; font-size: 13px; margin-bottom: 8px; }
.lxp-cf-row { display: flex; gap: 8px; margin-top: 6px; }
.lxp-cf-row input {
  padding: 7px 10px; border: 1px solid var(--line); border-radius: 6px; font-size: 13px;
  font-family: var(--font); outline: none; background: #fff; color: var(--text);
}
.lxp-cf-row .lxp-cf-k { flex: 0 0 170px; }
.lxp-cf-row .lxp-cf-v { flex: 1; }
.row-acts { white-space: nowrap; text-align: center; }
.row-acts .btn { padding: 3px 8px; margin: 0 2px; }

/* ============ 数据大表通用：限高滚动容器，横向滚动条常驻第一屏 ============ */
/* 表格超出首屏时容器内部纵向滚动，横向滚动条固定在容器底部（第一屏内可见），表头吸顶。
   所有板块明细表统一使用：.table-scroll（产品管理旧类名 .lxp-scroll 保留为别名） */
.table-wrap.table-scroll, .table-wrap.lxp-scroll { overflow: auto; max-height: calc(100vh - 300px); }
.table-wrap.table-scroll .grid thead th { position: sticky; top: 0; z-index: 3; box-shadow: 0 1px 0 var(--line); background: #fafbfd; }

/* 产品管理明细：统一数据单元格字号与颜色（SKU 等宽列不再缩小、日期列不再灰色小字） */
#view-lxproducts .grid tbody td { font-size: 12.5px; color: var(--text); }
#view-lxproducts td.mono { font-size: 12.5px; }

/* 品名列（通用：产品管理 / FBA发货 / 物流追踪）：10px 小字 + 强制换行 + 两行截断 + 160px 限宽，悬停显示全文 */
.pname {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  font-size: 10px;
  line-height: 1.3;
  max-width: 160px;
  word-break: break-all;
  white-space: normal; /* 覆盖 td 的 nowrap，否则永远单行截断 */
  vertical-align: middle;
}

/* ===== 运营预估到达 / 备注 行内编辑（2026-09-03 用户要求，US/EU 物流板块） =====
   默认无边框无底色像普通文本，悬停/聚焦才显示输入框态 */
#grid-tracking-us td.cell-meta, #grid-tracking-eu td.cell-meta { padding: 3px 6px; }
.cell-meta .meta-input {
  border: 1px solid transparent; border-radius: 4px; background: transparent;
  font: inherit; color: inherit; padding: 2px 4px;
  width: 100%; min-width: 0; box-sizing: border-box; outline: none;
  transition: border-color .12s, background .12s;
}
.cell-meta .meta-input:hover { border-color: var(--line); background: #fff; }
.cell-meta .meta-input:focus { border-color: var(--primary); background: #fff; }
.cell-meta .meta-input::placeholder { color: var(--muted); }
.meta-note { max-width: 230px; }
.meta-eta { min-width: 160px; }
