:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --border: #e4e8ee;
  --border-strong: #d3d9e2;
  --text: #131a24;
  --text-2: #5a6675;
  --text-3: #909aa8;

  --primary: #1f5eff;
  --primary-dark: #1548cc;
  --primary-soft: #eaf0ff;

  --red: #d92b2b;
  --green: #10894a;
  --amber: #d97706;

  --s-inquiry: #6b7f9e;
  --s-sampling: #8b5cf6;
  --s-production: #f59e0b;
  --s-shipping: #0284c7;
  --s-completed: #10894a;

  --radius: 10px;
  --radius-sm: 7px;
  --column-bg: #eef1f5;
  --row-hover: #f7f9fc;
  --line: #f0f3f7;
  --shadow-sm: 0 1px 2px rgba(19, 26, 36, .06);
  --shadow: 0 2px 8px rgba(19, 26, 36, .07), 0 1px 2px rgba(19, 26, 36, .04);
  --shadow-lg: 0 12px 40px rgba(19, 26, 36, .16);
  --sidebar-w: 216px;
  --sidebar-bg: #ffffff;
  --sidebar-text: #3c424b;
  --sidebar-title: #121417;
  --sidebar-muted: #8b929c;
  --sidebar-hover: #f2f4f7;
  --sidebar-border: #e8ecf1;
  --on-primary: #ffffff;
  --primary-ink: #1a4fd6;
}

html[data-theme="dark"] {
  --bg: #0d1219;
  --surface: #151c26;
  --surface-2: #1b2431;
  --border: #28323f;
  --border-strong: #384452;
  --text: #e8edf4;
  --text-2: #9aa7b6;
  --text-3: #66737f;
  --column-bg: #121924;
  --row-hover: #1c2634;
  --line: #222d3a;
  --red: #f0555a;
  --green: #35c079;
  --amber: #f0a03c;
  --sidebar-bg: #1b2534;
  --sidebar-text: #9aa7b6;
  --sidebar-title: #e8edf4;
  --sidebar-muted: #66737f;
  --sidebar-hover: rgba(255, 255, 255, .07);
  --sidebar-border: rgba(255, 255, 255, .09);
  --on-primary: #ffffff;
  --primary-ink: #9ec2ff;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .25);
  --shadow: 0 2px 10px rgba(0, 0, 0, .3);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, .5);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
input, select, textarea { outline: none; }

.hidden { display: none !important; }

/* ---------------- 布局 ---------------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  border-right: 1px solid var(--sidebar-border);
}

.brand { display: flex; align-items: center; gap: 10px; padding: 0 6px 18px; }
.brand-text { flex: 1; min-width: 0; }
.brand-tools { display: flex; align-items: center; gap: 4px; margin-left: auto; flex: 0 0 auto; }
.brand-tools .tool-btn {
  width: 26px; height: 26px; border-radius: 7px;
  background: transparent; border: 1px solid transparent;
  color: var(--sidebar-muted);
}
.brand-tools .tool-btn:hover {
  background: var(--sidebar-hover); border-color: var(--sidebar-border); color: var(--sidebar-title);
}
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px;
  background: var(--primary);
  color: var(--on-primary); font-weight: 800; font-size: 13px; letter-spacing: .5px;
  display: grid; place-items: center;
  box-shadow: 0 4px 12px rgba(47, 107, 255, .35);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; flex: 1; min-width: 0; }
.brand-text strong { color: var(--sidebar-title); font-size: 14px; letter-spacing: .2px; }
.brand-text .brand-sub { font-size: 10.5px; color: var(--sidebar-muted); display: block; }

.nav { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; }
.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 10px; border-radius: 8px;
  color: var(--sidebar-text); font-size: 13px; text-align: left;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--sidebar-hover); color: var(--sidebar-title); }
.nav-item.active { background: var(--primary); color: var(--on-primary); box-shadow: 0 4px 14px color-mix(in srgb, var(--primary) 40%, transparent); }
.nav-ico { width: 16px; text-align: center; opacity: .9; font-size: 12px; }

.nav-divider { height: 1px; background: var(--sidebar-border); margin: 16px 8px; }

.stage-legend { padding: 0 8px; }
.legend-title { font-size: 10px; text-transform: uppercase; letter-spacing: .1em; color: var(--sidebar-muted); margin-bottom: 8px; }
.legend-item { display: flex; align-items: center; gap: 8px; font-size: 11.5px; padding: 3px 6px; margin: 0 -6px; color: var(--sidebar-text); border-radius: 6px; cursor: pointer; transition: background .12s; }
.legend-item:hover { background: rgba(255,255,255,.08); }
.legend-item.active { background: var(--primary); color: var(--on-primary); font-weight: 600; }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.s-inquiry { background: var(--s-inquiry); }
.s-sampling { background: var(--s-sampling); }
.s-production { background: var(--s-production); }
.s-shipping { background: var(--s-shipping); }
.s-completed { background: var(--s-completed); }

/* 侧边栏：跟进提醒工厂标签 */
#supLegendWrap { min-height: 0; }
/* 手机抽屉菜单里的跟进提醒工厂 */
.menu-sup {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  padding: 12px 10px 8px; border-top: 1px solid rgba(255,255,255,.08);
}
.menu-sup .legend-title { padding: 0 8px; }
.menu-sup .legend-item { padding: 8px 10px; margin: 0; font-size: 12.5px; }
#supplierLegend { max-height: 168px; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; scrollbar-width: thin; }
#supplierLegend::-webkit-scrollbar { width: 5px; }
#supplierLegend::-webkit-scrollbar-thumb { background: rgba(255,255,255,.16); border-radius: 3px; }
.sup-item .sup-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sup-dot { background: #5ec98a; }
.legend-count {
  flex: none; margin-left: 6px; min-width: 15px; padding: 0 5px;
  font-size: 9.5px; font-weight: 700; line-height: 15px; text-align: center;
  border-radius: 8px; background: rgba(255,255,255,.12); color: var(--sidebar-muted);
  font-variant-numeric: tabular-nums;
}
.legend-item.active .legend-count { background: rgba(0,0,0,.18); color: inherit; }

.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 6px; padding-top: 16px; }

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

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 24px;
  padding-top: calc(16px + env(safe-area-inset-top, 0px));
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 15;
}
.topbar-left h1 { font-size: 17px; font-weight: 650; letter-spacing: -.01em; }
.topbar-sub { font-size: 11.5px; color: var(--text-3); }
.topbar-right { display: flex; align-items: center; gap: 10px; }

