:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e5e9f2;
  --text: #1f2733;
  --text-soft: #64748b;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eef4ff;
  --success: #16a34a;
  --success-soft: #e9f8ef;
  --warn: #d97706;
  --warn-soft: #fef3e2;
  --danger: #dc2626;
  --danger-soft: #fdeaea;
  --shadow: 0 1px 3px rgba(16,24,40,.06), 0 6px 20px rgba(16,24,40,.06);
  --radius: 12px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
a { color: var(--primary); }
button { font-family: inherit; cursor: pointer; }

/* ---------- 登录 ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #2563eb 0%, #4f46e5 100%); padding: 20px; }
.login-card { background: var(--surface); width: 380px; max-width: 100%; border-radius: 16px;
  padding: 32px 28px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.login-logo, .sidebar-logo { width: 44px; height: 44px; border-radius: 12px; flex: none;
  display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 15px; letter-spacing: 1px;
  background: #2563eb; }
.login-brand h1 { font-size: 19px; }
.login-brand p { margin: 2px 0 0; color: var(--text-soft); font-size: 12.5px; }
.login-form label { display: block; font-size: 13px; color: var(--text-soft); margin: 14px 0 6px; }
.login-form input { width: 100%; padding: 11px 12px; border: 1px solid var(--border); border-radius: 10px;
  font-size: 14px; background: var(--surface-2); outline: none; transition: border .15s; }
.login-form input:focus { border-color: var(--primary); background: #fff; }
.login-hint { margin-top: 14px; font-size: 11.5px; color: var(--text-soft); text-align: center; }
.form-error { color: var(--danger); font-size: 12.5px; margin-top: 10px; min-height: 16px; }

/* ---------- 布局 ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 232px; flex: none; background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; left: 0; z-index: 40; }
.sidebar-head { display: flex; align-items: center; gap: 10px; padding: 16px 16px; border-bottom: 1px solid var(--border); }
.sidebar-title { font-weight: 700; font-size: 15px; }
.sidebar-close { display: none; margin-left: auto; background: none; border: none; font-size: 22px; color: var(--text-soft); }
.sidebar-nav { padding: 10px 10px; flex: 1; overflow-y: auto; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px;
  color: var(--text-soft); font-size: 14px; margin-bottom: 2px; cursor: pointer; user-select: none; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--primary-soft); color: var(--primary-dark); font-weight: 600; }
.nav-item .ico { width: 18px; text-align: center; }
.nav-badge { display: none; margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: #ef4444; color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
.nav-item.active .nav-badge { filter: saturate(1.1); }
.sidebar-foot { padding: 12px 14px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--text-soft); }
.sidebar-foot b { color: var(--text); }

.main { flex: 1; margin-left: 232px; display: flex; flex-direction: column; min-width: 0; }
.topbar { height: 58px; background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 20px; gap: 12px; position: sticky; top: 0; z-index: 20; }
.topbar-menu { display: none; background: none; border: none; font-size: 20px; color: var(--text); }
.topbar-title { font-size: 16px; flex: 1; }
.topbar-user { display: flex; align-items: center; gap: 10px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 13px; }

.content { padding: 20px; max-width: 1760px; width: 100%; margin: 0 auto; }

/* ---------- 卡片/网格 ---------- */
.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.kpi-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.kpi-grid > .stat { min-width: 0; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow); }
.card h3 { font-size: 14px; color: var(--text-soft); font-weight: 600; margin-bottom: 10px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow); }
.stat .label { font-size: 12.5px; color: var(--text-soft); }
.stat .value { font-size: 26px; font-weight: 700; margin-top: 6px; }
.stat .sub { font-size: 12px; color: var(--text-soft); margin-top: 2px; }
.stat .bar { height: 4px; border-radius: 4px; margin-top: 12px; background: var(--primary-soft); overflow: hidden; }
.stat .bar > i { display: block; height: 100%; background: var(--primary); }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
/* 数据表行与行之间的分界横线颜色加深（发货/次品/回单/列表等 .table-wrap） */
.table-wrap td, .table-wrap th { border-bottom-color: #c2ccda; }
th { background: var(--surface-2); color: var(--text-soft); font-weight: 600; font-size: 12.5px; position: sticky; top: 0; }
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: none; }

