/* ===== Tokens ===== */
:root {
  --white: #ffffff;
  --bg: #fafafa;
  --text: #111827;
  --text-2: #6b7280;
  --text-3: #9ca3af;
  --border: #e5e7eb;
  --border-light: #f3f4f6;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-bg: rgba(37,99,235,.06);
  --green: #059669;
  --green-bg: rgba(5,150,105,.06);
  --yellow: #d97706;
  --yellow-bg: rgba(217,119,6,.06);
  --red: #dc2626;
  --red-bg: rgba(220,38,38,.06);
  --purple: #7c3aed;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.04), 0 1px 2px rgba(0,0,0,.02);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
  --sidebar-w: 220px;
}

/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-font-smoothing: antialiased; }
body { font-family: var(--font); font-size: 14px; line-height: 1.6; color: var(--text); background: var(--white); }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
.mono { font-family: var(--mono); font-size: 13px; letter-spacing: -.01em; }

/* ===== Shell ===== */
.app-shell { display: flex; min-height: 100vh; }

/* ===== Sidebar (白底 + 右边框) ===== */
.sidebar {
  width: var(--sidebar-w);
  background: var(--white);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px 12px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  flex-shrink: 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  padding: 0 8px 20px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 12px;
}

.brand-icon {
  width: 40px;
  height: 28px;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 800;
  flex-shrink: 0;
  letter-spacing: 1px;
}

/* ---- Nav ---- */
.sidebar-nav { display: flex; flex-direction: column; gap: 1px; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 6px;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  transition: all .12s;
  cursor: pointer;
}
.nav-link svg { flex-shrink: 0; opacity: .5; }
.nav-link:hover { color: var(--text); background: var(--bg); }
.nav-link:hover svg { opacity: .7; }
.nav-link.active { color: var(--accent); background: var(--accent-bg); font-weight: 600; }
.nav-link.active svg { opacity: 1; stroke: var(--accent); }

/* ---- Collapsible ---- */
.nav-group-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  border-radius: 6px;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all .12s;
  user-select: none;
}
.nav-group-title:hover { color: var(--text); background: var(--bg); }
.nav-group-title svg.caret { transition: transform .15s; opacity: .4; }
.nav-group.collapsed .nav-group-title svg.caret { transform: rotate(-90deg); }
.nav-group-content { padding-left: 16px; }
.nav-group.collapsed .nav-group-content { display: none; }
.sub-link { padding: 5px 10px; font-size: 13px; }

/* ---- Footer ---- */
.sidebar-footer { padding-top: 12px; border-top: 1px solid var(--border-light); }
.user-card { padding: 8px 10px; }
.user-card-header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.user-status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); flex-shrink: 0; box-shadow: 0 0 0 2px rgba(5,150,105,.2); }
.user-name { font-size: 13px; font-weight: 600; color: var(--text); line-height: 1.2; }
.user-role { font-size: 11px; color: var(--text-3); }
.user-login-info { display: flex; gap: 8px; flex-wrap: wrap; font-size: 10px; color: var(--text-3); margin-bottom: 6px; padding: 4px 0; font-family: var(--mono); }
.logout-link { font-size: 12px; color: var(--text-3); }
.logout-link:hover { color: var(--red); }

/* ===== Content ===== */
.content-area {
  flex: 1;
  min-width: 0;
  padding: 24px 20px;
  background: var(--white);
}

/* ===== Auth ===== */
.auth-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--white);
  padding: 32px;
}
.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 40px;
}
.auth-main { width: 100%; max-width: 380px; }
.auth-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
}
.auth-card h1 { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.auth-card .subtitle { color: var(--text-2); font-size: 13px; margin-bottom: 24px; }
.auth-card .hint { font-size: 12px; color: var(--text-3); margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border-light); line-height: 1.5; }

/* ===== Page ===== */
.page-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 28px; }
.page-title { font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.page-subtitle { color: var(--text-2); font-size: 13px; margin-top: 2px; }

/* ===== Card ===== */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
}
.card-body { padding: 20px 24px; }
.card-title { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 16px; text-transform: uppercase; letter-spacing: .02em; }

/* ===== Metrics ===== */
.metrics-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 24px; }
.metric-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
}
.metric-label { font-size: 11px; color: var(--text-2); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.metric-value { font-size: 26px; font-weight: 800; line-height: 1.3; margin: 2px 0; letter-spacing: -.02em; }
.metric-note { font-size: 12px; color: var(--text-3); }
.metric-card.brand .metric-value { color: var(--accent); }
.metric-card.success .metric-value { color: var(--green); }
.metric-card.warning .metric-value { color: var(--yellow); }
.metric-card.danger .metric-value { color: var(--red); }

/* ===== Process Grid ===== */
.process-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-bottom: 24px; }
.process-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  transition: border-color .15s, box-shadow .15s;
}
.process-card:hover { border-color: var(--brand); box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.process-card-active { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(79,70,229,.15); }
.process-card-title { font-size: 13px; font-weight: 600; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; }
.step-link { color: inherit; text-decoration: none; }
.step-link:hover { color: var(--brand); }
.process-row { display: flex; justify-content: space-between; align-items: center; padding: 3px 0; font-size: 13px; color: var(--text-2); }
.process-row-link { text-decoration: none; border-radius: 4px; padding: 4px 6px; margin: 0 -6px; cursor: pointer; transition: background .12s; }
.process-row-link:hover { background: var(--bg); }

/* ===== Sales Summary Grid ===== */
.sales-summary-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.sales-summary-card {
  display: block;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-decoration: none;
  color: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.sales-summary-card:hover { border-color: var(--accent); box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.sales-summary-card.unassigned { border-style: dashed; cursor: default; }
.sales-summary-card.unassigned:hover { border-color: var(--border); box-shadow: none; }
.sales-summary-name { font-size: 14px; font-weight: 600; margin-bottom: 10px; }
.sales-summary-stats { display: flex; gap: 16px; }
.sales-stat { display: flex; flex-direction: column; align-items: center; }
.sales-stat-num { font-size: 20px; font-weight: 700; line-height: 1.2; }
.sales-stat-num.pending { color: var(--red); }
.sales-stat-num.done { color: var(--green); }
.sales-stat-num.total { color: var(--accent); }
.sales-stat-label { font-size: 11px; color: var(--text-3); margin-top: 2px; }

/* ===== Table ===== */
.table-wrap {
  overflow-x: auto;
  margin: 0 -20px;
  padding: 0 20px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.table-wrap::-webkit-scrollbar { height: 8px; }
.table-wrap::-webkit-scrollbar-track { background: transparent; }
.table-wrap::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.table-wrap::-webkit-scrollbar-thumb:hover { background: var(--text-3); }
table { width: 100%; border-collapse: collapse; }
thead th {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-3);
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}
tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-light);
  font-size: 13px;
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--bg); }
.key-cell { font-weight: 600; }
.empty-state { text-align: center; color: var(--text-3); padding: 40px 12px !important; }

/* ===== Orders Table – fixed total width, horizontal scroll ===== */
.tbl-orders {
  border-collapse: collapse;
  table-layout: fixed;
  min-width: 1500px;
}
.tbl-orders thead th {
  padding: 7px 8px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--text-3);
  border-bottom: 2px solid var(--border);
  text-align: left;
  white-space: nowrap;
  position: relative;
}
.tbl-orders tbody td {
  padding: 5px 6px;
  border-bottom: 1px solid var(--border-light);
  font-size: 12px;
  vertical-align: middle;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tbl-orders tbody tr:last-child td { border-bottom: none; }
.tbl-orders tbody tr:hover { background: var(--bg); }
.tbl-orders .tc { text-align: center; }

/* Column resize handle */
.tbl-orders thead th .col-resizer {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  cursor: col-resize;
  background: transparent;
  transition: background .15s;
}
.tbl-orders thead th .col-resizer:hover,
.tbl-orders thead th .col-resizer.active {
  background: var(--accent);
  opacity: .4;
}

/* Stacked two-line cell (name + subtitle) */
.stk {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
  line-height: 1.35;
}
.stk-main {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
}
.stk-sub {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10px;
  color: var(--text-3);
  line-height: 1.35;
}

/* Small thumbnail */
.td-img { padding: 4px 4px !important; overflow: visible !important; }
.order-thumb-sm {
  width: 64px;
  height: 64px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid var(--border);
  display: block;
  cursor: pointer;
}
.thumb-empty-sm {
  width: 64px;
  height: 64px;
  border-radius: 6px;
  background: var(--bg);
  border: 1px dashed var(--border);
}
.thumb-placeholder-sm {
  width: 64px;
  height: 64px;
  border-radius: 6px;
  background: linear-gradient(135deg, #e8ecf1 0%, #dce1e8 100%);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: var(--text-2);
  transition: border-color .15s;
}
.thumb-placeholder-sm:hover { border-color: var(--primary); }
.thumb-placeholder-text {
  font-size: 11px;
  font-weight: 500;
  text-align: center;
  line-height: 1.3;
  word-break: break-all;
  padding: 4px;
  opacity: .7;
}

/* Hover preview overlay */
.img-preview-overlay {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0,0,0,.3), 0 0 0 1px rgba(0,0,0,.08);
  background: var(--white);
  padding: 4px;
  max-width: 320px;
  max-height: 320px;
  opacity: 0;
  transition: opacity .15s;
}
.img-preview-overlay.visible { opacity: 1; }
.img-preview-overlay img {
  display: block;
  max-width: 312px;
  max-height: 312px;
  border-radius: 6px;
  object-fit: contain;
}

/* Shop dot indicator */
.shop-dot { color: var(--accent); font-weight: 500; }

/* Numeric cell */
.cell-num { font-variant-numeric: tabular-nums; }

/* Refund flag */
.refund-flag {
  display: inline-block;
  font-style: normal;
  font-size: 9px;
  font-weight: 700;
  background: var(--red-bg);
  color: var(--red);
  padding: 0 3px;
  border-radius: 2px;
  vertical-align: middle;
  margin-left: 2px;
}

/* Detail link */
.link-detail {
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

/* Truncate cell (legacy compat) */
.cell-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
}

/* ===== Badge ===== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.6;
}
.badge-pending { background: var(--yellow-bg); color: var(--yellow); }
.badge-progress { background: var(--accent-bg); color: var(--accent); }
.badge-done { background: var(--green-bg); color: var(--green); }
.badge-danger { background: var(--red-bg); color: var(--red); }
.badge-muted { background: var(--bg); color: var(--text-2); }
.badge-process { background: var(--accent-bg); color: var(--accent); }

/* ===== Alert ===== */
.alert { padding: 10px 14px; border-radius: var(--radius); font-size: 13px; font-weight: 500; margin-bottom: 16px; }
.alert-danger { background: var(--red-bg); color: var(--red); }
.alert-success { background: var(--green-bg); color: var(--green); }
.alert-warning { background: var(--yellow-bg); color: var(--yellow); }

/* ===== Form ===== */
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 13px; font-weight: 500; color: var(--text); margin-bottom: 5px; }
.form-input, .form-select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  font-family: var(--font);
  color: var(--text);
  background: var(--white);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.form-input:focus, .form-select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