.search-box { position: relative; }
.search-box input {
  width: 250px; padding: 8px 12px 8px 30px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2);
  transition: border .15s, box-shadow .15s, background .15s;
}
.search-box input:focus { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px var(--primary-soft); }
.search-ico { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-3); font-size: 14px; }

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: 8px; font-size: 12.5px; font-weight: 550;
  transition: background .15s, box-shadow .15s, border-color .15s, transform .08s;
  white-space: nowrap;
}
.btn:active { transform: translateY(.5px); }
.btn-primary { background: var(--primary); color: var(--on-primary); box-shadow: 0 2px 8px rgba(31, 94, 255, .28); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: var(--sidebar-hover); color: var(--sidebar-text); border: 1px solid var(--sidebar-border); }
.btn-ghost:hover { background: var(--sidebar-border); color: var(--sidebar-title); }
.btn-outline { background: #fff; color: var(--text-2); border: 1px solid var(--border-strong); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary-ink); background: var(--primary-soft); }
.btn-text { color: var(--text-2); padding: 6px 8px; }
.btn-text:hover { color: var(--primary-ink); }
.btn-danger { background: #fdecec; color: var(--red); }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-block { width: 100%; }
.btn-sm { padding: 5px 10px; font-size: 11.5px; border-radius: 6px; }

/* ---------------- 跟进提醒铃铛 ---------------- */
.bell-wrap { position: relative; }
.bell-btn {
  width: 34px; height: 34px; border-radius: 8px;
  display: grid; place-items: center;
  color: var(--text-2); border: 1px solid var(--border); background: var(--surface-2);
  transition: background .15s, border-color .15s, color .15s;
  position: relative;
}
.bell-btn:hover { background: #fff; border-color: var(--primary); color: var(--primary-ink); }
.bell-badge {
  position: absolute; top: -5px; right: -5px;
  min-width: 16px; height: 16px; padding: 0 4px;
  background: var(--red); color: #fff;
  font-size: 9.5px; font-weight: 700; border-radius: 8px;
  display: grid; place-items: center;
  border: 2px solid var(--surface);
  box-sizing: content-box;
}
.bell-panel {
  position: absolute; right: 0; top: 42px; width: 380px; max-height: 480px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow-lg); z-index: 30;
  display: flex; flex-direction: column; overflow: hidden;
}
.bell-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 14px; border-bottom: 1px solid var(--border);
  font-size: 12.5px; font-weight: 650;
}
.bell-sub { font-size: 10.5px; color: var(--text-3); font-weight: 500; }
.bell-list { overflow-y: auto; padding: 6px; }

.remind-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 9px 10px; border-radius: 8px; cursor: pointer;
  transition: background .12s;
}
.remind-item:hover { background: var(--surface-2); }
.remind-item + .remind-item { margin-top: 2px; }
.remind-ico {
  width: 30px; height: 30px; border-radius: 7px; flex: none;
  display: grid; place-items: center; font-size: 13px; margin-top: 1px;
}
.remind-ico.overdue { background: #fdecec; }
.remind-ico.urgent { background: #fff2e0; }
.remind-ico.upcoming { background: var(--primary-soft); }
.remind-main { flex: 1; min-width: 0; }
.remind-title { font-size: 12px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.remind-title .no { color: var(--primary-ink); font-size: 10.5px; font-variant-numeric: tabular-nums; }
.remind-factory {
  font-size: 11px; font-weight: 500; color: var(--text-3);
  min-width: 0; max-width: 42%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.remind-text { font-size: 11px; color: var(--text-2); margin-top: 1px; line-height: 1.45; }
.remind-days {
  flex: none; font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: 10px;
  margin-top: 2px; white-space: nowrap;
}
.remind-days.overdue { background: var(--red); color: #fff; }
.remind-days.urgent { background: #fdecd8; color: #b45309; }
.remind-days.upcoming { background: var(--primary-soft); color: var(--primary-ink); }
.bell-empty { padding: 28px 0; text-align: center; color: var(--text-3); font-size: 12px; }

/* 卡片上的提醒角标 */
.oc-remind {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 9.5px; font-weight: 700; padding: 1px 6px; border-radius: 4px;
}
.oc-remind.urgent { background: #fdecd8; color: #b45309; }
.oc-remind.upcoming { background: var(--primary-soft); color: var(--primary-ink); }

/* ---------------- 手机端看板 ---------------- */
.stage-tabs {
  display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.stage-tabs::-webkit-scrollbar { display: none; }
.stage-tab {
  flex: none; display: inline-flex; align-items: center; gap: 5px;
  padding: 8px 13px; border-radius: 20px;
  background: var(--surface); border: 1px solid var(--border);
  font-size: 12px; font-weight: 600; color: var(--text-2);
  transition: all .15s;
}
.stage-tab b {
  min-width: 16px; height: 16px; padding: 0 4px;
  background: var(--surface-2); border-radius: 8px;
  font-size: 9.5px; display: grid; place-items: center;
}
.stage-tab.active {
  background: var(--tab-color, var(--primary)); border-color: transparent; color: #fff;
  box-shadow: 0 3px 10px rgba(19, 26, 36, .15);
}
.stage-tab.active b { background: rgba(255, 255, 255, .25); color: #fff; }

.mobile-board-meta {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 4px 8px; font-size: 11px; color: var(--text-3);
}
.mobile-board-meta b { color: var(--text); }

.mobile-list { display: flex; flex-direction: column; gap: 9px; }
.mobile-list .order-card { cursor: default; }

.oc-advance { margin-top: 9px; }
.advance-btn {
  width: 100%; padding: 8px; border-radius: 7px;
  background: var(--primary-soft); color: var(--primary-ink);
  font-size: 12px; font-weight: 650;
  transition: background .15s;
}
.advance-btn:active { background: var(--primary); color: var(--on-primary); }

.icon-btn {
  width: 28px; height: 28px; border-radius: 6px; color: var(--text-3);
  display: grid; place-items: center; font-size: 13px;
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--column-bg); color: var(--text); }

/* ---------------- 视图容器 ---------------- */
.view { padding: 16px 24px 40px; flex: 1; }

/* 订单页 看板/列表 切换 */
.view-switch {
  display: inline-flex; align-items: center; gap: 2px;
  padding: 2px; margin-right: 8px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 9px;
}
.vs-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 13px; border-radius: 7px;
  font-size: 12.5px; font-weight: 550; color: var(--text-2);
  background: none; border: 0; cursor: pointer;
  transition: background .15s, color .15s;
}
.vs-btn .vs-ico { display: grid; place-items: center; opacity: .8; }
.vs-btn:hover { color: var(--text); background: var(--surface-2); }
.vs-btn.active { background: var(--primary); color: var(--on-primary); box-shadow: 0 2px 8px color-mix(in srgb, var(--primary) 30%, transparent); }
.vs-btn.active .vs-ico { opacity: 1; }

.filter-bar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 9px 14px; margin-bottom: 14px; box-shadow: var(--shadow-sm);
}
.filter-group { display: flex; align-items: center; gap: 7px; }
.filter-group label { font-size: 11.5px; color: var(--text-3); }
.filter-group select {
  border: 1px solid var(--border); border-radius: 6px; padding: 5px 8px;
  background: var(--surface-2); font-size: 12px; cursor: pointer;
}
.filter-group select:focus { border-color: var(--primary); }
.filter-summary { margin-left: auto; font-size: 11.5px; color: var(--text-3); }
.filter-summary b { color: var(--text); font-weight: 650; }

/* 工厂筛选提示条 */
.filter-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 4px 3px 9px; border-radius: 20px;
  background: var(--primary-soft); color: var(--primary-ink);
  font-size: 11.5px; font-weight: 600; max-width: 260px;
}
.filter-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filter-chip button {
  flex: none; width: 17px; height: 17px; border-radius: 50%;
  display: grid; place-items: center; font-size: 9px; line-height: 1;
  background: rgba(0,0,0,.08); border: 0; cursor: pointer; color: inherit;
}
.filter-chip button:hover { background: rgba(0,0,0,.16); }

/* ---------------- 看板 ---------------- */
.board {
  display: grid;
  grid-template-columns: repeat(5, minmax(228px, 1fr));
  gap: 12px;
  align-items: start;
}

.column {
  background: var(--column-bg);
  border-radius: var(--radius);
  padding: 0;
  display: flex; flex-direction: column;
  min-height: 160px;
  border: 1px solid #e5e9ef;
  transition: background .15s, box-shadow .15s;
}
.column.drag-over { background: var(--primary-soft); box-shadow: inset 0 0 0 2px var(--primary); }

.column-head {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid #e1e6ec;
  position: relative; z-index: 2;
  background: var(--column-bg);
  border-radius: var(--radius) var(--radius) 0 0;
}
.column-head .bar { width: 3px; height: 14px; border-radius: 2px; }
.column-title { font-size: 12.5px; font-weight: 650; letter-spacing: -.005em; }
.column-count {
  font-size: 10.5px; font-weight: 600; color: var(--text-2);
  background: #fff; border: 1px solid var(--border);
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; display: grid; place-items: center;
}
.column-amt { margin-left: auto; font-size: 11px; font-weight: 600; color: var(--text-2); font-variant-numeric: tabular-nums; }

.column-body { padding: 8px; display: flex; flex-direction: column; gap: 8px; min-height: 100px; }

.order-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 11px;
  cursor: grab;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .15s, border-color .15s, transform .12s;
  position: relative;
}
.order-card:hover { box-shadow: var(--shadow); border-color: var(--border-strong); transform: translateY(-1px); }
.order-card:active { cursor: grabbing; }
.order-card.dragging { opacity: .4; }
.order-card.p-high { border-left: 3px solid var(--red); }
.order-card.overdue { background: #fffafa; }

.oc-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 3px; }
.oc-no { font-size: 11px; font-weight: 650; color: var(--primary-ink); letter-spacing: .01em; font-variant-numeric: tabular-nums; }
.oc-priority { font-size: 9px; font-weight: 700; padding: 1px 5px; border-radius: 4px; letter-spacing: .03em; }
.oc-priority.high { background: #fdecec; color: var(--red); }
.oc-priority.low { background: #f0f2f5; color: var(--text-3); }

.oc-customer {
  font-size: 12.5px; font-weight: 600; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  margin-bottom: 2px;
}
.oc-product {
  font-size: 11px; color: var(--text-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  margin-bottom: 7px;
}

.oc-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.oc-amount { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.oc-due { font-size: 10.5px; color: var(--text-3); display: flex; align-items: center; gap: 3px; }
.oc-due.warn { color: var(--amber); font-weight: 600; }
.oc-due.late { color: var(--red); font-weight: 650; }

.oc-foot {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 8px; padding-top: 7px; border-top: 1px dashed #eceff3;
}
.oc-owner { display: flex; align-items: center; gap: 5px; font-size: 10.5px; color: var(--text-2); }
.avatar {
  width: 18px; height: 18px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 9px; font-weight: 700; color: #fff;
  letter-spacing: -.02em;
}
.oc-country { font-size: 10px; color: var(--text-3); text-transform: uppercase; letter-spacing: .03em; }

.col-empty {
  padding: 22px 8px; text-align: center; color: var(--text-3); font-size: 11px;
  border: 1px dashed #d9dfe7; border-radius: var(--radius-sm); margin: 2px;
}

/* ---------------- 表格 ---------------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.card-head { padding: 13px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.card-head h3 { font-size: 13px; font-weight: 650; }
.card-body { padding: 16px; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: 10.5px; font-weight: 650; color: var(--text-3);
  text-transform: uppercase; letter-spacing: .05em;
  padding: 10px 14px; background: var(--surface-2);
  border-bottom: 1px solid var(--border); white-space: nowrap;
  cursor: pointer; user-select: none;
}
.table th:hover { color: var(--primary-ink); }
.table th.num, .table td.num { text-align: right; }
.table td { padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 12px; vertical-align: middle; }
.table tbody tr { transition: background .12s; cursor: pointer; }
.table tbody tr:hover { background: var(--row-hover); }
.table tbody tr:last-child td { border-bottom: none; }
.td-no { font-weight: 650; color: var(--primary-ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.td-amount { font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.td-sub { font-size: 10.5px; color: var(--text-3); }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px; border-radius: 20px; font-size: 10.5px; font-weight: 600;
  white-space: nowrap;
}
.badge i { width: 5px; height: 5px; border-radius: 50%; }
.badge-inquiry { background: var(--row-hover); color: #4c5f7c; }
.badge-inquiry i { background: var(--s-inquiry); }
.badge-sampling { background: #f3edff; color: #6d3fd4; }
.badge-sampling i { background: var(--s-sampling); }
.badge-production { background: #fff6e5; color: #a35c05; }
.badge-production i { background: var(--s-production); }
.badge-shipping { background: #e6f4fd; color: #0369a1; }
.badge-shipping i { background: var(--s-shipping); }
.badge-completed { background: #e8f7ef; color: #0b7340; }
.badge-completed i { background: var(--s-completed); }

/* ---------------- 客户 ---------------- */
.customer-toolbar { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
/* 搜索无结果提示 */
.empty-hint {
  grid-column: 1 / -1; padding: 40px 20px; text-align: center;
  font-size: 12.5px; color: var(--text-3);
  background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius);
}

.customer-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }

.customer-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 15px; box-shadow: var(--shadow-sm); cursor: pointer;
  transition: box-shadow .15s, border-color .15s, transform .12s;
}
.customer-card:hover { box-shadow: var(--shadow); border-color: var(--border-strong); transform: translateY(-1px); }
.cc-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 3px; }
.cc-name { font-size: 13.5px; font-weight: 650; letter-spacing: -.01em; }
.cc-country { font-size: 11px; color: var(--text-3); margin-bottom: 10px; }
.cc-code { font-size: 10px; color: var(--text-3); font-variant-numeric: tabular-nums; background: var(--surface-2); border: 1px solid var(--border); padding: 1px 6px; border-radius: 4px; }
.cc-actions { display: inline-flex; align-items: center; gap: 4px; flex: none; }
.cc-edit:hover { background: var(--primary-soft); color: var(--primary-ink); }
.cc-del { color: #dc2626; }
.cc-del:hover { background: rgba(220, 38, 38, .12); color: #b91c1c; }

.cc-contact { font-size: 11.5px; color: var(--text-2); display: flex; flex-direction: column; gap: 3px; margin-bottom: 12px; }
.cc-contact span { display: flex; gap: 6px; align-items: center; }
.cc-contact .k { color: var(--text-3); width: 30px; flex: none; font-size: 10.5px; }

.cc-stats { display: flex; gap: 0; padding-top: 11px; border-top: 1px solid var(--border); }
.cc-stat { flex: 1; }
.cc-stat + .cc-stat { border-left: 1px solid var(--border); padding-left: 12px; }
.cc-stat b { display: block; font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.cc-stat span { font-size: 10px; color: var(--text-3); }
.cc-note { margin-top: 10px; font-size: 11px; color: var(--text-2); background: var(--surface-2); padding: 6px 9px; border-radius: 6px; border-left: 2px solid var(--border-strong); }

/* ---------------- 仪表盘 ---------------- */
.kpi-row { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
@media (max-width: 1240px) { .kpi-row { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) { .kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* 数据概览顶部：卡通人 + 问候 */
.dash-hero { text-align: center; padding: 10px 0 22px; }
.dash-mascot { display: flex; justify-content: center; margin-bottom: 10px; }
.dash-mascot svg { display: block; filter: drop-shadow(0 8px 16px rgba(31, 42, 18, .10)); }
.dash-greet { font-size: 23px; font-weight: 700; letter-spacing: -.02em; color: var(--text); }
.dash-greet-sub { margin-top: 6px; font-size: 12.5px; color: var(--text-3); }
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow-sm);
}
.kpi-label { font-size: 10.5px; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px; }
.kpi-value { font-size: 21px; font-weight: 700; letter-spacing: -.025em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.kpi-sub { font-size: 10.5px; color: var(--text-3); margin-top: 4px; }

@media (max-width: 768px) {
}

.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
.dash-remind-card { margin-bottom: 12px; }
.remind-count { font-size: 11.5px; font-weight: 600; }
.dash-remind-grid { display: grid; grid-template-columns: 1fr 1fr; column-gap: 16px; max-height: 264px; overflow-y: auto; }
.dash-remind-grid .remind-item + .remind-item { margin-top: 2px; }
.dash-remind-grid .bell-empty { grid-column: 1 / -1; }
.span-2 { grid-column: span 2; }

.bar-row { margin-bottom: 13px; }
.bar-row:last-child { margin-bottom: 0; }
.bar-label { display: flex; justify-content: space-between; font-size: 11.5px; margin-bottom: 5px; }
.bar-label b { font-variant-numeric: tabular-nums; }
.bar-track { height: 7px; background: var(--column-bg); border-radius: 4px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 4px; transition: width .4s cubic-bezier(.4, 0, .2, 1); }

.top-cust-row {
  display: flex; align-items: center; gap: 12px; padding: 9px 0;
  border-bottom: 1px solid var(--line); font-size: 12px;
}
.top-cust-row:last-child { border-bottom: none; }
.rank { width: 20px; height: 20px; border-radius: 5px; background: var(--surface-2); border: 1px solid var(--border); display: grid; place-items: center; font-size: 10px; font-weight: 700; color: var(--text-2); }
.rank.top { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }

/* ---------------- 抽屉 ---------------- */
.drawer-mask { position: fixed; inset: 0; background: rgba(16, 22, 31, .35); z-index: 40; backdrop-filter: blur(1px); }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 520px; max-width: 100vw;
  background: var(--surface); z-index: 41;
  display: flex; flex-direction: column;
  box-shadow: -8px 0 40px rgba(16, 22, 31, .18);
  animation: slideIn .22s cubic-bezier(.4, 0, .2, 1);
}
@keyframes slideIn { from { transform: translateX(30px); opacity: .4; } to { transform: none; opacity: 1; } }

.drawer-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 16px 18px;
  padding-top: calc(16px + env(safe-area-inset-top, 0px));
  border-bottom: 1px solid var(--border);
}
.drawer-eyebrow { font-size: 10.5px; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 2px; }
.drawer-head h2 { font-size: 16px; font-weight: 650; letter-spacing: -.01em; }
.drawer-body { flex: 1; overflow-y: auto; padding: 16px 18px 32px; }

.section { margin-bottom: 20px; }
.section-title { font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--text-3); margin-bottom: 9px; font-weight: 650; }

.stage-flow { display: flex; gap: 0; margin-bottom: 4px; }
.stage-step {
  flex: 1; text-align: center; padding: 8px 2px; font-size: 10.5px;
  color: var(--text-3); position: relative; cursor: pointer;
  border-top: 3px solid var(--border); transition: all .15s;
}
.stage-step:hover { color: var(--primary-ink); }
.stage-step.done { color: var(--text-2); border-top-color: #c5d2e8; }
.stage-step.current { color: var(--primary-ink); font-weight: 700; }
.stage-step.current::after {
  content: ''; position: absolute; left: 50%; top: -3px; transform: translateX(-50%);
  width: 7px; height: 7px; border-radius: 50%; background: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; }
.info-item label { display: block; font-size: 10px; color: var(--text-3); margin-bottom: 2px; }
.info-item div { font-size: 12.5px; font-weight: 550; }

.items-table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.items-table th { text-align: left; font-size: 9.5px; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; padding: 5px 6px; border-bottom: 1px solid var(--border); font-weight: 650; }
.items-table td { padding: 6px; border-bottom: 1px solid var(--line); }
.items-table .r { text-align: right; font-variant-numeric: tabular-nums; }
.items-table tfoot td { border-bottom: none; font-weight: 650; padding-top: 8px; }

.timeline { position: relative; padding-left: 18px; }
.timeline::before { content: ''; position: absolute; left: 4px; top: 5px; bottom: 5px; width: 1.5px; background: var(--border); }
.tl-item { position: relative; padding-bottom: 13px; }
.tl-item::before {
  content: ''; position: absolute; left: -18px; top: 4px;
  width: 7px; height: 7px; border-radius: 50%; background: #fff;
  border: 2px solid var(--border-strong);
}
.tl-item.type-stage::before { border-color: var(--primary); background: var(--primary); }
.tl-item.type-sample::before { border-color: var(--s-sampling); }
.tl-item.type-shipping::before { border-color: var(--s-shipping); }
.tl-meta { font-size: 10px; color: var(--text-3); display: flex; gap: 6px; margin-bottom: 1px; }
.tl-text { font-size: 12px; color: var(--text); line-height: 1.5; }

.log-form { display: flex; gap: 7px; margin-top: 10px; }
.log-form input {
  flex: 1; border: 1px solid var(--border); border-radius: 7px; padding: 7px 10px; font-size: 12px;
  background: var(--surface-2);
}
.log-form input:focus { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px var(--primary-soft); }

/* ---------------- 弹窗 ---------------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(16, 22, 31, .42); z-index: 50;
  display: grid; place-items: center; padding: 20px; backdrop-filter: blur(2px);
}
.modal {
  background: var(--surface); border-radius: 12px; width: 640px; max-width: 100%;
  max-height: 88vh; display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: popIn .18s cubic-bezier(.2,.8,.3,1);
}
@keyframes popIn { from { transform: scale(.97) translateY(6px); opacity: 0; } to { transform: none; opacity: 1; } }

.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 15px 18px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 14.5px; font-weight: 650; }
.modal-body { padding: 18px; overflow-y: auto; flex: 1; }
.modal-foot { padding: 13px 18px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; background: var(--surface-2); border-radius: 0 0 12px 12px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field.full { grid-column: span 2; }
.field label { font-size: 11px; color: var(--text-2); font-weight: 550; }
.field label .req { color: var(--red); }
.field input, .field select, .field textarea {
  border: 1px solid var(--border); border-radius: 7px; padding: 7px 10px;
  background: var(--surface-2); font-size: 12.5px; width: 100%;
  transition: border .15s, box-shadow .15s, background .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px var(--primary-soft);
}
.field textarea { resize: vertical; min-height: 56px; }

.item-editor { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.item-row { display: grid; grid-template-columns: 1.4fr .8fr 1.2fr .6fr .45fr .7fr .7fr 24px; gap: 5px; padding: 6px; align-items: center; border-bottom: 1px solid var(--line); }
.item-row.head { background: var(--surface-2); font-size: 9.5px; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; font-weight: 650; }
.item-row input { border: 1px solid transparent; background: transparent; padding: 4px 5px; font-size: 11.5px; border-radius: 4px; width: 100%; }
.item-row input:hover { background: var(--surface-2); }
.item-row input:focus { border-color: var(--primary); background: #fff; }
.item-row .del { color: var(--text-3); font-size: 12px; }
.item-row .del:hover { color: var(--red); }

.item-foot { display: flex; align-items: center; justify-content: space-between; padding: 7px 9px; background: var(--surface-2); font-size: 11.5px; }
.item-foot b { font-variant-numeric: tabular-nums; }

/* ---------------- Toast ---------------- */
.toast-wrap { position: fixed; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: #131a24; color: #fff; padding: 9px 16px; border-radius: 8px;
  font-size: 12.5px; box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
  animation: toastIn .2s ease;
}
.toast.err { background: var(--red); }
.toast.ok { background: #0d7a42; }
@keyframes toastIn { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------------- 响应式 ---------------- */
@media (max-width: 1280px) {
  .board { grid-template-columns: repeat(5, 240px); overflow-x: auto; padding-bottom: 10px; }
}
@media (max-width: 900px) {
  .sidebar { width: 60px; padding: 14px 8px; }
  .brand-text, .brand-tools, .nav-item span:not(.nav-ico), .stage-legend, #supLegendWrap, .sidebar-foot { display: none; }
  .nav-item { justify-content: center; }
  .main { margin-left: 60px; }
  .dash-grid { grid-template-columns: 1fr; }
  .dash-remind-grid { grid-template-columns: 1fr; max-height: 385px; }
  .span-2 { grid-column: span 1; }
  .search-box input { width: 140px; }
  .drawer { width: 100%; }
  .form-grid { grid-template-columns: 1fr; }
  .field.full { grid-column: span 1; }
}
@media (max-width: 768px) {
  .board { display: block; }
  /* 列表模式在手机端用卡片渲染，表头隐藏 */
  #orderTable thead { display: none; }
  /* 移动端不用 sticky（Chromium 移动模拟下 sticky 会错位遮挡内容），改为普通排列 */
  .stage-tabs { position: static; padding: 6px 0 6px; margin: 0; background: transparent; }
  .mobile-board-meta, .mobile-list .order-card { position: relative; z-index: 1; }

  /* ---- 顶部导航改为：左 logo + 右抽屉菜单，单行布局 ---- */
  .sidebar { display: none; }
  .main { margin-left: 0; margin-top: 0; }
  .topbar { top: 0; flex-wrap: nowrap; padding: 8px 10px; padding-top: calc(8px + env(safe-area-inset-top, 0px)); gap: 8px; align-items: center; }
  /* 手机端放大关闭类按钮，方便点按 */
  #drawerClose, #modalClose, .drawer-head .icon-btn, .modal-head .icon-btn {
    width: 44px; height: 44px; font-size: 22px; border-radius: 10px;
  }
  .drawer-body .icon-btn, .modal-body .icon-btn { width: 36px; height: 36px; font-size: 17px; }
  .drawer-head, .modal-head { align-items: center; }
  .topbar-left { flex: none; }
  .topbar h1, .topbar-sub { display: none; }
  .brand-mini { display: flex; }
  .brand-mini strong { display: none; }
  .brand-mini .brand-mark { width: 30px; height: 30px; font-size: 11px; }
  .topbar-right { width: auto; flex: 1; min-width: 0; }
  .search-box { flex: 1; min-width: 0; }
  .search-box input { width: 100%; padding: 7px 10px 7px 28px; }
  button.hamburger { display: grid; flex: none; }
  .bell-btn { flex: none; }
}
@media (max-width: 640px) {
  #btnNewOrder { padding: 8px 10px; }
  #newOrderLabel { display: none; }
  .search-box { flex: 1; }
  .search-box input { width: 100%; }
  .view { padding: 10px 12px 32px; }
  .info-grid { grid-template-columns: 1fr; }
  .info-item[style*="span 2"] { grid-column: span 1 !important; }
  .bell-panel {
    position: fixed; left: 8px; right: 8px; top: calc(var(--sticky-top, 136px) + 6px); width: auto; max-height: 70vh;
  }
  .filter-bar { gap: 8px; }
  .filter-group select { max-width: 110px; }
  .remind-title { flex-wrap: wrap; }
  .remind-title .badge { margin-left: 0 !important; }
  .modal { border-radius: 12px 12px 0 0; width: 100%; max-height: 92vh; position: fixed; bottom: 0; left: 0; padding-bottom: env(safe-area-inset-bottom, 0px); }
  .modal-mask { align-items: end; padding: 0; }
  .drawer { width: 100%; }
}

/* ================= 新增：工具按钮 / 抽屉菜单 / 深色补充 ================= */

.brand-mini { display: none; align-items: center; gap: 8px; }
.brand-mini .brand-mark { width: 28px; height: 28px; font-size: 10px; border-radius: 8px; }
.brand-mini strong { font-size: 14px; letter-spacing: -.01em; }
@media (max-width: 768px) { .brand-mini { display: flex; } }

.hamburger {
  display: none; width: 34px; height: 34px; border-radius: 8px;
  place-items: center; color: var(--text-2);
  border: 1px solid var(--border); background: var(--surface-2);
}
.hamburger:hover { color: var(--primary-ink); border-color: var(--primary); }

/* 侧栏底部小工具 */
.side-tools { display: flex; gap: 6px; }

/* 账户菜单（左下角） */
.user-wrap { position: relative; margin-top: 2px; }
.user-row {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 6px 8px; border-radius: 9px;
  background: none; border: 1px solid transparent;
  color: var(--sidebar-title); cursor: pointer; text-align: left;
  transition: background .15s, border-color .15s;
}
.user-row:hover { background: var(--sidebar-hover); border-color: var(--sidebar-border); }
.user-wrap.open .user-row { background: var(--sidebar-hover); border-color: var(--sidebar-border); }
.user-avatar {
  width: 30px; height: 30px; border-radius: 50%; flex: 0 0 auto;
  display: grid; place-items: center;
  font-size: 12.5px; font-weight: 650; letter-spacing: .02em;
  background: var(--sidebar-hover); color: var(--sidebar-title);
  border: 1px solid var(--sidebar-border);
}
.user-meta { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; flex: 1; }
.user-meta strong {
  font-size: 13px; font-weight: 600; color: var(--sidebar-title);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-meta span { font-size: 11px; color: var(--sidebar-muted); }
.user-caret { font-size: 9px; color: var(--sidebar-muted); transition: transform .2s; }
.user-wrap.open .user-caret { transform: rotate(180deg); }

.user-pop {
  position: absolute; left: -2px; right: -6px; bottom: calc(100% + 8px);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow-lg);
  padding: 6px; z-index: 45;
  transform-origin: bottom left;
  animation: userPopIn .14s ease-out;
}
@keyframes userPopIn {
  from { opacity: 0; transform: translateY(4px) scale(.98); }
  to { opacity: 1; transform: none; }
}
.user-pop-head { display: flex; align-items: center; gap: 10px; padding: 8px 8px 9px; }
.user-pop-head .user-avatar {
  width: 34px; height: 34px; font-size: 14px;
  background: var(--surface-2); color: var(--text); border-color: var(--border);
}
.user-pop-head .user-meta strong { font-size: 13px; color: var(--text); }
.user-pop-head .user-meta span { font-size: 11px; color: var(--text-3); }
.user-pop-sep { height: 1px; background: var(--border); margin: 4px 2px; }
.user-pop-item {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 9px 10px; border-radius: 8px;
  background: none; border: 0; cursor: pointer; text-align: left;
  font-size: 13px; color: var(--text);
  transition: background .15s, color .15s;
}
.user-pop-item:hover { background: var(--surface-2); color: var(--primary-ink); }
.user-pop-item .up-ico { width: 15px; display: grid; place-items: center; flex: 0 0 auto; }
.user-pop-item.danger { color: var(--red); }
.user-pop-item.danger:hover { background: rgba(217, 43, 43, .08); color: var(--red); }
.menu-tool-out { color: var(--sidebar-muted); }
.menu-tool-out:hover { color: var(--red); border-color: var(--red); }
.tool-btn, .menu-tool {
  width: 32px; height: 32px; border-radius: 8px;
  display: grid; place-items: center;
  color: var(--sidebar-text); background: var(--sidebar-hover);
  border: 1px solid var(--sidebar-border);
  transition: background .15s, color .15s;
}
.tool-btn:hover, .menu-tool:hover { background: var(--sidebar-hover); color: var(--sidebar-title); }
.menu-tool { width: 36px; height: 36px; }

/* 手机抽屉菜单（右侧滑出） */
.drawer-menu-mask {
  position: fixed; inset: 0; background: rgba(10, 14, 20, .5);
  z-index: 60; backdrop-filter: blur(2px);
}
.drawer-menu {
  position: fixed; top: 0; right: 0; bottom: 0; width: 272px;
  background: var(--sidebar-bg); color: var(--sidebar-text); z-index: 61;
  display: flex; flex-direction: column;
  box-shadow: -8px 0 40px rgba(0,0,0,.4);
  animation: menuIn .2s cubic-bezier(.4, 0, .2, 1);
}
@keyframes menuIn { from { transform: translateX(40px); opacity: .5; } to { transform: none; opacity: 1; } }
.menu-head {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 14px;
  padding-top: calc(16px + env(safe-area-inset-top, 0px));
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.menu-head strong { color: var(--sidebar-title); font-size: 14px; flex: 1; }
.menu-head .icon-btn { color: var(--sidebar-muted); }
.menu-head .icon-btn:hover { background: rgba(255,255,255,.1); color: #fff; }
.menu-nav { padding: 10px; display: flex; flex-direction: column; gap: 3px; }
.menu-nav .nav-item { width: 100%; justify-content: flex-start; padding: 10px 12px; }
.menu-nav .nav-item span:not(.nav-ico) { display: inline; }
.menu-foot {
  display: flex; gap: 8px; padding: 12px 14px 4px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.menu-spacer { flex: 1; }

/* 深色主题补充 */
html[data-theme="dark"] .order-card.overdue { background: #241418; }
html[data-theme="dark"] .oc-remind.upcoming { background: rgba(59, 108, 255, .16); }
html[data-theme="dark"] .oc-remind.urgent { background: rgba(240, 160, 60, .16); color: var(--amber); }
html[data-theme="dark"] .badge-inquiry { background: rgba(154, 167, 182, .15); color: #a8b4c4; }
html[data-theme="dark"] .badge-sampling { background: rgba(139, 92, 246, .18); color: #b79af9; }
html[data-theme="dark"] .badge-production { background: rgba(245, 158, 11, .16); color: #f5b04c; }
html[data-theme="dark"] .badge-shipping { background: rgba(2, 132, 199, .2); color: #5eb8ef; }
html[data-theme="dark"] .badge-completed { background: rgba(16, 137, 74, .2); color: #4cc98a; }
html[data-theme="dark"] .oc-priority.high { background: rgba(240, 85, 90, .18); color: var(--red); }
html[data-theme="dark"] .oc-priority.low { background: rgba(154, 167, 182, .14); color: var(--text-3); }
html[data-theme="dark"] .cc-note { background: var(--surface-2); border-left-color: var(--border-strong); }
html[data-theme="dark"] .rank { background: var(--surface-2); }
html[data-theme="dark"] .rank.top { background: var(--primary); border-color: var(--primary); }
html[data-theme="dark"] .advance-btn { background: rgba(59, 108, 255, .14); }
html[data-theme="dark"] .advance-btn:active { background: var(--primary); color: var(--on-primary); }
html[data-theme="dark"] .btn-outline { background: var(--surface); }
html[data-theme="dark"] .stage-tab { background: var(--surface); }
html[data-theme="dark"] .remind-ico.overdue { background: rgba(240, 85, 90, .16); }
html[data-theme="dark"] .remind-ico.urgent { background: rgba(240, 160, 60, .16); }
html[data-theme="dark"] .remind-ico.upcoming { background: rgba(59, 108, 255, .16); }
html[data-theme="dark"] .remind-days.upcoming { background: rgba(59, 108, 255, .16); }
html[data-theme="dark"] .remind-days.urgent { background: rgba(240, 160, 60, .18); color: var(--amber); }
html[data-theme="dark"] .bell-btn, html[data-theme="dark"] .hamburger { background: var(--surface-2); }
html[data-theme="dark"] .modal-foot { background: var(--surface-2); }
html[data-theme="dark"] .toast { background: #2a3442; }

/* 设置预览色板 */
.swatch-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.swatch {
  width: 26px; height: 26px; border-radius: 8px; cursor: pointer;
  border: 2px solid transparent; transition: transform .1s, border-color .15s;
}
.swatch:hover { transform: scale(1.1); }
.swatch.active { border-color: var(--text); }
.swatch-custom { width: 26px; height: 26px; padding: 0; border: 1px dashed var(--border-strong); border-radius: 8px; background: none; cursor: pointer; }
.theme-toggle { display: inline-flex; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; }
.theme-toggle button {
  padding: 7px 14px; display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text-2); background: var(--surface-2);
}
.theme-toggle button.active { background: var(--primary); color: var(--on-primary); }

/* ================= 登录页 ================= */
.login-mask {
  position: fixed; inset: 0; z-index: 100;
  display: block;
  background: #f4f6f9;
  overflow: auto;
}
.login-shell {
  display: grid;
  grid-template-columns: 1.02fr .98fr;
  width: 100%;
  min-height: 100vh;
}

/* ---- 左侧品牌区 ---- */
.login-brand {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column;
  padding: 42px 56px 46px;
  color: #eaf6f1;
  background:
    radial-gradient(115% 85% at 12% 4%, #135f4d 0%, transparent 58%),
    radial-gradient(95% 80% at 88% 98%, #0a3b31 0%, transparent 62%),
    linear-gradient(155deg, #0c3f35 0%, #072620 100%);
}
.lb-glow {
  position: absolute; border-radius: 50%; pointer-events: none;
  filter: blur(72px);
}
.lb-glow-a { width: 460px; height: 460px; right: -140px; top: -150px; background: rgba(52, 211, 153, .22); }
.lb-glow-b { width: 400px; height: 400px; left: -120px; bottom: -160px; background: rgba(20, 184, 166, .16); }

.lb-logo { position: relative; display: flex; align-items: center; gap: 10px; }
.lb-mark {
  width: 30px; height: 30px; border-radius: 9px;
  display: grid; place-items: center;
  background: linear-gradient(140deg, #4ade80 0%, #10b981 100%);
  color: #06231b; font-size: 12.5px; font-weight: 800; letter-spacing: -.02em;
  box-shadow: 0 6px 18px rgba(16, 185, 129, .35);
}
.lb-name { font-size: 14px; font-weight: 650; color: #f2fbf7; letter-spacing: .01em; }

.lb-copy { position: relative; margin: auto 0 0; max-width: 520px; }
.lb-copy h1 {
  margin: 0 0 20px;
  font-size: clamp(30px, 3.1vw, 45px);
  line-height: 1.2; font-weight: 800; letter-spacing: -.028em;
  color: #ffffff;
}
.lb-copy p {
  margin: 0; max-width: 460px;
  font-size: 13.5px; line-height: 1.78;
  color: rgba(224, 245, 237, .72);
  overflow-wrap: anywhere;
}

.lb-chips { position: relative; display: flex; flex-wrap: wrap; gap: 8px; margin: 26px 0 auto; }
.lb-chips span {
  padding: 6px 13px; border-radius: 999px;
  font-size: 11.5px; letter-spacing: .01em;
  color: rgba(233, 250, 244, .86);
  border: 1px solid rgba(255, 255, 255, .17);
  background: rgba(255, 255, 255, .06);
  backdrop-filter: blur(4px);
}

/* ---- 右侧表单区 ---- */
.login-panel {
  display: flex; align-items: center; justify-content: center;
  padding: 44px 24px;
  background: #ffffff;
}
.lp-inner { width: 100%; max-width: 356px; }
.lp-head h2 {
  margin: 0 0 8px;
  font-size: 24px; font-weight: 750; letter-spacing: -.024em;
  color: #0e1512;
}
.lp-head p { margin: 0 0 30px; font-size: 12.5px; color: #7d8894; }
.lp-label {
  display: block; margin: 0 0 7px;
  font-size: 11.5px; font-weight: 600; letter-spacing: .015em;
  color: #4b5661;
}
#loginForm input {
  width: 100%; height: 44px; padding: 0 13px; margin-bottom: 16px;
  border: 1px solid #e3e8ee; border-radius: 10px;
  background: #f7f9fa; color: #131a24;
  font-size: 13.5px; font-family: inherit;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
#loginForm input::placeholder { color: #a8b2bd; }
#loginForm input:focus {
  outline: none; border-color: #10b981; background: #ffffff;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, .13);
}
.login-err { margin: -6px 0 12px; font-size: 12px; color: #d92b2b; }

.lp-submit {
  width: 100%; height: 46px; margin-top: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; border-radius: 10px; cursor: pointer;
  background: linear-gradient(135deg, #2fd39a 0%, #10b981 100%);
  color: #ffffff; font-size: 14px; font-weight: 650; letter-spacing: .03em;
  font-family: inherit;
  box-shadow: 0 8px 20px rgba(16, 185, 129, .28);
  transition: filter .2s, box-shadow .2s, transform .12s;
}
.lp-submit:hover { filter: brightness(1.05); box-shadow: 0 10px 26px rgba(16, 185, 129, .34); }
.lp-submit:active { transform: translateY(1px); }
.lp-submit:disabled { opacity: .65; cursor: default; transform: none; }

.lp-foot { margin: 18px 0 0; text-align: center; font-size: 11.5px; color: #98a2ad; }

@media (max-width: 900px) {
  .login-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    min-height: 100vh;
  }
  .login-brand { padding: 24px 24px 28px; min-width: 0; }
  .lb-copy { margin: 24px 0 0; max-width: none; }
  .lb-copy h1 { font-size: 27px; margin-bottom: 12px; }
  .lb-copy p { font-size: 12.5px; max-width: 100%; }
  .lb-chips { display: none; }
  .login-panel {
    align-items: flex-start;
    padding: 32px 22px 46px;
    background: #ffffff;
  }
  .lp-head h2 { font-size: 21px; }
  .lp-head p { margin-bottom: 24px; }
}

/* 色号输入 */
.hex-input {
  width: 92px !important; text-align: center; font-family: ui-monospace, Menlo, monospace;
  font-size: 11.5px !important; padding: 4px 6px !important;
  border: 1px solid var(--border-strong); border-radius: 7px;
  background: var(--surface-2); text-transform: uppercase;
}

/* 数据备份弹窗 */
.bk-tip {
  font-size: 12px; color: var(--text-2); background: var(--primary-soft);
  border-radius: var(--radius-sm); padding: 8px 10px; margin-bottom: 10px;
  color: var(--primary-ink);
}
.bk-list { max-height: 320px; overflow: auto; display: flex; flex-direction: column; gap: 6px; }
.bk-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.bk-main { flex: 1; min-width: 0; }
.bk-name { font-size: 12.5px; font-weight: 600; color: var(--text); }
.bk-meta { font-size: 11px; color: var(--text-3); margin-top: 2px; font-variant-numeric: tabular-nums; }
.bk-acts { display: flex; gap: 6px; flex: none; }
.bk-empty { padding: 24px 0; text-align: center; font-size: 12.5px; color: var(--text-3); }
.bk-foot { display: flex; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.btn-sm { padding: 5px 9px; font-size: 11.5px; border-radius: 6px; }

/* 侧栏折叠时隐藏备份按钮行（抽屉里仍可用） */
@media (max-width: 900px) {
  .side-bk-row { display: none !important; }
}

/* 收款 / 发货行 */
.pay-row {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 9px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2); font-size: 12px; margin-bottom: 5px; flex-wrap: wrap;
}
.pay-type {
  font-size: 10.5px; padding: 2px 7px; border-radius: 20px;
  background: var(--primary-soft); color: var(--primary-ink); font-weight: 600; flex: none;
}
.oc-payline {
  margin-top: 6px; font-size: 11px; color: var(--amber);
  background: rgba(240, 160, 60, .12); border-radius: 6px; padding: 4px 8px;
}
.oc-payline b { font-weight: 700; }