/* ---------- 徽章 ---------- */
.badge { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.blue { background: var(--primary-soft); color: var(--primary-dark); }
.badge.green { background: var(--success-soft); color: var(--success); }
.badge.amber { background: var(--warn-soft); color: var(--warn); }
.badge.gray { background: #eef2f7; color: var(--text-soft); }
.badge.clickable { cursor: pointer; user-select: none; }
.badge.clickable:hover { filter: brightness(.94); text-decoration: underline; }
.badge.purple { background: #f3e8ff; color: #7e22ce; }
.badge.red { background: var(--danger-soft); color: var(--danger); } /* 淡红：驳回 */
.badge.dist { padding: 1px 8px; font-size: 11.5px; }
.badge.dist b { margin-left: 3px; font-weight: 700; }
.nowrap { white-space: nowrap; }

/* 对账明细：批量操作条 */
.batch-bar { display: flex; align-items: center; gap: 8px; padding: 8px 10px; margin: 10px 0 0; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); }
.batch-info { font-size: 13px; color: var(--text-soft); margin-right: 6px; }
.batch-info b { color: var(--text); }

/* 状态筛选 chips */
.chip-group { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--border); background: var(--surface); color: var(--text-soft); border-radius: 999px; padding: 5px 13px; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* 同一车合并计费标记（Excel「运费」列合并单元格 → 组内只有首行计费，其余行标「同车」） */
.freight-merge { display: inline-block; margin-left: 5px; padding: 0 6px; border-radius: 999px; font-size: 11px; line-height: 16px; font-weight: 600; background: var(--warn-soft); color: var(--warn); border: 1px solid #f2cf9a; white-space: nowrap; vertical-align: middle; cursor: help; }
.hint-box.hint-truck { background: var(--warn-soft); border-left-color: var(--warn); color: #7c4a03; }
th.col-check, td.col-check { width: 34px; text-align: center; padding-left: 6px; padding-right: 6px; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 6px; background: #eef2f7; color: var(--text-soft); font-size: 11.5px; margin: 1px 3px 1px 0; }

/* 发货管理：表头整行字号放大；客户交期列放宽避免日期被裁切；异常备注有内容时红字突出 */
.table-wrap.fixed-head thead th { font-size: 14.5px; color: var(--text); }
.table-wrap.fixed-head th, .table-wrap.fixed-head td { padding: 2.5px 10px; }
th.col-due, td.col-due { width: 144px; }
/* 表格内交期：宽度调到刚好「日期 + 日历图标」贴身（约 124px），
   既不会因过窄让日历图标压住日期，也不会因过宽让图标被推到最右侧、与日期之间空出一大片 */
.input-due { width: 124px; box-sizing: border-box; }
th.th-lg { font-size: 14.5px; color: var(--text); }
.due-text { color: var(--text-soft); }
.exc-input { width: 132px; }
.exc-input:not(:placeholder-shown) { color: #e53935; font-weight: 700; background: #fff1f0; }
/* 次品管理：备注有内容时红字突出（与发货管理异常备注一致） */
.defect-remark { width: 140px; }
.defect-remark:not(:placeholder-shown) { color: #e53935; font-weight: 600; background: #fff1f0; }
/* 已送达：灰色空白方格，点击打勾变绿色 */
th.col-delivered, td.col-delivered { width: 60px; text-align: center; padding-left: 4px; padding-right: 4px; }
.deliver-box { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 6px; background: #e9edf2; border: 1px solid #c7ced8; cursor: pointer; user-select: none; font-size: 15px; line-height: 1; color: transparent; transition: background .15s, border-color .15s; }
.deliver-box:hover { border-color: #9aa6b5; }
.deliver-box:focus { outline: 2px solid #2f80ed; outline-offset: 1px; }
.deliver-box.on { background: #1faa59; border-color: #1faa59; color: #fff; }

/* 表头 Excel 式筛选按钮与浮动下拉面板 */
.filter-btn { border: none; background: transparent; cursor: pointer; color: var(--text-soft); font-size: 11px; margin-left: 4px; padding: 1px 4px; border-radius: 4px; line-height: 1; vertical-align: middle; }
.filter-btn:hover { background: rgba(0,0,0,.07); color: var(--text); }
.filter-btn.active { color: #fff; background: #2f80ed; font-weight: 700; box-shadow: 0 0 0 2px rgba(47,128,237,.18); }
.filter-btn.active:hover { background: #1f6fd6; color: #fff; }
/* 已筛选列：表头淡蓝底 + 左侧强调条，便于一眼看出当前哪一列带筛选条件 */
th:has(.filter-btn.active) { background: rgba(47,128,237,.10); box-shadow: inset 3px 0 0 #2f80ed; }
.col-filter-pop { position: fixed; z-index: 1200; display: none; width: 224px; max-height: 340px; background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 12px 32px rgba(0,0,0,.18); padding: 8px; }
.col-filter-pop .cf-search { margin-bottom: 6px; }
.col-filter-pop .cf-search-input { width: 100%; box-sizing: border-box; padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; }
.col-filter-pop .cf-all { display: block; padding: 4px 2px; font-size: 13px; border-bottom: 1px dashed var(--border); margin-bottom: 4px; cursor: pointer; }
.col-filter-pop .cf-list { max-height: 208px; overflow: auto; }
.col-filter-pop .cf-item { display: flex; align-items: center; gap: 6px; padding: 3px 2px; font-size: 13px; cursor: pointer; }
.col-filter-pop .cf-item:hover { background: var(--surface-2); }
.col-filter-pop .cf-empty { padding: 12px; color: var(--text-soft); font-size: 13px; text-align: center; }
.col-filter-pop .cf-foot { display: flex; justify-content: space-between; gap: 6px; margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--border); }
/* 筛选区：承运商多选 + 客户交期“清除”按钮 */
.field-inline { display: flex; align-items: center; gap: 6px; }
.btn-ghost { background: var(--surface-2); color: var(--text-soft); border: 1px solid var(--border); padding: 0 10px; }
.btn-ghost:hover { color: var(--text); border-color: var(--primary); }

/* 工具栏内嵌的多选筛选：与 input/select 同高同字号，保证整行高低一致 */
.field .ms { width: 100%; }
.field .ms-btn { width: 100%; height: 41px; padding: 0 11px; font-size: 14px; border-radius: 9px; text-align: left; }

/* 工具栏内所有控件统一高度（原生 input 的默认行高在不同类型间会有 2px 出入） */
.toolbar .field input, .toolbar .field select { height: 41px; }
.toolbar-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.toolbar-actions .btn { height: 41px; }

/* 运费对账：发货/次品分段切换 */
.seg-control { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 3px; gap: 3px; }
.seg-control .seg { border: none; background: transparent; color: var(--text-soft); font-size: 13.5px; font-weight: 600; padding: 7px 16px; border-radius: 8px; cursor: pointer; transition: background .15s, color .15s, box-shadow .15s; white-space: nowrap; }
.seg-control .seg:hover { color: var(--text); }
.seg-control .seg.active { background: var(--primary); color: #fff; box-shadow: 0 1px 3px rgba(37,99,235,.3); }

/* 客户交期：未筛选时输入框内显示「全部」（覆盖原生 yyyy-mm-dd） */
.date-wrap { position: relative; display: inline-flex; align-items: center; flex: none; }
/* 筛选区交期：宽度与表格内一致（124px，刚好容纳日期 + 日历图标），并「禁止收缩」——
   工具栏拥挤时若被 flex 压窄，日历图标就会盖住日期；同时避免过宽造成图标与日期之间空一大片 */
.date-wrap input[type=date] { width: 124px; min-width: 124px; flex: none; }
.date-wrap .date-ph { position: absolute; left: 1px; top: 1px; bottom: 1px; width: calc(100% - 36px);
  display: flex; align-items: center; padding-left: 11px; background: var(--surface); color: var(--text-soft);
  font-size: 14px; border-radius: 8px 0 0 8px; pointer-events: none; }
.date-wrap.is-empty input[type=date]::-webkit-datetime-edit { color: transparent; }

/* 日期输入：收紧日历图标自带的 margin/padding，让图标更贴近日期文字，也降低日期被图标压住的概率 */
input[type=date]::-webkit-calendar-picker-indicator { margin: 0; padding: 0; cursor: pointer; }

/* 搜索：占满剩余宽度，可搜索整页内容 */
.field-search { flex: 1 1 200px; min-width: 170px; }
.field-search input { width: 100%; }

/* ---------- 报价表（大量行滚动） ---------- */
.table-scroll { max-height: 62vh; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.table-scroll table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table-scroll thead th { position: sticky; top: 0; z-index: 2; background: var(--surface-2); box-shadow: 0 1px 0 var(--border); }
.table-scroll th, .table-scroll td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }


/* ---------- 按钮 ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 9px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 13.5px;
  transition: all .15s; }
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-block { width: 100%; justify-content: center; padding: 11px; font-size: 15px; font-weight: 600; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- 工具栏/筛选 ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.toolbar .spacer { flex: 1; }
.sync-bar { font-size: 12px; color: var(--text-soft); background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 7px 10px; margin-bottom: 12px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 12px; color: var(--text-soft); }
input, select, textarea { font-family: inherit; font-size: 14px; padding: 9px 11px; border: 1px solid var(--border);
  border-radius: 9px; background: var(--surface); color: var(--text); outline: none; transition: border .15s; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); }
select { cursor: pointer; }

/* ---------- 弹窗 ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,.45); display: flex;
  align-items: flex-start; justify-content: center; padding: 40px 16px; z-index: 60; overflow-y: auto; }
.modal { background: var(--surface); border-radius: 14px; width: 520px; max-width: 100%; box-shadow: 0 24px 60px rgba(0,0,0,.25); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 16px; }
.modal-close { background: none; border: none; font-size: 22px; color: var(--text-soft); line-height: 1; }
.modal-body { padding: 18px 20px; max-height: 70vh; overflow-y: auto; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }
/* 叠加确认层：挂在 body 上、层级高于普通弹窗，因此不会销毁下层的回单管理弹窗 */
.modal-top-layer { position: relative; z-index: 200; }
.modal-backdrop.modal-top { z-index: 200; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.form-row.single { grid-template-columns: 1fr; }
.form-row label { font-size: 12.5px; color: var(--text-soft); display: block; margin-bottom: 5px; }
.form-row input, .form-row select, .form-row textarea { width: 100%; }
.hint-box { background: var(--primary-soft); color: var(--primary-dark); border-radius: 9px; padding: 9px 12px;
  font-size: 12.5px; margin-bottom: 14px; }

/* ---------- 回单网格 ---------- */
.receipt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
.receipt-card { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface);
  cursor: pointer; transition: transform .12s, box-shadow .12s; }
.receipt-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.receipt-thumb { height: 120px; background: var(--surface-2); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.receipt-thumb img { width: 100%; height: 100%; object-fit: cover; }
.rc-pick { position: absolute; top: 6px; left: 6px; z-index: 2; background: rgba(255,255,255,.85);
  border-radius: 6px; padding: 2px 5px; cursor: pointer; box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.receipt-card { position: relative; }
.receipt-meta { padding: 8px 10px; font-size: 12px; color: var(--text-soft); }
.receipt-meta b { color: var(--text); display: block; font-size: 12.5px; }

/* ---------- 灯箱（多图翻页） ---------- */
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.88); display: flex; flex-direction: column;
  align-items: center; justify-content: center; z-index: 80; padding: 58px 76px 24px; }
.lightbox-stage { display: flex; flex-direction: column; align-items: center; gap: 10px; max-width: 100%; }
.lightbox-stage img { max-width: 100%; max-height: calc(100vh - 210px); object-fit: contain;
  border-radius: 8px; box-shadow: 0 10px 40px rgba(0,0,0,.55); background: #fff; }
.lightbox-close { position: absolute; top: 12px; right: 22px; color: #fff; font-size: 38px; line-height: 1;
  background: none; border: none; cursor: pointer; opacity: .85; z-index: 3; }
.lightbox-close:hover { opacity: 1; }
.lightbox-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 52px; height: 52px;
  border-radius: 50%; border: none; background: rgba(255,255,255,.14); color: #fff; font-size: 34px;
  line-height: 1; cursor: pointer; z-index: 3; display: flex; align-items: center; justify-content: center; }
.lightbox-nav:hover { background: rgba(255,255,255,.28); }
.lightbox-nav:disabled { opacity: .18; cursor: default; background: rgba(255,255,255,.08); }
.lightbox-nav.prev { left: 18px; } .lightbox-nav.next { right: 18px; }
.lightbox-counter { position: absolute; top: 20px; left: 50%; transform: translateX(-50%); color: #fff;
  font-size: 13.5px; background: rgba(255,255,255,.16); padding: 5px 14px; border-radius: 20px;
  font-variant-numeric: tabular-nums; }
.lightbox-caption { color: rgba(255,255,255,.86); font-size: 13px; text-align: center; max-width: 88vw; }
.lightbox-thumbs { display: flex; gap: 8px; margin-top: 12px; overflow-x: auto; max-width: 88vw; padding: 4px 2px; }
.lightbox-thumbs::-webkit-scrollbar { height: 6px; }
.lightbox-thumbs::-webkit-scrollbar-thumb { background: rgba(255,255,255,.3); border-radius: 3px; }
.lightbox-thumbs img { width: 62px; height: 62px; object-fit: cover; border-radius: 6px; cursor: pointer;
  border: 2px solid transparent; opacity: .55; flex: none; background: #fff; }
.lightbox-thumbs img:hover { opacity: .9; }
.lightbox-thumbs img.active { border-color: var(--primary); opacity: 1; }
/* 表格内可双击查看回单的徽章 */
.badge.viewable { cursor: pointer; user-select: none; }
.badge.viewable:hover { filter: brightness(.93); }

/* 灯箱工具栏：缩放 / 旋转 / 还原 */
.lightbox-tools { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,.14); padding: 6px 10px; border-radius: 999px; z-index: 3; }
.lightbox-tools button { width: 36px; height: 36px; border-radius: 50%; border: none; background: rgba(255,255,255,.16);
  color: #fff; font-size: 18px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background .15s; }
.lightbox-tools button:hover { background: rgba(255,255,255,.32); }
.lightbox-tools #lb-scale { color: #fff; font-size: 12.5px; min-width: 46px; text-align: center; font-variant-numeric: tabular-nums; }
.lightbox-stage img { transition: transform .12s ease; transform-origin: center center; cursor: grab; will-change: transform; }
.lightbox-stage img.grabbing { cursor: grabbing; }

/* 回单管理：月份筛选 */
.toolbar input[type=month] { height: 41px; border: 1px solid var(--border); border-radius: 9px; padding: 0 10px; background: var(--surface); color: var(--text); }
.rc-month-label { font-size: 12px; color: var(--text-soft); align-self: center; }
.rc-all-month { font-size: 12.5px; color: var(--primary); align-self: center; text-decoration: none; }
.rc-all-month:hover { text-decoration: underline; }

/* 回单管理：左侧「按厂家导航」栏（厂家 → 客户） */
.rc-layout { display: flex; gap: 14px; align-items: flex-start; }
.rc-nav { width: 212px; flex: 0 0 212px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
  position: sticky; top: 12px; max-height: calc(100vh - 150px); display: flex; flex-direction: column; overflow: hidden; }
.rc-nav-title { padding: 9px 12px; font-size: 12.5px; font-weight: 700; color: var(--text-soft);
  border-bottom: 1px solid var(--border); background: var(--surface-2); }
.rc-nav-list { overflow-y: auto; padding: 6px; }
.rc-nav-item { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 7px;
  font-size: 13px; color: var(--text); cursor: pointer; user-select: none; }
.rc-nav-item:hover { background: var(--surface-2); }
.rc-nav-item.active { background: var(--primary-soft); color: var(--primary-dark); font-weight: 600; }
.rc-nav-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rc-nav-count { font-size: 11px; color: var(--text-soft); background: var(--surface-2); border-radius: 999px;
  padding: 0 7px; line-height: 17px; min-width: 16px; text-align: center; }
.rc-nav-item.active .rc-nav-count { background: #fff; color: var(--primary-dark); }
.rc-nav-arrow { border: none; background: transparent; cursor: pointer; color: var(--text-soft); font-size: 11px;
  line-height: 1; padding: 3px; border-radius: 4px; transition: transform .15s; }
.rc-nav-arrow:hover { background: #e6ebf3; color: var(--text); }
.rc-nav-arrow.open { transform: rotate(90deg); }
.rc-nav-children { display: none; margin: 0 0 2px 14px; border-left: 1px dashed var(--border); padding-left: 6px; }
.rc-nav-children.open { display: block; }
.rc-nav-cust { font-size: 12.5px; color: var(--text-soft); padding: 5px 8px; }
.rc-nav-cust .rc-nav-count { font-size: 10.5px; line-height: 15px; }
.rc-main { flex: 1; min-width: 0; }
@media (max-width: 900px) {
  .rc-layout { flex-direction: column; }
  .rc-nav { position: static; width: 100%; flex: none; max-height: 260px; }
}

/* ---------- Toast ---------- */
.toast { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); background: #1f2733; color: #fff;
  padding: 10px 18px; border-radius: 10px; font-size: 13.5px; z-index: 100; box-shadow: 0 10px 30px rgba(0,0,0,.3); }
.toast.error { background: var(--danger); }
.toast.success { background: var(--success); }

/* ---------- 杂项 ---------- */
.empty { text-align: center; color: var(--text-soft); padding: 40px; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 12px; flex-wrap: wrap; }
.muted { color: var(--text-soft); }
.section-title { font-size: 15px; font-weight: 700; margin: 18px 0 10px; }
.chart-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 13px; }
.chart-row .name { width: 90px; flex: none; color: var(--text-soft); }
.chart-row .track { flex: 1; height: 22px; background: var(--surface-2); border-radius: 6px; overflow: hidden; }
.chart-row .fill { height: 100%; background: linear-gradient(90deg, #2563eb, #4f46e5); }
.chart-row .val { width: 70px; flex: none; text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- 看板：卡片头 + 图例 ---------- */
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h3 { margin-bottom: 0; }
.legend { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-soft); }
.legend .lg { width: 11px; height: 11px; border-radius: 3px; display: inline-block; margin-left: 8px; }
.legend .lg.ton { background: var(--primary); }
.legend .lg.week { background: #f59e0b; }
.legend .lg.spread { background: var(--warn); }

/* ---------- 看板：分组柱状图（各承运商） ---------- */
.bar-chart { display: flex; align-items: flex-end; gap: 14px; height: 230px; padding: 6px 4px 0; overflow-x: auto; }
.bar-col { display: flex; flex-direction: column; align-items: center; flex: 1 1 0; min-width: 46px; }
.bar-track { display: flex; align-items: flex-end; gap: 5px; height: 192px; }
.bar { width: 18px; border-radius: 5px 5px 0 0; position: relative; transition: height .3s; min-height: 2px; }
.bar.ton { background: linear-gradient(180deg, #2563eb, #4f46e5); }
.bar.week { background: linear-gradient(180deg, #f59e0b, #d97706); }
.bar.spread { background: linear-gradient(180deg, #f59e0b, #d97706); }
.bar-val { position: absolute; top: -16px; left: 50%; transform: translateX(-50%); font-size: 10.5px; color: var(--text-soft); white-space: nowrap; }
.bar-name { margin-top: 8px; font-size: 12.5px; color: var(--text); font-weight: 600; text-align: center; }

/* ---------- 看板：回单圆环图（横排） ---------- */
.donut-row { display: flex; flex-wrap: wrap; gap: 16px 20px; padding-top: 4px; }
.donut-card { display: flex; flex-direction: column; align-items: center; width: 104px; text-align: center; }
.donut { width: 84px; height: 84px; border-radius: 50%;
  background: conic-gradient(var(--success) calc(var(--p, 0) * 1%), #e5e7eb 0);
  display: flex; align-items: center; justify-content: center; }
.donut-hole { width: 56px; height: 56px; border-radius: 50%; background: var(--surface);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; color: var(--text); }
.donut-name { margin-top: 8px; font-size: 13px; font-weight: 600; }
.donut-meta { margin-top: 3px; font-size: 11px; color: var(--text-soft); line-height: 1.4; }

/* ---------- 可点击跳转 ---------- */
.clickable { cursor: pointer; transition: transform .08s ease, box-shadow .12s ease; }
.clickable:hover { box-shadow: 0 2px 6px rgba(16,24,40,.10), 0 10px 28px rgba(16,24,40,.10); }
.clickable-card { cursor: pointer; transition: box-shadow .12s ease; }
.clickable-card:hover { box-shadow: 0 2px 6px rgba(16,24,40,.10), 0 10px 28px rgba(16,24,40,.10); }
.jump-hint { float: right; font-size: 12px; font-weight: 500; color: var(--primary); opacity: .85; }
tr.clickable:hover td { background: var(--surface-2); }

/* ---------- 多选筛选器（回单管理） ---------- */
.ms { position: relative; display: inline-block; }
.ms-btn { height: 34px; padding: 0 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 8px; cursor: pointer; font-size: 13px; white-space: nowrap; }
.ms-btn:hover { border-color: var(--primary); }
.ms-btn.active { border-color: var(--primary); color: var(--primary); font-weight: 600; }
.ms-pop { display: none; position: absolute; top: calc(100% + 4px); left: 0; z-index: 50; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.14); padding: 8px; max-height: 320px; overflow: auto; min-width: 200px; }
.ms-search { position: sticky; top: -8px; z-index: 2; margin: -8px -8px 6px; padding: 8px 8px 6px; background: var(--surface); border-bottom: 1px solid var(--border); }
.ms-search-input { width: 100%; box-sizing: border-box; padding: 6px 9px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; }
.ms-search-input:focus { outline: none; border-color: var(--primary); }
.ms-acts { display: flex; gap: 8px; margin-bottom: 6px; }
.ms-acts button { font-size: 12px; padding: 2px 10px; border: 1px solid var(--border); background: var(--surface-2); border-radius: 6px; cursor: pointer; }
.ms-opt { display: block; padding: 4px 6px; font-size: 13px; white-space: nowrap; cursor: pointer; border-radius: 6px; }
.ms-opt:hover { background: var(--surface-2); }
.ms-opt input { margin-right: 6px; vertical-align: middle; }
.ms-empty { padding: 12px; color: var(--text-soft); font-size: 13px; text-align: center; }

/* ---------- 响应式 ---------- */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { display: block; }
  .sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 35; }
  .sidebar-backdrop.show { display: block; }
  .main { margin-left: 0; }
  .topbar-menu { display: block; }
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .hide-sm { display: none; }
}

/* ---------- 发货管理：冻结表头 + 合计行 ---------- */
.table-wrap.fixed-head { max-height: calc(100vh - 250px); overflow: auto; }
.table-wrap.fixed-head thead th { position: sticky; top: 0; z-index: 3; background: var(--surface-2); box-shadow: 0 1px 0 var(--border); }
.ship-totals { display: flex; flex-wrap: wrap; gap: 18px; align-items: center; padding: 12px 14px;
  background: var(--surface-2); border: 1px solid var(--border); border-top: none; border-radius: 0 0 var(--radius) var(--radius); font-size: 13.5px; }
.ship-totals b { color: var(--text); font-size: 15px; }

/* ---------- 承运商上报处理通知 ---------- */
.notice { border-radius: 10px; padding: 12px 14px; margin-bottom: 12px; font-size: 13.5px; }
.notice-ok { background: var(--success-soft); color: #14532d; border: 1px solid #bbf7d0; }
.notice-info { background: var(--primary-soft); color: var(--primary-dark); border: 1px solid #c7dbff; }
.notice-warn { background: #fff7ed; color: #9a3412; border: 1px solid #fed7aa; }
.notice-danger { background: var(--danger-soft); color: #991b1b; border: 1px solid #fecaca; }
/* ---------- 数据纠错表格：紧凑排版（内容不变但行高更小，一屏看更多行） ---------- */
.table-compact th, .table-compact td { padding: 7px 10px; vertical-align: top; }
/* 通用「最多两行」截断：超出省略号，完整内容用 title 悬停查看 */
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  white-space: pre-wrap; word-break: break-word; }
td.cell-note { white-space: normal; max-width: 320px; }
td.cell-note .clamp2 { max-width: 320px; }
td.cell-time { white-space: nowrap; }
td .cell-sub { font-size: 12px; margin-top: 2px; }
/* 数据纠错「处理」单元格：处理人·时间 + 重新处理 同一行；附言另起一行 */
.rcell { font-size: 12.5px; line-height: 1.5; max-width: 260px; }
.rcell .rcell-line { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.rcell .rcell-meta { color: var(--text-soft); white-space: nowrap; }
.rcell .rcell-note { white-space: pre-wrap; word-break: break-word; max-width: 260px; }
.rcell .muted { font-size: 12px; }
.rcell-act { font-size: 12px; color: var(--primary); white-space: nowrap; }
.rcell-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.notice-title { font-weight: 700; margin-bottom: 6px; }
.notice ul { margin: 6px 0 0; padding-left: 18px; }
.notice li { display: flex; align-items: center; gap: 10px; justify-content: space-between; padding: 4px 0; }

/* ---------- 登录页：修改密码链接 ---------- */
.login-row { text-align: center; margin-top: 12px; }
.login-row a { font-size: 12.5px; color: var(--primary); cursor: pointer; }
code { background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 1px 7px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; color: var(--text); }