.form-input::placeholder { color: var(--text-3); }

/* ===== Button ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all .12s;
  text-decoration: none;
  line-height: 1.5;
  white-space: nowrap;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); color: #fff; }
.btn-secondary { background: var(--white); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--bg); color: var(--text); }
.btn-accent { background: #059669; color: #fff; border-color: #059669; }
.btn-accent:hover { background: #047857; color: #fff; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-full { width: 100%; }

/* ===== Toolbar ===== */
.toolbar { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.toolbar .form-group { margin-bottom: 0; flex: 1; min-width: 140px; }
.toolbar-actions { display: flex; gap: 8px; align-items: center; }

/* ===== Import Panel ===== */
.import-panel { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--border); }
.import-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ===== Layout Helpers ===== */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.row { display: flex; flex-wrap: wrap; margin: -8px; }
.row > * { padding: 8px; }
.col-4 { width: 33.333%; }
.col-6 { width: 50%; }
.col-8 { width: 66.666%; }
.col-12 { width: 100%; }

/* ===== Info Grid ===== */
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.info-item { padding: 10px 12px; border-radius: 6px; background: var(--bg); }
.info-label { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); margin-bottom: 2px; }
.info-value { font-size: 14px; font-weight: 600; }
.info-value.muted { color: var(--text-2); font-weight: 400; }

/* ===== Timeline ===== */
.timeline { display: flex; flex-direction: column; gap: 8px; }
.timeline-step {
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: 6px;
  background: var(--white);
  padding: 12px 16px;
}
.timeline-step.done { border-left-color: var(--green); }
.timeline-step.current { border-left-color: var(--accent); }
.step-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.step-title { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; }
.step-index {
  width: 22px; height: 22px;
  border-radius: 50%;
  display: inline-grid; place-items: center;
  background: var(--bg); color: var(--text-2);
  font-size: 11px; font-weight: 700; flex-shrink: 0;
}
.timeline-step.current .step-index { background: var(--accent); color: #fff; }
.timeline-step.done .step-index { background: var(--green); color: #fff; }
.step-meta { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 6px; font-size: 12px; color: var(--text-3); }

/* ===== Log ===== */
.log-list { display: flex; flex-direction: column; }
.log-item { padding: 10px 0; border-bottom: 1px solid var(--border-light); }
.log-item:last-child { border-bottom: none; }
.log-title { font-weight: 600; font-size: 13px; margin-bottom: 2px; }
.log-meta { font-size: 12px; color: var(--text-3); margin-bottom: 2px; }

/* ===== Result ===== */
.result-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 24px; }
.result-item { padding: 20px; border-radius: var(--radius); background: var(--bg); text-align: center; border: 1px solid var(--border); }
.result-value { font-size: 28px; font-weight: 800; letter-spacing: -.02em; }
.result-label { font-size: 12px; color: var(--text-2); margin-top: 2px; }

/* ===== Product Grid ===== */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}
.product-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: box-shadow .15s, border-color .15s;
}
.product-card:hover {
  border-color: var(--text-3);
  box-shadow: 0 4px 12px rgba(0,0,0,.06);
}
.product-image-wrap {
  display: block;
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--bg);
}
.product-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .2s;
}
.product-card:hover .product-image { transform: scale(1.03); }
.product-image-placeholder {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--text-3);
  font-size: 13px;
}
.product-badge-off {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(0,0,0,.6);
  color: #fff;
}
.product-info { padding: 12px 14px; }
.product-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
  color: var(--text);
  text-decoration: none;
  margin-bottom: 8px;
}
.product-title:hover { color: var(--accent); }
.product-meta { margin-bottom: 6px; }
.product-price {
  font-size: 15px;
  font-weight: 700;
  color: var(--red);
}
.product-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--text-3);
  margin-bottom: 4px;
}
.product-id-link {
  font-size: 11px;
  font-family: 'Inter', monospace;
  color: var(--text-3);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100px;
}
.product-id-link:hover { color: var(--accent); text-decoration: underline; }
.product-stock { color: var(--text-2); }
.product-cat {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 120px;
}

/* ===== View Toggle ===== */
.view-toggle { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.view-btn {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 32px; border: none; background: var(--white);
  color: var(--text-3); cursor: pointer; transition: background .15s, color .15s;
}
.view-btn:hover { background: var(--bg); color: var(--text); }
.view-btn.active { background: var(--accent); color: #fff; }

/* ===== Product List Table ===== */
.tbl-products { width: 100%; border-collapse: collapse; }
.tbl-products thead th {
  padding: 8px 8px; font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .03em; color: var(--text-3); border-bottom: 2px solid var(--border);
  text-align: left; white-space: nowrap;
}
.tbl-products tbody td {
  padding: 8px 8px; border-bottom: 1px solid var(--border-light);
  font-size: 13px; vertical-align: middle;
}
.tbl-products tbody tr:last-child td { border-bottom: none; }
.tbl-products tbody tr:hover { background: var(--bg); }
.tbl-products .tc { text-align: center; }
.tbl-products .tr { text-align: right; }
.tbl-products .cell-sub { color: var(--text-2); font-size: 12px; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-img-list { padding: 6px 8px !important; overflow: visible !important; }
.list-thumb {
  width: 64px; height: 64px; border-radius: 6px; object-fit: cover;
  border: 1px solid var(--border); display: block; cursor: pointer;
}
.list-thumb-empty {
  width: 64px; height: 64px; border-radius: 6px;
  background: var(--bg); border: 1px dashed var(--border);
  display: grid; place-items: center; font-size: 11px; color: var(--text-3);
}
.product-list-title {
  font-size: 13px; font-weight: 500; color: var(--text); text-decoration: none;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; line-height: 1.5;
}
.product-list-title:hover { color: var(--accent); }

/* ===== SKU Strip (Card mode) ===== */
.sku-strip {
  display: flex; gap: 4px; padding: 6px 10px; overflow-x: auto;
  border-top: 1px solid var(--border-light); background: var(--bg);
}
.sku-strip::-webkit-scrollbar { height: 4px; }
.sku-strip::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.sku-thumb {
  width: 36px; height: 36px; border-radius: 4px; object-fit: cover; flex-shrink: 0;
  border: 1px solid var(--border); cursor: pointer; transition: border-color .15s;
}
.sku-thumb:hover { border-color: var(--accent); }
.sku-more {
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 36px; height: 36px; border-radius: 4px; background: var(--border-light);
  font-size: 11px; color: var(--text-3); font-weight: 600;
}

/* SKU Strip (List/table mode) */
.sku-strip-inline { display: flex; gap: 3px; align-items: center; }
.sku-thumb-sm {
  width: 32px; height: 32px; border-radius: 4px; object-fit: cover; flex-shrink: 0;
  border: 1px solid var(--border); cursor: pointer; transition: border-color .15s;
}
.sku-thumb-sm:hover { border-color: var(--accent); }
.sku-more-sm {
  font-size: 10px; color: var(--text-3); font-weight: 600; padding-left: 2px;
}

/* SKU Gallery (detail page) */
.sku-gallery {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 12px;
}
.sku-gallery-item { text-align: center; }
.sku-gallery-img {
  width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px;
  border: 1px solid var(--border); cursor: pointer; transition: border-color .15s;
}
.sku-gallery-img:hover { border-color: var(--accent); }
.sku-gallery-label {
  display: block; margin-top: 4px; font-size: 11px; color: var(--text-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* SKU in table (detail page) */
.sku-table-img {
  width: 52px; height: 52px; border-radius: 6px; object-fit: cover;
  border: 1px solid var(--border); cursor: pointer; display: block;
}
.sku-table-img:hover { border-color: var(--accent); }
.sku-table-empty {
  width: 52px; height: 52px; border-radius: 6px; background: var(--bg);
  border: 1px dashed var(--border); display: grid; place-items: center;
  font-size: 11px; color: var(--text-3);
}

/* ===== Product Gallery ===== */
.product-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
}
.gallery-item {
  aspect-ratio: 1;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg);
}
.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: pointer;
  transition: transform .2s;
}
.gallery-item img:hover { transform: scale(1.05); }

/* ===== Detail Info List ===== */
.detail-info-list { display: flex; flex-direction: column; gap: 12px; }
.detail-info-item { }
.detail-info-item .info-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-3);
  margin-bottom: 2px;
}
.detail-info-item .info-value { font-size: 14px; font-weight: 500; }

/* ===== Price Tiers ===== */
.price-tiers { display: flex; flex-direction: column; gap: 6px; }
.price-tier {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--bg);
  border-radius: 6px;
  font-size: 13px;
}
.tier-qty { color: var(--text-2); }
.tier-price { font-weight: 700; color: var(--red); }

/* ===== Search Form ===== */
.search-form .search-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
}
.search-form .search-row .form-group { margin-bottom: 0; }
.search-form .search-main { flex: 1; min-width: 240px; }

/* 库存等列表：每页条数单独一行，避免被搜索行挤掉不显眼 */
.inv-per-page-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding: 12px 14px;
  background: var(--bg);
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
}
.inv-per-page-row .form-label { margin: 0; font-weight: 600; color: var(--text); }
.inv-per-page-row .form-select { min-width: 132px; max-width: 100%; }

/* ===== Pagination ===== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  border-top: 1px solid var(--border-light);
  margin-top: 8px;
  gap: 16px;
  flex-wrap: wrap;
}
.pagination-info {
  font-size: 12px;
  color: var(--text-3);
  white-space: nowrap;
}
.pagination-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}
.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  background: var(--white);
  text-decoration: none;
  transition: all .12s;
  cursor: pointer;
  white-space: nowrap;
}
.page-btn:hover:not(.disabled):not(.active) {
  background: var(--bg);
  color: var(--text);
  border-color: var(--text-3);
}
.page-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  font-weight: 600;
  cursor: default;
}
.page-btn.disabled {
  color: var(--text-3);
  opacity: .4;
  cursor: not-allowed;
}
.page-ellipsis {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 32px;
  font-size: 12px;
  color: var(--text-3);
}

/* ===== Order Thumbnails (detail page) ===== */
.order-thumb-wrap { display: block; }
.order-thumb {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid var(--border);
  transition: transform .15s;
  cursor: pointer;
}
.order-thumb:hover { transform: scale(2.8); z-index: 100; position: relative; box-shadow: 0 4px 20px rgba(0,0,0,.25); }
.order-thumb-empty {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  background: var(--bg);
  border: 1px dashed var(--border);
}

/* ===== Shop Tag ===== */
.shop-tag {
  display: inline-block;
  padding: 2px 8px;
  background: rgba(99,102,241,.1);
  color: var(--accent);
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===== Sortable Table Header ===== */
.sortable-th {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.sortable-th:hover { color: var(--accent); }
.sort-arrow { font-size: 10px; margin-left: 2px; }
.sort-arrow.muted { opacity: .3; font-size: 9px; }

/* ===== Inline Edit Controls ===== */
.inline-select {
  padding: 2px 2px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--text);
  font-size: 11px;
  font-family: var(--font);
  cursor: pointer;
  width: 100%;
  max-width: 100%;
  transition: border-color .15s, background .15s;
}
.inline-select:hover { border-color: var(--border); background: var(--bg); }
.inline-select:focus { border-color: var(--accent); outline: none; background: var(--white); }
.inline-select.saving { opacity: .5; }
.inline-select.save-ok { border-color: #22c55e; background: rgba(34,197,94,.08); }

.inline-input {
  padding: 2px 4px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--text);
  font-size: 11px;
  font-family: var(--font);
  width: 100%;
  max-width: 100%;
  transition: border-color .15s, background .15s;
}
.inline-input:hover { border-color: var(--border); background: var(--bg); }
.inline-input:focus { border-color: var(--accent); outline: none; background: var(--white); }
.inline-input.saving { opacity: .5; }
.inline-input.save-ok { border-color: #22c55e; background: rgba(34,197,94,.08); }
.inline-input::placeholder { color: var(--text-3); font-style: italic; }

.order-type-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
}
.type-custom { background: rgba(234,88,12,.1); color: #ea580c; }
.type-stock { background: rgba(34,197,94,.1); color: #16a34a; }
.type-oos { background: rgba(220,38,38,.1); color: #dc2626; }
.type-fake { background: rgba(139,92,246,.1); color: #7c3aed; }

.remark-text {
  font-size: 12px;
  color: var(--text-2);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
}

/* ===== Batch Operations Bar ===== */
.batch-bar {
  position: sticky;
  top: 0;
  z-index: 50;
  margin-bottom: 16px;
}
.batch-bar-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  background: var(--accent);
  color: #fff;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 4px 16px rgba(0,0,0,.15);
  flex-wrap: wrap;
}
.batch-select {
  padding: 4px 8px;
  border: 1px solid rgba(255,255,255,.3);
  border-radius: 6px;
  background: rgba(255,255,255,.15);
  color: #fff;
  font-size: 12px;
  cursor: pointer;
}
.batch-select option { color: #333; background: #fff; }
.btn-danger {
  background: #dc2626;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.btn-danger:hover { background: #b91c1c; }
.btn-danger:disabled { opacity: .6; cursor: not-allowed; }

tr.row-selected { background: rgba(99,102,241,.08); }
tr.row-selected:hover { background: rgba(99,102,241,.12); }

table input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--accent);
}

/* ===== Per-page Select ===== */
.per-page-select {
  margin-left: 16px;
  font-size: 12px;
  color: var(--text-2);
}
.per-page-select select {
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-1);
  font-size: 12px;
  cursor: pointer;
}

/* ===== Customer Table ===== */
.tbl-customers { width: 100%; border-collapse: collapse; min-width: 1400px; table-layout: auto; }
.tbl-customers thead th {
  padding: 10px 12px; font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .03em; color: var(--text-3); border-bottom: 2px solid var(--border);
  text-align: left; white-space: nowrap;
}
.tbl-customers tbody td {
  padding: 9px 12px; border-bottom: 1px solid var(--border-light);
  font-size: 13px; vertical-align: middle; white-space: nowrap;
}
.tbl-customers tbody tr:last-child td { border-bottom: none; }
.tbl-customers tbody tr:hover { background: var(--bg); }
.tbl-customers .tc { text-align: center; }
.tbl-customers .tr { text-align: right; }
.tbl-customers .cell-sub { color: var(--text-2); font-size: 12px; max-width: 140px; overflow: hidden; text-overflow: ellipsis; }
.tbl-customers .cell-ellipsis { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tbl-customers .cust-name-cell { font-weight: 600; }
.tbl-customers .cust-name-cell a { color: var(--text); text-decoration: none; }
.tbl-customers .cust-name-cell a:hover { color: var(--accent); }
.tbl-customers .sortable-th { cursor: pointer; user-select: none; }
.tbl-customers .wechat-check { width: 16px; height: 16px; cursor: pointer; accent-color: #22c55e; }

/* Batch bar shared extras */
.batch-bar-inner .batch-info { white-space: nowrap; }
.batch-bar-inner .batch-ops { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.batch-bar-inner .batch-ops label { display: flex; align-items: center; gap: 4px; font-size: 12px; color: #fff; }
.batch-bar-inner .form-select-sm { padding: 3px 6px; font-size: 12px; border-radius: 6px; background: rgba(255,255,255,.15); color: #fff; border: 1px solid rgba(255,255,255,.3); }
.batch-bar-inner .form-select-sm option { color: #333; background: #fff; }
.batch-bar-inner .btn-sm { padding: 4px 12px; font-size: 12px; border-radius: 6px; cursor: pointer; }
.batch-bar-inner .btn-sm.btn-primary { background: #fff; color: var(--accent); border: none; font-weight: 600; }
.batch-bar-inner .btn-sm.btn-secondary { background: rgba(255,255,255,.2); color: #fff; border: 1px solid rgba(255,255,255,.3); }

/* Color dot & picker */
.color-picker-wrap { position: relative; display: inline-block; }
.color-dot {
  display: inline-block; width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid var(--white); box-shadow: 0 0 0 1px rgba(0,0,0,.1);
  cursor: pointer; transition: transform .15s;
}
.color-dot:hover { transform: scale(1.2); }
.color-picker-popup {
  position: absolute; top: 28px; left: 50%; transform: translateX(-50%);
  z-index: 100; background: var(--white); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 8px; gap: 4px; flex-wrap: wrap;
  box-shadow: 0 8px 24px rgba(0,0,0,.12); min-width: 160px;
  display: flex; justify-content: center;
}
.color-opt {
  width: 20px; height: 20px; border-radius: 50%; cursor: pointer;
  border: 2px solid transparent; transition: transform .1s, border-color .1s;
}
.color-opt:hover { transform: scale(1.25); }
.color-opt.active { border-color: var(--text); }

/* Level tag */
.level-tag {
  display: inline-block; padding: 2px 8px; border-radius: 4px;
  font-size: 11px; font-weight: 500; background: var(--bg); color: var(--text-2);
}

/* ===== Chart Containers ===== */
.chart-box { position: relative; height: 320px; }
.chart-box canvas { width: 100% !important; height: 100% !important; }
.chart-box-sm { position: relative; height: 260px; }
.chart-box-sm canvas { width: 100% !important; height: 100% !important; }
.chart-box-tall { position: relative; height: 360px; margin-bottom: 16px; }
.chart-box-tall canvas { width: 100% !important; height: 100% !important; }

/* Stat mini-table */
.stat-table-wrap { max-height: 400px; overflow-y: auto; }
.stat-table { width: 100%; border-collapse: collapse; }
.stat-table thead th {
  font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em;
  color: var(--text-3); padding: 4px 8px; border-bottom: 1px solid var(--border);
  text-align: left; white-space: nowrap; position: sticky; top: 0; background: var(--white);
}
.stat-table tbody td { padding: 4px 8px; font-size: 12px; border-bottom: 1px solid var(--border-light); }
.stat-table tbody tr:hover { background: var(--bg); }
.stat-name {
  max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block;
}

/* ===== Buyer Stats Grid ===== */
.buyer-stats-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.buyer-stat-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  text-decoration: none;
  min-width: 120px;
  max-width: 200px;
  transition: border-color .15s, background .15s;
}
.buyer-stat-item:hover {
  border-color: var(--accent);
  background: var(--accent-bg);
}
.buyer-stat-item.active {
  border-color: var(--accent);
  background: var(--accent-bg);
  box-shadow: 0 0 0 2px rgba(37,99,235,.12);
}
.buyer-stat-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.buyer-stat-nums {
  display: flex;
  gap: 8px;
  font-size: 11px;
}
.buyer-stat-count {
  color: var(--accent);
  font-weight: 600;
}
.buyer-stat-qty {
  color: var(--text-3);
}

/* Hidden helper */
.hidden { display: none !important; }

/* ===== Inventory ===== */
.inv-stats-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.inv-stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}
.inv-stat-label { font-size: 12px; color: var(--text-3); margin-bottom: 4px; }
.inv-stat-value { font-size: 24px; font-weight: 700; color: var(--text); }
.inv-stat-warning { border-color: var(--yellow); background: var(--yellow-bg); }
.inv-stat-warning .inv-stat-value { color: var(--yellow); }
.inv-stat-danger { border-color: var(--red); background: var(--red-bg); }
.inv-stat-danger .inv-stat-value { color: var(--red); }

.tbl-inventory { width: 100%; table-layout: auto; }
.tbl-inventory-logs { width: 100%; table-layout: auto; }

.inv-row-warning { background: var(--yellow-bg) !important; }
.inv-row-danger { background: var(--red-bg) !important; }

.inv-badge-ok { background: var(--green-bg); color: var(--green); font-weight: 600; }
.inv-badge-warning { background: var(--yellow-bg); color: var(--yellow); font-weight: 600; }
.inv-badge-danger { background: var(--red-bg); color: var(--red); font-weight: 600; }
.inv-badge-out { background: var(--red-bg); color: var(--red); }
.badge-primary { background: var(--accent-bg); color: var(--accent); }

.text-warning { color: var(--yellow); font-weight: 600; }
.text-danger { color: var(--red); font-weight: 600; }
.text-success { color: var(--green); }

.tc { text-align: center; }

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0,0,0,.35);
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-box {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
  width: 460px;
  max-width: 92vw;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.modal-title { font-size: 18px; font-weight: 700; margin: 0; }
.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--bg);
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-2);
  transition: background .15s;
}
.modal-close:hover { background: var(--border); }

/* Inventory thumbnails */
.inv-thumb {
  width: 44px;
  height: 44px;
  border-radius: 4px;
  object-fit: cover;
  border: 1px solid var(--border);
  display: block;
}
.inv-thumb-empty {
  width: 44px;
  height: 44px;
  border-radius: 4px;
  background: var(--bg);
  border: 1px dashed var(--border);
}

/* Image zoom (click to enlarge) */
.img-zoomable { cursor: zoom-in; transition: opacity .15s; }
.img-zoomable:hover { opacity: .85; }
.img-zoom-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,.7); display: flex;
  align-items: center; justify-content: center;
  cursor: zoom-out; backdrop-filter: blur(4px);
}
.img-zoom-full {
  max-width: 90vw; max-height: 90vh;
  border-radius: 8px; box-shadow: 0 8px 40px rgba(0,0,0,.4);
  object-fit: contain;
}

/* Top 3 cards */
.top3-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
.top3-card {
  background: var(--white);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  gap: 16px;
  align-items: center;
  position: relative;
  overflow: hidden;
}
.top3-rank-1 { border-color: #f59e0b; background: linear-gradient(135deg, #fffbeb 0%, #fff 60%); }
.top3-rank-2 { border-color: #94a3b8; background: linear-gradient(135deg, #f1f5f9 0%, #fff 60%); }
.top3-rank-3 { border-color: #d97706; background: linear-gradient(135deg, #fef3c7 0%, #fff 60%); }
.top3-rank {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  color: white;
  background: var(--accent);
}
.top3-rank-1 .top3-rank { background: #f59e0b; }
.top3-rank-2 .top3-rank { background: #94a3b8; }
.top3-rank-3 .top3-rank { background: #d97706; }
.top3-img-wrap { flex-shrink: 0; }
.top3-img {
  width: 72px;
  height: 72px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--border);
}
.top3-img-empty {
  width: 72px;
  height: 72px;
  border-radius: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-3);
}
.top3-info { flex: 1; min-width: 0; }
.top3-name {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}
.top3-sales { font-size: 13px; color: var(--text-2); margin-bottom: 4px; }
.top3-sales strong { font-size: 20px; color: var(--accent); }
.top3-meta { font-size: 12px; color: var(--text-3); display: flex; gap: 12px; }

/* Rank badges */
.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 800;
  color: white;
}
.rank-1 { background: #f59e0b; }
.rank-2 { background: #94a3b8; }
.rank-3 { background: #d97706; }
.rank-num { font-size: 13px; color: var(--text-3); font-weight: 600; }

/* Status tags */
.status-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}
.status-ok { background: var(--green-bg); color: var(--green); }
.status-warning { background: var(--yellow-bg); color: var(--yellow); }
.status-danger { background: var(--red-bg); color: var(--red); }

/* QR Code grid */
.qr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.qr-select { cursor: pointer; display: block; }
.qr-select input { display: none; }
.qr-card {
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  transition: border-color .15s, box-shadow .15s;
  text-align: center;
}
.qr-select input:checked + .qr-card {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}
.qr-img-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 8px;
}
.qr-product-img {
  width: 56px;
  height: 56px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid var(--border);
}
.qr-code-img {
  width: 80px;
  height: 80px;
}
.qr-label { text-align: center; }
.qr-name {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}
.qr-pid  { font-size: 11px; color: #e65100; font-weight: 600; margin-bottom: 2px; font-family: monospace; letter-spacing: .5px; }
.qr-spec { font-size: 11px; color: var(--text-2); margin-bottom: 2px; }
.qr-meta { font-size: 10px; color: var(--text-3); display: flex; gap: 8px; justify-content: center; }

/* ===== Role management ===== */
.role-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 16px; }
.role-card { border-left: 3px solid var(--accent); }
.perm-matrix { display: flex; flex-direction: column; gap: 4px; }
.perm-row { display: flex; align-items: center; gap: 8px; padding: 3px 0; }
.perm-mod-name { width: 72px; font-size: 12px; font-weight: 500; color: var(--text-2); flex-shrink: 0; }
.perm-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.perm-tag { display: inline-block; padding: 1px 6px; border-radius: 3px; font-size: 10px; }
.perm-on { background: rgba(5,150,105,.12); color: #059669; }
.perm-off { background: var(--bg); color: var(--text-3); }

.perm-editor { border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.perm-editor-row { display: flex; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--border); }
.perm-editor-row:last-child { border-bottom: none; }
.perm-editor-row:nth-child(even) { background: var(--bg); }
.perm-editor-mod { width: 80px; flex-shrink: 0; }
.perm-editor-acts { display: flex; flex-wrap: wrap; gap: 12px; }
.perm-cb-label { display: flex; align-items: center; gap: 4px; font-size: 12px; cursor: pointer; }

/* ===== Product Tags ===== */
.tag { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 11px; line-height: 18px; font-weight: 500; }
.tag-festival { background: #fff3e0; color: #e65100; border: 1px solid #ffcc80; }
.tag-boxtype { background: #e8f5e9; color: #2e7d32; border: 1px solid #a5d6a7; }

/* Card checkbox overlay */
.product-check-wrap {
  position: absolute; top: 8px; left: 8px; z-index: 5;
  width: 22px; height: 22px; display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.85); border-radius: 4px; cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,.12);
  opacity: 0; transition: opacity .15s;
}
.product-card { position: relative; }
.product-card:hover .product-check-wrap,
.product-check-wrap:has(input:checked) { opacity: 1; }
.product-check-wrap input { cursor: pointer; width: 16px; height: 16px; }

/* ===== Customer Tags ===== */
.tag-cell { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.cust-tag {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  background: var(--accent-bg, #ede9fe);
  color: var(--accent, #7c3aed);
  white-space: nowrap;
  line-height: 1.5;
}
.cust-tag-x {
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  margin-left: 1px;
  opacity: .5;
  transition: opacity .15s;
}
.cust-tag-x:hover { opacity: 1; color: var(--red); }
.cust-tag-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px dashed var(--border);
  font-size: 14px;
  color: var(--text-3);
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.cust-tag-add:hover { border-color: var(--accent); color: var(--accent); }

/* Tag Picker */
.tag-picker-popup {
  position: absolute;
  z-index: 200;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 6px 20px rgba(0,0,0,.12);
  padding: 10px;
  width: 240px;
}
.tag-picker-list { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 8px; }
.tag-picker-opt {
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  background: var(--bg);
  color: var(--text-2);
  cursor: pointer;
  transition: background .15s, color .15s;
}
.tag-picker-opt:hover { background: var(--accent-bg); color: var(--accent); }
.tag-picker-input-wrap { display: flex; gap: 6px; }
.tag-picker-input-wrap .form-input { flex: 1; padding: 4px 8px; }

/* Remark Modal */
.remark-cell {
  cursor: pointer;
  min-height: 24px;
  padding: 2px 4px;
  border-radius: 4px;
  transition: background .15s;
}
.remark-cell:hover { background: var(--bg); }
.remark-preview {
  font-size: 12px;
  color: var(--text-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-all;
  max-width: 180px;
}
.remark-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
}
.remark-modal {
  background: var(--white);
  border-radius: var(--radius);
  padding: 24px;
  width: 480px;
  max-width: 90vw;
  box-shadow: 0 12px 40px rgba(0,0,0,.18);
}
.remark-modal-title { font-size: 15px; font-weight: 600; margin-bottom: 12px; }
.remark-textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.6;
  resize: vertical;
  font-family: inherit;
}
.remark-textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124,58,237,.1); }
.remark-modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }

/* ===== Analytics Filters ===== */
.analytics-filters {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px 16px;
  align-items: end;
}
.filter-group { display: flex; flex-direction: column; gap: 4px; }
.filter-label { font-size: 12px; font-weight: 500; color: var(--text-2); }
.filter-date-range { display: flex; align-items: center; gap: 6px; }
.filter-date-range input { flex: 1; min-width: 0; }
.filter-sep { color: var(--text-3); font-size: 13px; }
.form-input-sm, .form-select-sm { font-size: 13px; padding: 5px 8px; height: 32px; }
.active-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border-light); align-items: center; }
.active-filters-label { font-size: 12px; color: var(--text-3); margin-right: 4px; }
.active-filter-chip {
  display: inline-flex;
  font-size: 12px;
  padding: 2px 10px;
  background: var(--accent-bg);
  color: var(--accent);
  border-radius: 12px;
  font-weight: 500;
}

/* ===== Analytics Metrics ===== */
.analytics-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.metric-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  transition: box-shadow .15s;
}
.metric-card:hover { box-shadow: var(--shadow); }
.metric-value { font-size: 20px; font-weight: 700; color: var(--text); font-family: var(--mono); }
.metric-label { font-size: 12px; color: var(--text-2); margin-top: 4px; }
.metric-card.accent .metric-value { color: var(--accent); }
.metric-card.green .metric-value { color: var(--green); }
.metric-card.orange .metric-value { color: var(--yellow); }

/* ===== Analytics Table ===== */
.tbl-analytics { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl-analytics th { background: var(--bg); font-weight: 600; font-size: 12px; text-transform: none; color: var(--text-2); padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; text-align: left; }
.tbl-analytics td { padding: 8px 10px; border-bottom: 1px solid var(--border-light); vertical-align: middle; }
.tbl-analytics tbody tr:hover { background: var(--bg); }
.tbl-analytics .tr { text-align: right; }
.tbl-analytics .tc { text-align: center; }
.cust-name-link { color: var(--accent); text-decoration: none; font-weight: 500; }
.cust-name-link:hover { text-decoration: underline; }
.level-badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; background: var(--accent-bg); color: var(--accent); font-weight: 500; }
.cust-tag-sm { display: inline-block; padding: 1px 6px; border-radius: 8px; font-size: 11px; background: #f3f4f6; color: var(--text-2); margin-right: 3px; margin-bottom: 2px; }
.text-green { color: var(--green); }
.text-red { color: var(--red); }

/* ===== Logistics type tags ===== */
.logistics-tag { display: inline-block; padding: 2px 8px; border-radius: 8px; font-size: 10px; font-weight: 600; margin-top: 2px; letter-spacing: 0.3px; }
.lt-real { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.lt-custom { background: #fef2f2; color: #dc2626; border: 1px solid #fca5a5; animation: customBlink 2s ease-in-out infinite; }
@keyframes customBlink { 0%,100%{ opacity:1 } 50%{ opacity:.65 } }
.td-custom-logistics { background: #fef2f2 !important; }
.logistics-type-select { width: 90px; font-size: 11px; margin-top: 3px; padding: 1px 4px; border: 1px solid var(--border); border-radius: 4px; background: #fff; }

/* ===== Modal base ===== */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.45); z-index: 9000; display: flex; align-items: center; justify-content: center; }
.modal-box { background: #fff; border-radius: 12px; box-shadow: 0 20px 60px rgba(0,0,0,0.25); display: flex; flex-direction: column; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-close { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--text-2); padding: 4px 8px; border-radius: 4px; }
.modal-close:hover { background: var(--surface-hover); }
.modal-body { flex: 1; overflow-y: auto; }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--border); }

/* ===== Manual order form ===== */
.manual-form-grid { display: flex; flex-direction: column; gap: 20px; }
.mf-section { background: var(--surface); border-radius: 8px; padding: 14px 16px; border: 1px solid var(--border); }
.mf-section-title { font-size: 13px; font-weight: 600; color: var(--accent); margin-bottom: 12px; padding-bottom: 6px; border-bottom: 1px solid #e5e7eb; }
.mf-row { display: flex; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.mf-row:last-child { margin-bottom: 0; }
.mf-field { flex: 1; min-width: 160px; }
.mf-field .form-label { font-size: 12px; margin-bottom: 4px; display: block; font-weight: 500; }
.mf-hint { font-size: 11px; color: var(--text-3); margin-top: 4px; }

/* Image upload area */
.mo-images-area { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; padding: 10px; background: #f9fafb; border: 2px dashed #d1d5db; border-radius: 8px; min-height: 90px; }
.mo-images-list { display: flex; flex-wrap: wrap; gap: 10px; }
.mo-image-item { position: relative; width: 80px; height: 80px; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); background: #fff; }
.mo-image-item img { width: 100%; height: 100%; object-fit: cover; }
.mo-image-rm { position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; border-radius: 50%; background: rgba(0,0,0,0.6); color: #fff; border: none; font-size: 14px; line-height: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.mo-image-rm:hover { background: var(--red); }
.mo-image-add { width: 80px; height: 80px; border-radius: 8px; border: 1px dashed #9ca3af; display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; color: var(--text-3); transition: all 0.15s; }
.mo-image-add:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-bg); }
.mo-image-add span { font-size: 24px; line-height: 1; }
.mo-image-add small { font-size: 10px; margin-top: 2px; }

/* Manual order tag in order list */
.manual-tag { display: inline-block; padding: 1px 6px; border-radius: 8px; font-size: 10px; font-weight: 500; background: #ede9fe; color: #6d28d9; }

/* ===== Timezone clocks ===== */
.tz-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; }
.tz-card { text-align: center; padding: 12px 8px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); transition: box-shadow 0.15s; }
.tz-card:hover { box-shadow: 0 2px 12px rgba(0,0,0,0.08); }

/* Calendar v2 — Tabs */
.cal-tabs { display: flex; gap: 4px; background: var(--bg-2); padding: 3px; border-radius: 10px; }
.cal-tab { padding: 5px 14px; border: none; background: none; font-size: 13px; font-weight: 600; color: var(--text-2); cursor: pointer; border-radius: 8px; transition: all .15s; white-space: nowrap; }
.cal-tab:hover { color: var(--text-1); }
.cal-tab.active { background: var(--card-bg); color: var(--accent); box-shadow: 0 1px 4px rgba(0,0,0,.08); }

/* Calendar v2 — Upcoming chips */
.upcoming-scroll { display: flex; gap: 8px; flex-wrap: wrap; }
.upcoming-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 20px; font-size: 12px; font-weight: 500; background: #fff; border: 1px solid var(--border); transition: all .15s; }
.upcoming-chip:hover { box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.upcoming-chip.level-s { border-color: #fca5a5; background: #fef2f2; }
.upcoming-chip.level-a { border-color: #fdba74; background: #fff7ed; }
.upcoming-chip.level-b { border-color: #93c5fd; background: #eff6ff; }
.upcoming-chip.level-c { border-color: #86efac; background: #f0fdf4; }
.upcoming-chip-date { font-weight: 700; color: var(--text-1); font-family: 'Inter', monospace; }
.upcoming-chip-name { color: var(--text-1); }

/* Calendar v2 — Holiday/Event card grid */
.hol-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }
.hol-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 10px; transition: all .18s; }
.hol-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.07); transform: translateY(-1px); }
.hol-card.level-s { border-left: 4px solid #dc2626; }
.hol-card.level-a { border-left: 4px solid #ea580c; }
.hol-card.level-b { border-left: 4px solid #3b82f6; }
.hol-card.level-c { border-left: 4px solid #22c55e; }
.hol-card-head { display: flex; gap: 12px; align-items: flex-start; }
.hol-date-col { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 52px; }
.hol-day { font-size: 22px; font-weight: 800; color: var(--text-1); line-height: 1.1; }
.hol-title-col { flex: 1; min-width: 0; }
.hol-name { font-size: 14px; font-weight: 700; color: var(--text-1); margin-bottom: 3px; line-height: 1.3; }
.hol-countries { font-size: 12px; color: var(--text-2); }
.hol-products { display: flex; gap: 6px; align-items: flex-start; font-size: 12px; color: var(--accent); line-height: 1.5; padding: 8px 10px; background: rgba(59,130,246,.04); border-radius: 8px; }

/* Calendar v2 — Notes */
.hol-notes { display: flex; flex-direction: column; gap: 6px; }
.hol-note { padding: 8px 10px; background: #fefce8; border: 1px solid #fde68a; border-radius: 8px; font-size: 12px; animation: noteIn .3s; }
.hol-note-new { animation: noteIn .4s; }
@keyframes noteIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.hol-note-text { color: var(--text-1); line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.hol-note-meta { display: flex; gap: 8px; align-items: center; margin-top: 4px; font-size: 11px; color: var(--text-3); }
.hol-note-del { border: none; background: none; color: var(--text-3); cursor: pointer; font-size: 14px; line-height: 1; padding: 0 2px; margin-left: auto; }
.hol-note-del:hover { color: var(--red); }
.hol-note-add { display: flex; gap: 6px; }
.hol-note-input { flex: 1; padding: 5px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 12px; background: var(--bg-1); transition: border-color .15s; }
.hol-note-input:focus { border-color: var(--accent); outline: none; }
.hol-note-btn { border: none; background: var(--accent); color: #fff; width: 30px; height: 30px; border-radius: 8px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: opacity .15s; flex-shrink: 0; }
.hol-note-btn:hover { opacity: .85; }

/* Calendar v2 — Timezone cards */
.tz-grid-v2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.tz-card-v2 { text-align: center; padding: 20px 12px 16px; border-radius: 14px; background: var(--card-bg); border: 1px solid var(--border); transition: all .18s; }
.tz-card-v2:hover { box-shadow: 0 4px 16px rgba(0,0,0,.08); transform: translateY(-2px); }
.tz-flag-v2 { font-size: 30px; line-height: 1; margin-bottom: 6px; }
.tz-city-v2 { font-size: 13px; font-weight: 700; color: var(--text-1); margin-bottom: 8px; }
.tz-time-v2 { font-size: 22px; font-weight: 700; color: var(--accent); font-family: 'Inter', monospace; letter-spacing: 0.5px; margin-bottom: 4px; }
.tz-date-v2 { font-size: 12px; color: var(--text-2); margin-bottom: 6px; }
.tz-utc-v2 { font-size: 11px; color: var(--text-3); background: var(--bg-2); display: inline-block; padding: 2px 8px; border-radius: 6px; }
.tz-flag { font-size: 24px; line-height: 1; margin-bottom: 4px; }
.tz-city { font-size: 12px; font-weight: 600; color: var(--text-1); margin-bottom: 4px; }
.tz-time { font-size: 18px; font-weight: 700; color: var(--accent); font-family: 'Inter', monospace; letter-spacing: 0.5px; }
.tz-date { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.tz-utc { font-size: 10px; color: var(--text-3); margin-top: 2px; }

/* ===== Calendar levels ===== */
.cal-level { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 11px; font-weight: 700; min-width: 24px; text-align: center; }
.level-s { background: #fef2f2; color: #dc2626; border: 1px solid #fca5a5; }
.level-a { background: #fff7ed; color: #ea580c; border: 1px solid #fdba74; }
.level-b { background: #eff6ff; color: #2563eb; border: 1px solid #93c5fd; }
.level-c { background: #f0fdf4; color: #16a34a; border: 1px solid #86efac; }

/* ===== Calendar table ===== */
.cal-table { width: 100%; font-size: 13px; }
.cal-table th { font-size: 12px; font-weight: 600; color: var(--text-2); background: #f8fafc; padding: 10px 12px; text-align: left; border-bottom: 2px solid var(--border); }
.cal-table td { padding: 10px 12px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.cal-table tr:hover td { background: #f8fafc; }
.cal-name { font-weight: 600; color: var(--text-1); }
.cal-countries { font-size: 12px; color: var(--text-2); }
.cal-products { font-size: 12px; color: var(--accent); line-height: 1.5; }
.cal-month-badge { display: inline-block; padding: 2px 10px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.m1 { background: #dbeafe; color: #1d4ed8; }
.m2 { background: #fce7f3; color: #be185d; }
.m3 { background: #d1fae5; color: #047857; }
.m4 { background: #e0e7ff; color: #4338ca; }
.m5 { background: #fef3c7; color: #b45309; }
.m6 { background: #fecdd3; color: #e11d48; }
.m7 { background: #fee2e2; color: #dc2626; }
.m8 { background: #cffafe; color: #0e7490; }
.m9 { background: #fef9c3; color: #a16207; }
.m10 { background: #ffedd5; color: #c2410c; }
.m11 { background: #ede9fe; color: #6d28d9; }
.m12 { background: #dcfce7; color: #15803d; }

/* ===== Upcoming events ===== */
.upcoming-grid { display: flex; flex-direction: column; gap: 10px; }
.upcoming-card { display: flex; align-items: flex-start; gap: 14px; padding: 14px 16px; border-radius: 10px; border: 1px solid var(--border); background: #fff; transition: all 0.15s; }
.upcoming-card:hover { box-shadow: 0 2px 12px rgba(0,0,0,0.06); }
.upcoming-card.level-s { border-left: 4px solid #dc2626; }
.upcoming-card.level-a { border-left: 4px solid #ea580c; }
.upcoming-card.level-b { border-left: 4px solid #2563eb; }
.upcoming-card.level-c { border-left: 4px solid #16a34a; }
.upcoming-date { min-width: 56px; text-align: center; }
.upcoming-month { display: block; font-size: 11px; color: var(--text-3); font-weight: 500; }
.upcoming-day { display: block; font-size: 26px; font-weight: 800; color: var(--text-1); line-height: 1.1; }
.upcoming-info { flex: 1; }
.upcoming-name { font-size: 14px; font-weight: 600; color: var(--text-1); margin-bottom: 4px; }
.upcoming-loc { font-size: 11px; color: var(--text-3); margin-left: 8px; font-weight: 400; }
.upcoming-region { font-size: 12px; color: var(--text-2); margin-bottom: 4px; }
.upcoming-products { font-size: 12px; color: var(--accent); line-height: 1.4; }
.upcoming-duration { font-size: 11px; color: var(--text-3); white-space: nowrap; align-self: center; background: #f1f5f9; padding: 3px 8px; border-radius: 6px; }

/* ===== Performance tabs ===== */
.perf-tabs { display: flex; gap: 6px; margin-bottom: 16px; }
.perf-tab { padding: 8px 18px; border: 1px solid var(--border); border-radius: 8px; background: #fff; font-size: 14px; font-weight: 500; cursor: pointer; color: var(--text-2); transition: all 0.15s; display: flex; align-items: center; gap: 6px; }
.perf-tab:hover { border-color: var(--accent); color: var(--accent); }
.perf-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.perf-tab-count { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 20px; border-radius: 10px; font-size: 12px; font-weight: 600; padding: 0 6px; background: rgba(0,0,0,0.08); }
.perf-tab.active .perf-tab-count { background: rgba(255,255,255,0.25); color: #fff; }
.rank-badge { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%; font-size: 13px; font-weight: 700; color: #fff; }
.rank-1 { background: linear-gradient(135deg, #f59e0b, #d97706); }
.rank-2 { background: linear-gradient(135deg, #94a3b8, #64748b); }
.rank-3 { background: linear-gradient(135deg, #d97706, #b45309); }
.rank-num { font-size: 13px; font-weight: 600; color: var(--text-3); }

/* ===== Sort Pills ===== */
.sort-pills {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.sort-pills-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  margin-right: 4px;
  white-space: nowrap;
}
.sort-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--bg-1);
  color: var(--text-2);
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.sort-pill:hover {
  border-color: var(--blue);
  color: var(--blue);
  background: rgba(59,130,246,.06);
}
.sort-pill.active {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
  box-shadow: 0 1px 3px rgba(59,130,246,.25);
}

/* ===== Order Edit Form ===== */
.edit-form-grid { display: flex; flex-direction: column; gap: 16px; }
.ef-section { }
.ef-section-title { font-size: 12px; font-weight: 700; color: var(--text-2); margin-bottom: 8px; padding-bottom: 4px; border-bottom: 1px solid var(--border); text-transform: uppercase; letter-spacing: 0.5px; }
.ef-row { display: flex; gap: 10px; margin-bottom: 8px; }
.ef-field { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.ef-field label { font-size: 11px; font-weight: 600; color: var(--text-3); }
.ef-field .form-input, .ef-field .form-select { font-size: 13px; padding: 5px 8px; }

/* ===== Custom Order Card View ===== */
.custom-cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(400px, 1fr)); gap: 14px; }
.custom-order-card {
  background: var(--card-bg); border: 1px solid var(--border); border-radius: 14px;
  padding: 14px; display: flex; flex-direction: column; gap: 0;
  transition: all .18s; position: relative; overflow: hidden;
}
.custom-order-card:hover { box-shadow: 0 4px 14px rgba(0,0,0,.07); }
/* 主体：左图+右信息 */
.coc-body { display: flex; gap: 14px; }
.coc-left { flex-shrink: 0; width: 130px; display: flex; flex-direction: column; gap: 6px; }
.coc-main-img-wrap { width: 130px; height: 130px; border-radius: 10px; overflow: hidden; border: 1px solid var(--border-light); cursor: pointer; background: var(--bg); }
.coc-main-img { width: 100%; height: 100%; object-fit: cover; transition: transform .2s; }
.coc-main-img-wrap:hover .coc-main-img { transform: scale(1.06); }
.coc-main-img-empty { width: 130px; height: 130px; border-radius: 10px; border: 2px dashed var(--border); background: var(--bg); display: flex; align-items: center; justify-content: center; font-size: 12px; color: var(--text-3); }
.coc-thumb-row { display: flex; gap: 4px; align-items: center; }
.coc-thumb { width: 38px; height: 38px; border-radius: 6px; overflow: hidden; border: 1px solid var(--border-light); cursor: pointer; }
.coc-thumb:hover { box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.coc-thumb img { width: 100%; height: 100%; object-fit: cover; }
.coc-thumb-more { font-size: 10px; color: var(--text-3); padding: 0 4px; }
.coc-img-actions { display: flex; }
.coc-img-btn { font-size: 11px; color: var(--accent); background: var(--accent-bg); border: 1px solid transparent; border-radius: 6px; padding: 3px 8px; cursor: pointer; font-weight: 500; }
.coc-img-btn:hover { border-color: var(--accent); }
/* 右侧信息 */
.coc-right { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.coc-header { display: flex; justify-content: space-between; align-items: center; gap: 6px; flex-wrap: wrap; }
.coc-order-no { font-weight: 700; font-size: 13px; font-family: 'Inter', monospace; color: var(--text-1); }
.coc-meta-right { display: flex; gap: 6px; align-items: center; }
.coc-detail-link { font-size: 12px; color: var(--accent); text-decoration: none; font-weight: 500; }
.coc-detail-link:hover { text-decoration: underline; }
/* 键值对列表 */
.coc-kv-list { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 10px; }
.coc-kv { display: flex; gap: 6px; align-items: baseline; font-size: 12px; overflow: hidden; }
.coc-kv-k { font-weight: 600; color: var(--text-3); font-size: 10px; flex-shrink: 0; min-width: 28px; }
.coc-kv-v {
  color: var(--text-1); word-break: break-word;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 180px;
  transition: all .15s;
}
.coc-kv:hover .coc-kv-v { white-space: normal; overflow: visible; max-width: none; }
.coc-people { display: flex; gap: 6px; flex-wrap: wrap; }
.coc-person { font-size: 11px; color: var(--text-2); background: var(--bg-2); padding: 2px 7px; border-radius: 6px; }
/* 详情区（需求/工序/备注）— 始终展示 */
.coc-expand-area {
  display: flex; flex-direction: column; gap: 8px;
  padding-top: 10px; border-top: 1px solid var(--border-light); margin-top: 8px;
}
.coc-requirements { position: relative; padding: 10px 12px; background: #fffbeb; border: 1px solid #fde68a; border-radius: 8px; }
.coc-req-label { font-size: 10px; font-weight: 700; color: #92400e; margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.5px; }
.coc-req-text {
  font-size: 12px; color: var(--text-1); line-height: 1.6;
  white-space: pre-wrap; word-break: break-word;
  max-height: 120px; overflow: hidden; position: relative;
}
.coc-req-text.expanded { max-height: none; }
.coc-req-toggle {
  display: inline-block; font-size: 11px; color: var(--accent); cursor: pointer;
  margin-top: 2px; font-weight: 500;
}
.coc-req-toggle:hover { text-decoration: underline; }
.coc-edit-btn { position: absolute; top: 8px; right: 8px; background: none; border: none; cursor: pointer; font-size: 14px; color: var(--text-3); padding: 2px; }
.coc-edit-btn:hover { color: var(--accent); }
.coc-steps { display: flex; gap: 2px; align-items: center; overflow-x: auto; padding: 2px 0; }
.coc-step { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0; flex: 1; }
.coc-step-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--border); border: 2px solid var(--bg-1); transition: all .15s;
}
.coc-step.done .coc-step-dot { background: #22c55e; border-color: #dcfce7; }
.coc-step.current .coc-step-dot { background: var(--accent); border-color: #dbeafe; box-shadow: 0 0 0 3px rgba(59,130,246,.2); }
.coc-step-name { font-size: 9px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; text-align: center; }
.coc-step.done .coc-step-name { color: #16a34a; }
.coc-step.current .coc-step-name { color: var(--accent); font-weight: 600; }

/* Step row: progress bar + select */
.coc-steps-row { display:flex; align-items:center; gap:8px; }
.coc-steps-row .coc-steps { flex:1; min-width:0; }
.coc-step-select {
  flex-shrink:0; height:24px; padding:0 6px; font-size:11px; font-weight:600;
  border:1px solid var(--border); border-radius:6px; background:var(--surface);
  color:var(--accent); cursor:pointer; outline:none; max-width:80px;
  transition:all .15s;
}
.coc-step-select:hover { border-color:var(--accent); background:var(--accent-subtle,#eff6ff); }
.coc-step-select:focus { border-color:var(--accent); box-shadow:0 0 0 2px rgba(59,130,246,.15); }

/* Hover zoom panel */
.hover-zoom-panel {
  position:fixed; z-index:9999; pointer-events:none;
  background:#fff; border:2px solid var(--border); border-radius:10px;
  box-shadow:0 8px 32px rgba(0,0,0,.18); overflow:hidden;
  max-width:380px; max-height:380px;
}
.hover-zoom-panel img {
  display:block; width:100%; height:100%; object-fit:contain;
  max-width:380px; max-height:380px;
}

.coc-remark {
  font-size: 11px; color: var(--text-3); line-height: 1.5;
  display: flex; flex-direction: column; gap: 3px;
}
.coc-remark span {
  display: block; word-break: break-word;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  cursor: default; transition: all .15s;
}
.coc-remark span:hover { white-space: normal; overflow: visible; }

/* 加急卡片 */
.coc-urgent { border: 2px solid #ef4444; background: linear-gradient(135deg, #fff5f5 0%, #fff 40%); position: relative; }
.coc-urgent-ribbon {
  position: absolute; top: 0; right: 0; background: #ef4444; color: #fff;
  font-size: 11px; font-weight: 700; padding: 3px 12px 3px 14px;
  border-radius: 0 12px 0 10px; z-index: 2; letter-spacing: .5px;
  animation: urgentPulse 1.5s ease-in-out infinite;
}
@keyframes urgentPulse { 0%,100%{opacity:1} 50%{opacity:.7} }
/* 已完成卡片 */
.coc-done { opacity: .65; border-color: var(--border-light); }
.coc-done:hover { opacity: .85; }

/* 支付时间 + 倒计时行 */
.coc-time-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.coc-time-item { font-size: 11px; color: var(--text-3); }
.coc-countdown {
  font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 6px;
  display: inline-flex; align-items: center; gap: 4px;
}
.cd-overdue { background: #fef2f2; color: #dc2626; border: 1px solid #fca5a5; animation: urgentPulse 1.5s ease-in-out infinite; }
.cd-today { background: #fef2f2; color: #dc2626; border: 1px solid #fca5a5; }
.cd-soon { background: #fffbeb; color: #d97706; border: 1px solid #fde68a; }
.cd-normal { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }

/* 操作按钮栏 */
.coc-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
.coc-act-btn {
  font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--white); color: var(--text-2);
  cursor: pointer; transition: all .15s; display: inline-flex; align-items: center; gap: 3px;
}
.coc-act-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-bg); }
.coc-act-btn:disabled { opacity: .5; cursor: not-allowed; }
.coc-btn-done { border-color: #86efac; color: #16a34a; background: #f0fdf4; }
.coc-btn-done:hover { background: #dcfce7; border-color: #22c55e; }
.coc-btn-urgent { border-color: #fca5a5; color: #dc2626; background: #fef2f2; }
.coc-btn-urgent:hover { background: #fee2e2; border-color: #ef4444; }
.coc-btn-unurgent { border-color: #93c5fd; color: #2563eb; background: #eff6ff; }
.coc-btn-unurgent:hover { background: #dbeafe; border-color: #3b82f6; }
.coc-btn-reopen { border-color: #fdba74; color: #c2410c; background: #fff7ed; }
.coc-btn-reopen:hover { background: #ffedd5; border-color: #f97316; }

.coc-btn-setdate { border-color: var(--border); color: var(--text-3); background: var(--white); }
.coc-btn-setdate:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-bg); }

.coc-delivery-popup {
  position: absolute; bottom: 100%; left: 0; z-index: 20;
  background: var(--white); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,.12); padding: 10px 12px;
  display: flex; flex-direction: column; gap: 6px; min-width: 180px;
}

/* 图片管理弹窗 */
.cim-image-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; min-height: 60px; }
.cim-item { position: relative; width: 90px; height: 90px; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); }
.cim-img { width: 100%; height: 100%; object-fit: cover; cursor: pointer; }
.cim-del { position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; border-radius: 50%; background: var(--red); color: #fff; border: none; cursor: pointer; font-size: 13px; line-height: 1; display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity .15s; }
.cim-item:hover .cim-del { opacity: 1; }
.cim-add-area { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.cim-paste-zone { padding: 8px 14px; border: 2px dashed var(--border); border-radius: 8px; font-size: 12px; color: var(--text-3); cursor: text; outline: none; flex: 1; text-align: center; transition: border-color .15s; -webkit-user-modify: read-write-plaintext-only; user-select: none; }
.cim-paste-zone:focus { border-color: var(--accent); color: var(--accent); background: var(--accent-bg, rgba(59,130,246,.05)); }
.cim-paste-zone * { display: none; }
.cim-hint { font-size: 11px; color: var(--text-3); }

/* Image zoom overlay */
.img-zoom-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,.85); display: flex; align-items: center; justify-content: center;
  cursor: zoom-out;
}
.img-zoom-overlay img { max-width: 90vw; max-height: 90vh; object-fit: contain; border-radius: 8px; }
.img-zoom-close {
  position: fixed; top: 16px; right: 16px;
  background: rgba(255,255,255,.2); border: none; color: #fff; font-size: 28px;
  width: 40px; height: 40px; border-radius: 50%; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.img-zoom-close:hover { background: rgba(255,255,255,.3); }

/* ===== Admin Tools Dropdown ===== */
.admin-tools-dropdown .admin-tools-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  padding: 6px;
  min-width: 190px;
  z-index: 100;
}
.admin-tools-dropdown.open .admin-tools-menu { display: block; }
.admin-tool-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  border: none;
  background: none;
  font-size: 13px;
  color: var(--text-1);
  cursor: pointer;
  border-radius: 6px;
  transition: background .12s;
  text-align: left;
}
.admin-tool-item:hover {
  background: var(--bg-2);
}

/* ===== Mobile menu button ===== */
.mobile-menu-btn {
  display: none; position: fixed; top: 10px; left: 10px; z-index: 1100;
  width: 42px; height: 42px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--white); box-shadow: 0 2px 8px rgba(0,0,0,.1); cursor: pointer;
  align-items: center; justify-content: center; color: var(--text);
}
.sidebar-overlay {
  display: none; position: fixed; inset: 0; z-index: 999; background: rgba(0,0,0,.4);
  backdrop-filter: blur(2px); opacity: 0; transition: opacity .25s;
}
.sidebar-overlay.show { display: block; opacity: 1; }

/* ===== Responsive ===== */
@media (max-width: 991px) {
  .mobile-menu-btn { display: flex; }
  .sidebar {
    display: flex; position: fixed; left: -280px; top: 0; z-index: 1050;
    width: 260px; height: 100vh; transition: left .3s ease;
    box-shadow: 4px 0 20px rgba(0,0,0,.15);
  }
  .sidebar.open { left: 0; }
  .content-area { padding: 60px 12px 20px; }
  .page-header { flex-direction: column; gap: 8px; align-items: stretch !important; }
  .page-header .btn { text-align: center; }
  .metrics-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .inv-stats-row { grid-template-columns: repeat(3, 1fr) !important; }
  .top3-row { grid-template-columns: 1fr; }
  .row .col-4, .row .col-8, .row .col-6 { width: 100%; }
  .info-grid, .result-grid, .grid-2 { grid-template-columns: 1fr !important; }
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .product-gallery { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); }
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { min-width: 600px; }
  .card, .metric-card { padding: 12px; }
  .modal-box, .wk-modal-box { width: 95vw !important; max-width: 95vw !important; }
  .form-row { flex-direction: column; }
  .form-row .form-group { width: 100% !important; }
  .batch-bar { flex-wrap: wrap; gap: 6px; }
  .batch-bar select, .batch-bar input { min-width: 0; flex: 1; }
}

@media (max-width: 640px) {
  .content-area { padding: 56px 8px 16px; }
  .metrics-grid { grid-template-columns: 1fr !important; }
  .inv-stats-row { grid-template-columns: repeat(2, 1fr) !important; }
  .top3-row { grid-template-columns: 1fr; }
  .qr-grid { grid-template-columns: repeat(2, 1fr); }
  .result-grid { grid-template-columns: 1fr !important; }
  .toolbar { flex-direction: column; align-items: stretch; gap: 8px; }
  .toolbar select, .toolbar input, .toolbar .btn { width: 100%; min-width: 0; font-size: 14px; }
  .search-form .search-row { flex-direction: column; gap: 6px; }
  .search-form .search-row > * { width: 100% !important; min-width: 0 !important; }
  .pagination { flex-direction: column; align-items: flex-start; gap: 8px; }
  .pagination-nav { flex-wrap: wrap; }
  .btn { min-height: 44px; padding: 10px 16px; font-size: 14px; }
  .btn-sm { min-height: 40px; padding: 8px 12px; font-size: 13px; }
  select, input[type="text"], input[type="number"], input[type="date"], input[type="search"], textarea {
    min-height: 44px; font-size: 16px !important; padding: 8px 10px;
  }
  .page-header h2 { font-size: 18px; }
  .page-title { font-size: 20px; }
  .product-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .sp-grid { grid-template-columns:1fr; }
  .sp-info-grid { grid-template-columns:1fr; }
  .lk-entry-grid { grid-template-columns:1fr; }
  .lk-bm-grid { grid-template-columns:1fr; }
  .lk-bm-actions { opacity:1; }
  .wk-user-chip { min-width:calc(50% - 6px); }
  .form-group { min-width:0 !important; width:100%; }
  .alert { font-size:13px; padding:10px 12px; }
  .card { padding:10px; }
  .card-title { font-size:15px; }
  h2 { font-size:18px; }
  .modal-body { padding: 12px; }
  .modal-header { padding: 12px; }
  .modal-box .grid-2 { grid-template-columns: 1fr !important; }
  .dash-pager { flex-direction: column; gap: 8px; }
  .dash-pager-btns { flex-wrap: wrap; gap: 4px; }
  .inline-input, .inline-select { min-height: 36px; font-size: 13px; }
  .stk { max-width: 120px; }
  colgroup { display: none; }
}

/* ===== 工作管理 ===== */
.wk-filter-bar { display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; }

.wk-user-grid { display:flex; gap:10px; flex-wrap:wrap; }
.wk-user-chip {
  padding:10px 14px; border-radius:10px; border:1px solid var(--border);
  background:var(--white); min-width:140px; cursor:pointer; transition:all .15s;
}
.wk-user-chip:hover { border-color:var(--accent); box-shadow:0 2px 8px rgba(0,0,0,.06); }
.wk-user-chip.chip-done { border-color:#86efac; background:#f0fdf4; }
.wk-user-chip.chip-progress { border-color:#93c5fd; background:#eff6ff; }
.wk-user-chip.chip-pending { border-color:#fde68a; background:#fffbeb; }
.wk-chip-name { font-size:13px; font-weight:600; margin-bottom:6px; }
.wk-chip-bar { height:4px; background:var(--border); border-radius:2px; overflow:hidden; margin-bottom:4px; }
.wk-chip-fill { height:100%; background:var(--accent); border-radius:2px; transition:width .3s; }
.chip-done .wk-chip-fill { background:var(--green); }
.wk-chip-stat { font-size:11px; color:var(--text-3); }

.wk-task-list { display:flex; flex-direction:column; gap:8px; }
.wk-task-row {
  display:flex; align-items:stretch; gap:12px; padding:14px 16px;
  border:1px solid var(--border); border-radius:10px; background:var(--white);
  transition:all .15s;
}
.wk-task-row:hover { border-color:var(--accent); box-shadow:0 2px 8px rgba(0,0,0,.05); }
.wk-task-row.row-done { opacity:.75; background:#fafafa; }
.wk-task-row.row-cancelled { opacity:.5; background:#fafafa; }
.wk-task-row.row-active { border-left:3px solid var(--accent); }
.wk-task-main { flex:1; min-width:0; display:flex; flex-direction:column; gap:6px; }
.wk-task-header { display:flex; align-items:center; gap:8px; justify-content:space-between; }
.wk-task-title {
  font-size:14px; font-weight:600; color:var(--text-1); cursor:pointer;
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
.wk-task-title:hover { color:var(--accent); }
.wk-task-desc { font-size:12px; color:var(--text-2); line-height:1.5; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.wk-task-summary { font-size:12px; color:#16a34a; background:#f0fdf4; padding:4px 8px; border-radius:6px; }
.wk-task-admin-remark { font-size:12px; color:#92400e; background:#fffbeb; padding:4px 8px; border-radius:6px; }

.wk-priority {
  display:inline-block; padding:1px 8px; border-radius:10px;
  font-size:10px; font-weight:700; flex-shrink:0;
}
.wk-p-高 { background:#fef2f2; color:#dc2626; border:1px solid #fca5a5; }
.wk-p-中 { background:#fffbeb; color:#b45309; border:1px solid #fde68a; }
.wk-p-低 { background:#f0fdf4; color:#16a34a; border:1px solid #bbf7d0; }

.wk-position {
  display:inline-block; padding:1px 8px; border-radius:10px;
  font-size:10px; font-weight:600; background:#eff6ff; color:#2563eb; border:1px solid #bfdbfe; flex-shrink:0;
}

.wk-deadline { font-size:11px; color:var(--red); font-weight:600; flex-shrink:0; }

.wk-assignee {
  font-size:12px; font-weight:600; color:var(--text-2);
  padding:2px 8px; background:var(--surface); border-radius:6px; flex-shrink:0;
}

.wk-status {
  display:inline-block; padding:2px 10px; border-radius:10px;
  font-size:11px; font-weight:600; flex-shrink:0;
}
.wk-st-待处理 { background:#f3f4f6; color:#6b7280; }
.wk-st-进行中 { background:#dbeafe; color:#1d4ed8; }
.wk-st-已完成 { background:#dcfce7; color:#16a34a; }
.wk-st-已取消 { background:#f3f4f6; color:#9ca3af; text-decoration:line-through; }

.wk-progress-row { display:flex; align-items:center; gap:8px; }
.wk-progress-bar { flex:1; height:6px; background:var(--border); border-radius:3px; overflow:hidden; }
.wk-progress-fill { height:100%; background:var(--accent); border-radius:3px; transition:width .3s; }
.wk-progress-fill.fill-done { background:var(--green); }
.wk-progress-fill.fill-half { background:#f59e0b; }
.wk-progress-text { font-size:12px; font-weight:700; color:var(--text-2); min-width:36px; text-align:right; }

.wk-task-actions { display:flex; flex-direction:column; gap:4px; justify-content:center; flex-shrink:0; }
.wk-task-actions .btn { font-size:11px; padding:4px 10px; white-space:nowrap; }

/* 弹窗 */
.wk-modal {
  position:fixed; inset:0; z-index:1000; background:rgba(0,0,0,.4);
  display:flex; align-items:center; justify-content:center; padding:20px;
}
.wk-modal-content {
  background:var(--white); border-radius:14px; width:100%; max-width:520px;
  max-height:90vh; overflow:auto; box-shadow:0 20px 60px rgba(0,0,0,.2);
}
.wk-modal-header {
  display:flex; align-items:center; justify-content:space-between;
  padding:16px 20px; border-bottom:1px solid var(--border);
}
.wk-modal-header h3 { font-size:16px; font-weight:700; margin:0; }
.wk-modal-close {
  width:28px; height:28px; border-radius:6px; border:none; background:none;
  font-size:20px; cursor:pointer; color:var(--text-3); display:flex; align-items:center; justify-content:center;
}
.wk-modal-close:hover { background:var(--surface); }
.wk-modal-body { padding:16px 20px; }
.wk-modal-footer { padding:12px 20px; border-top:1px solid var(--border); display:flex; gap:8px; justify-content:flex-end; }

.form-row { display:flex; gap:12px; }
.form-group { margin-bottom:12px; }
.form-group:last-child { margin-bottom:0; }

.wk-range { width:100%; accent-color:var(--accent); height:6px; cursor:pointer; }

/* 日志列表 */
.wk-log-list { display:flex; flex-direction:column; gap:6px; }
.wk-log-item {
  display:flex; gap:8px; align-items:baseline; font-size:12px;
  padding:6px 10px; background:var(--surface); border-radius:6px;
}
.wk-log-time { color:var(--text-3); flex-shrink:0; font-size:11px; }
.wk-log-user { color:var(--accent); font-weight:600; flex-shrink:0; }
.wk-log-content { color:var(--text-2); }

@media (max-width:768px) {
  .wk-task-row { flex-direction:column; gap:8px; }
  .wk-task-actions { flex-direction:row; flex-wrap:wrap; }
  .wk-task-actions .btn { min-height:40px; padding:8px 14px; font-size:13px; }
  .wk-filter-bar { flex-direction:column; align-items:stretch; }
  .wk-filter-bar select, .wk-filter-bar input { min-height:44px; font-size:14px; }
  .form-row { flex-direction:column; gap:0; }
  .wk-modal-content { max-width:95vw; }
  .wk-modal-body { padding:12px; }
  .wk-user-grid { gap:6px; }
  .wk-user-chip { min-width:calc(50% - 6px); padding:12px; }
  .wk-chip-name { font-size:14px; }
}

/* ===== 订单配件 ===== */
.coc-parts-area {
  margin-top:10px; padding-top:10px; border-top:1px dashed var(--border);
}
.coc-parts-header {
  display:flex; align-items:center; gap:8px; margin-bottom:8px;
}
.coc-parts-title { font-size:12px; font-weight:700; color:var(--text-1); }
.coc-parts-cost { font-size:11px; font-weight:700; color:var(--red); flex:1; }
.coc-parts-list { display:flex; flex-direction:column; gap:6px; }

.coc-part-row {
  display:flex; align-items:center; gap:8px; padding:8px 10px;
  background:var(--surface); border-radius:8px; border:1px solid var(--border);
  transition:border-color .15s;
}
.coc-part-row:hover { border-color:var(--accent); }
.coc-part-main { flex:1; display:flex; align-items:center; gap:8px; min-width:0; flex-wrap:wrap; }
.coc-part-info { display:flex; align-items:center; gap:6px; min-width:0; }
.coc-part-thumb { width:36px; height:36px; border-radius:6px; object-fit:cover; cursor:pointer; flex-shrink:0; border:1px solid var(--border); }
.coc-part-detail { display:flex; flex-direction:column; min-width:0; }
.coc-part-name { font-size:12px; font-weight:600; color:var(--text-1); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.coc-part-spec { font-size:10px; color:var(--text-3); }
.coc-part-meta { display:flex; align-items:center; gap:6px; flex-shrink:0; }
.coc-part-qty { font-size:11px; font-weight:600; color:var(--text-2); }
.coc-part-price { font-size:11px; color:var(--text-2); }
.coc-part-cost { font-size:11px; font-weight:700; color:var(--red); }
.coc-part-tags { display:flex; align-items:center; gap:4px; flex-shrink:0; flex-wrap:wrap; }
.coc-part-receipt-thumb { width:28px; height:28px; border-radius:4px; object-fit:cover; cursor:pointer; border:1px solid var(--border); }

.coc-part-status {
  display:inline-block; padding:1px 8px; border-radius:10px;
  font-size:10px; font-weight:700;
}
.pt-pending { background:#f3f4f6; color:#6b7280; }
.pt-ordered { background:#dbeafe; color:#1d4ed8; }
.pt-shipped { background:#fef3c7; color:#92400e; }
.pt-arrived { background:#d1fae5; color:#065f46; }
.pt-received { background:#dcfce7; color:#16a34a; }

.coc-part-tag {
  display:inline-block; padding:1px 6px; border-radius:8px;
  font-size:10px; font-weight:600;
}
.pt-self { background:#fef2f2; color:#dc2626; border:1px solid #fca5a5; }
.pt-loc { background:#f0fdf4; color:#16a34a; font-size:10px; }

.coc-part-actions { display:flex; gap:3px; flex-shrink:0; align-items:center; }

@media (max-width:768px) {
  .coc-part-row { flex-direction:column; align-items:stretch; gap:6px; }
  .coc-part-actions { flex-wrap:wrap; justify-content:flex-end; }
  .coc-part-actions .btn, .coc-act-btn { min-height:38px; padding:6px 12px; font-size:12px; }
  .coc-part-meta { flex-wrap:wrap; }
}

/* ===== Supplier Module ===== */
.sp-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(340px,1fr)); gap:14px; }
.sp-card { transition:box-shadow .2s; }
.sp-card:hover { box-shadow:0 4px 16px rgba(0,0,0,.08); }
.sp-card-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:10px; }
.sp-name { font-size:15px; font-weight:700; }
.sp-rating { color:#f59e0b; font-size:13px; letter-spacing:1px; }
.sp-type-tag { display:inline-block; font-size:11px; font-weight:600; padding:2px 8px; border-radius:4px; color:#fff; }
.sp-type-纸厂 { background:#6366f1; }
.sp-type-印刷厂 { background:#0ea5e9; }
.sp-type-模切厂 { background:#f59e0b; }
.sp-type-粘盒厂 { background:#10b981; }
.sp-type-精品盒厂 { background:#ec4899; }
.sp-type-配件厂 { background:#8b5cf6; }
.sp-type-物流 { background:#64748b; }
.sp-type-其他 { background:#94a3b8; }
.sp-info-grid { display:grid; grid-template-columns:1fr 1fr; gap:6px 12px; margin-bottom:8px; }
.sp-info { display:flex; align-items:center; gap:4px; font-size:12px; color:var(--text-2); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.sp-info-icon { font-size:13px; flex-shrink:0; }
.sp-phone { color:var(--accent); text-decoration:none; }
.sp-phone:hover { text-decoration:underline; }
.sp-remark { font-size:11px; color:var(--text-3); padding:6px 8px; background:var(--surface); border-radius:6px; margin-bottom:8px; }
.sp-card-footer { display:flex; gap:6px; justify-content:flex-end; }

/* Supplier in step row */
.step-supplier-row { margin:8px 0 4px; padding:6px 10px; background:var(--surface); border-radius:6px; border:1px solid var(--border-light); }
.sp-step-badge { display:flex; align-items:center; gap:8px; flex-wrap:wrap; font-size:12px; }
.sp-step-contact { color:var(--text-2); font-size:11px; }
.sp-step-contact a { color:var(--accent); text-decoration:none; }

/* Supplier picker item hover */
.sp-picker-item:hover { background:var(--surface-elevated); }

/* ===== Links Module ===== */
.lk-entry-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(280px,1fr)); gap:16px; }
.lk-entry-card {
  text-decoration:none; color:inherit; transition:all .2s; cursor:pointer;
  border:2px solid transparent;
}
.lk-entry-card:hover { transform:translateY(-2px); box-shadow:0 8px 24px rgba(0,0,0,.08); }
.lk-entry-docs:hover { border-color:#0ea5e9; }
.lk-entry-browser:hover { border-color:#f59e0b; }
.lk-entry-baidu:hover { border-color:#3385ff; }
.lk-entry-quark:hover { border-color:#7c3aed; }
.lk-entry-google:hover { border-color:#ea4335; }

.lk-bm-grid {
  display:grid; grid-template-columns:repeat(auto-fill,minmax(240px,1fr)); gap:8px;
}
.lk-bm-card {
  display:flex; align-items:center; gap:10px; padding:10px 14px;
  background:var(--surface); border:1px solid var(--border-light); border-radius:10px;
  cursor:pointer; transition:all .15s;
}
.lk-bm-card:hover { background:var(--surface-elevated); border-color:var(--accent); box-shadow:0 2px 8px rgba(0,0,0,.05); }
.lk-bm-icon { font-size:22px; flex-shrink:0; }
.lk-bm-info { flex:1; min-width:0; }
.lk-bm-title { font-size:13px; font-weight:600; color:var(--text-1); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.lk-bm-desc { font-size:11px; color:var(--text-3); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; margin-top:1px; }
.lk-bm-actions { display:flex; gap:4px; align-items:center; flex-shrink:0; opacity:0; transition:opacity .15s; }
.lk-bm-card:hover .lk-bm-actions { opacity:1; }
.lk-bm-link { font-size:14px; color:var(--accent); text-decoration:none; padding:2px; }
.lk-bm-edit, .lk-bm-del {
  background:none; border:none; cursor:pointer; font-size:13px; padding:2px 4px; border-radius:4px;
}
.lk-bm-edit { color:var(--text-2); }
.lk-bm-edit:hover { background:var(--border-light); }
.lk-bm-del { color:var(--red); }
.lk-bm-del:hover { background:rgba(239,68,68,.1); }

/* ===== Data Scope Badge ===== */
.scope-badge {
  display:inline-block; margin-left:8px; padding:2px 10px;
  font-size:11px; font-weight:600; border-radius:10px;
  background:#fef3c7; color:#92400e; border:1px solid #fde68a;
}

