/* smallwh v2 design system - modern SaaS inspired */

* { box-sizing: border-box; }

:root {
  /* Colors - deep navy + accents */
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --text: #1a1d29;
  --text-muted: #6b7280;
  --text-subtle: #9ca3af;

  --primary: #4f46e5;          /* indigo-600 */
  --primary-hover: #4338ca;
  --primary-soft: #eef2ff;
  --primary-text: #3730a3;

  --success: #10b981;
  --success-soft: #d1fae5;
  --success-text: #065f46;

  --warning: #f59e0b;
  --warning-soft: #fef3c7;
  --warning-text: #92400e;

  --danger: #ef4444;
  --danger-soft: #fee2e2;
  --danger-text: #991b1b;

  --info: #3b82f6;
  --info-soft: #dbeafe;
  --info-text: #1e40af;

  /* Sidebar */
  --sidebar-bg: #0f172a;       /* slate-900 */
  --sidebar-hover: #1e293b;
  --sidebar-active: #4f46e5;
  --sidebar-text: #cbd5e1;
  --sidebar-text-active: #ffffff;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0,0,0,.04);
  --shadow: 0 1px 3px 0 rgba(0,0,0,.08), 0 1px 2px 0 rgba(0,0,0,.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.08), 0 2px 4px -1px rgba(0,0,0,.04);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.08), 0 4px 6px -2px rgba(0,0,0,.04);

  /* Radius */
  --radius-sm: 4px;
  --radius: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
}

html, body {
  margin: 0; padding: 0; min-height: 100vh;
  font-family: "PingFang SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  font-size: 14px; color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

[x-cloak] { display: none !important; }

/* ============ Login / Register ============ */
.auth-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.auth-card {
  width: 100%; max-width: 420px;
  background: #fff; border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 40px 36px;
}
.auth-logo {
  font-size: 32px; font-weight: 700;
  color: var(--primary); margin-bottom: 4px;
  display: flex; align-items: center; gap: 10px;
}
.auth-subtitle { color: var(--text-muted); margin-bottom: 28px; font-size: 14px; }
.auth-tabs {
  display: flex; border-bottom: 1px solid var(--border);
  margin-bottom: 20px; gap: 0;
}
.auth-tab {
  flex: 1; padding: 12px 0; text-align: center;
  cursor: pointer; font-size: 15px; font-weight: 500;
  color: var(--text-muted); border-bottom: 2px solid transparent;
  transition: all .15s;
}
.auth-tab.active {
  color: var(--primary); border-bottom-color: var(--primary);
}
.demo-accounts {
  margin-top: 20px; padding: 14px 16px;
  background: var(--primary-soft); border-radius: var(--radius);
  font-size: 12px; color: var(--primary-text);
  line-height: 1.8;
}
.demo-accounts b { color: var(--primary-text); }

/* ============ Main layout ============ */
.app-shell {
  display: flex; height: 100vh; overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: 220px; background: var(--sidebar-bg);
  color: var(--sidebar-text); flex-shrink: 0;
  display: flex; flex-direction: column;
  border-right: 1px solid rgba(255,255,255,.04);
}
.sidebar-header {
  padding: 20px 20px 14px; border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-logo {
  font-size: 17px; font-weight: 700; color: #fff;
  display: flex; align-items: center; gap: 8px;
}
.sidebar-version { color: #64748b; font-size: 11px; margin-top: 3px; }
.sidebar-nav {
  flex: 1; padding: 12px 10px; overflow-y: auto;
}
.sidebar-section-title {
  padding: 12px 10px 6px; font-size: 11px;
  color: #64748b; text-transform: uppercase; letter-spacing: 1px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: var(--radius);
  color: var(--sidebar-text); cursor: pointer;
  font-size: 13.5px; font-weight: 500;
  transition: all .12s; margin-bottom: 2px;
  width: 100%; border: none; background: transparent;
  text-align: left;
}
.nav-item:hover { background: var(--sidebar-hover); color: #fff; }
.nav-item.active {
  background: var(--sidebar-active); color: #fff;
  box-shadow: 0 1px 3px rgba(79,70,229,.4);
}
.nav-badge {
  margin-left: auto; background: #ef4444; color: #fff;
  font-size: 11px; padding: 1px 7px; border-radius: 10px;
  font-weight: 600;
}
.sidebar-footer {
  padding: 12px 16px; border-top: 1px solid rgba(255,255,255,.08);
  background: rgba(0,0,0,.2);
}
.user-info { font-size: 12px; }
.user-info .name { color: #fff; font-weight: 600; font-size: 13px; margin-top: 2px; }
.user-info .role { color: #94a3b8; margin-top: 1px; }
.btn-logout {
  margin-top: 8px; color: #f87171; font-size: 12px;
  background: none; border: none; cursor: pointer; padding: 0;
}
.btn-logout:hover { color: #fecaca; }

/* Main content area */
.main {
  flex: 1; overflow-y: auto; background: var(--bg);
}
.page {
  max-width: 100%; margin: 0 auto; padding: 28px 32px;
}
.page-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 24px;
}
.page-title {
  font-size: 22px; font-weight: 700; color: var(--text);
  display: flex; align-items: center; gap: 10px;
}
.page-title .emoji { font-size: 20px; }
.page-subtitle { color: var(--text-muted); font-size: 13px; margin-top: 4px; }
.page-actions { display: flex; gap: 8px; }

/* ============ Cards ============ */
.card {
  background: var(--surface); border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm); border: 1px solid var(--border);
}
.card-header {
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  font-weight: 600; font-size: 14px;
}
.card-body { padding: 16px 18px; }
.card-pad { padding: 18px; }

/* ============ Stat cards (dashboard) ============ */
.stat-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px;
  margin-bottom: 20px;
}
.stat {
  background: #fff; padding: 18px 20px;
  border-radius: var(--radius-md); border: 1px solid var(--border);
  transition: all .15s;
}
.stat:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.stat-label {
  font-size: 12px; color: var(--text-muted);
  font-weight: 500; text-transform: uppercase;
  letter-spacing: .5px;
}
.stat-value {
  font-size: 28px; font-weight: 700; color: var(--text);
  margin-top: 8px; line-height: 1;
}
.stat-sub {
  font-size: 12px; color: var(--text-muted); margin-top: 6px;
}
.stat.accent-red { border-left: 3px solid var(--danger); }
.stat.accent-amber { border-left: 3px solid var(--warning); }
.stat.accent-green { border-left: 3px solid var(--success); }
.stat.accent-blue { border-left: 3px solid var(--info); }

/* ============ Forms ============ */
.form-row { display: grid; gap: 14px; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.label {
  font-size: 13px; font-weight: 500; color: var(--text);
  display: flex; align-items: center; gap: 4px;
}
.label .required { color: var(--danger); }
.label .hint { color: var(--text-subtle); font-weight: normal; font-size: 11px; }

.input, select.input, textarea.input {
  width: 100%; padding: 8px 12px;
  font-family: inherit; font-size: 14px;
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: #fff; transition: all .15s;
  color: var(--text);
}
.input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}
.input:disabled { background: var(--bg); color: var(--text-muted); cursor: not-allowed; }
textarea.input { resize: vertical; min-height: 70px; }

/* ============ Buttons ============ */
.btn {
  padding: 7px 14px; border-radius: var(--radius);
  font-size: 13.5px; font-weight: 500; cursor: pointer;
  border: 1px solid transparent; transition: all .15s;
  display: inline-flex; align-items: center; gap: 6px;
  font-family: inherit;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary {
  background: var(--primary); color: #fff;
  box-shadow: 0 1px 2px rgba(79,70,229,.3);
}
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-ghost {
  background: transparent; color: var(--text);
  border-color: var(--border-strong);
}
.btn-ghost:hover:not(:disabled) { background: var(--bg); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #dc2626; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover:not(:disabled) { background: #059669; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-link {
  background: none; border: none; color: var(--primary);
  cursor: pointer; font-size: 12.5px; padding: 2px 4px;
}
.btn-link:hover { text-decoration: underline; }
.btn-link.danger { color: var(--danger); }

/* ============ Tables ============ */
.table-wrap { overflow-x: auto; }
table.data-table {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
table.data-table thead th {
  background: var(--surface-2); text-align: left;
  padding: 10px 12px; font-weight: 600; font-size: 12px;
  color: var(--text-muted); text-transform: uppercase;
  letter-spacing: .5px; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.data-table tbody td {
  padding: 10px 12px; border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.data-table tbody tr:hover { background: var(--surface-2); }
table.data-table tbody tr.row-selected { background: rgba(59, 130, 246, 0.12); }
table.data-table tbody tr.row-selected:hover { background: rgba(59, 130, 246, 0.18); }
table.data-table tbody tr.row-clickable { cursor: pointer; }
table.data-table tbody tr.row-clickable:hover { background: rgba(0, 0, 0, 0.03); }
table.data-table tbody tr.row-clickable.row-selected:hover { background: rgba(59, 130, 246, 0.18); }
table.data-table tbody tr:last-child td { border-bottom: none; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.mono { font-family: "SF Mono", Monaco, Consolas, monospace; font-size: 12px; }
.col-num { font-variant-numeric: tabular-nums; text-align: right; font-weight: 500; }

/* ============ Chips / Badges ============ */
.chip {
  display: inline-block; padding: 2px 10px;
  border-radius: 10px; font-size: 11.5px; font-weight: 500;
  white-space: nowrap;
}
.chip-in { background: var(--success-soft); color: var(--success-text); }
.chip-out { background: var(--danger-soft); color: var(--danger-text); }
.chip-pending { background: var(--warning-soft); color: var(--warning-text); }
.chip-completed { background: var(--info-soft); color: var(--info-text); }
.chip-cancelled { background: #e5e7eb; color: #4b5563; }
.chip-rejected { background: var(--danger-soft); color: var(--danger-text); }
.chip-approved { background: var(--success-soft); color: var(--success-text); }
.chip-neutral { background: #f3f4f6; color: #4b5563; }

.chip-role-l1 { background: #e0e7ff; color: #3730a3; }
.chip-role-l2 { background: #ddd6fe; color: #5b21b6; }
.chip-role-l3 { background: #fde68a; color: #92400e; }

.chip-kind-finished { background: #dcfce7; color: #166534; }
.chip-kind-parts { background: #fed7aa; color: #9a3412; }

/* ============ Filter bar ============ */
.filter-bar {
  padding: 14px 18px; background: var(--surface);
  border-radius: var(--radius-md); border: 1px solid var(--border);
  margin-bottom: 14px;
}
.filter-grid {
  display: grid; grid-template-columns: repeat(6, 1fr);
  gap: 12px; align-items: end;
}
.filter-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }

/* ============ Modals ============ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.5); z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 20px; backdrop-filter: blur(2px);
}
.modal {
  background: #fff; border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); width: 100%;
  max-width: 640px; max-height: 90vh;
  display: flex; flex-direction: column;
  animation: modal-in .2s ease-out;
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.modal.modal-lg { max-width: 800px; }
/* 当 .modal 直接子节点是 <form> 时（很多模态都这样包），让 form 继承 flex 布局，
   避免 form 作为 block 节点打断 modal → body/footer 的 flex 链，
   导致 body overflow 不生效、footer 被挤出 modal 之外。 */
.modal > form {
  display: flex; flex-direction: column;
  min-height: 0; flex: 1;
}
.modal-header {
  padding: 18px 22px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
  flex-shrink: 0;
}
.modal-title { font-weight: 600; font-size: 16px; }
.modal-close {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 22px;
  width: 28px; height: 28px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius);
}
.modal-close:hover { background: var(--bg); color: var(--text); }
/* 让 body 占据剩余空间并滚动；min-height:0 是 flex overflow 的关键，
   默认 min-height:auto 会让 body 按内容撑爆，把 footer 挤出 modal 外。 */
.modal-body {
  padding: 20px 22px;
  overflow-y: auto; overflow-x: hidden;
  flex: 1 1 auto; min-height: 0;
}
.modal-footer {
  padding: 14px 22px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 8px;
  flex-shrink: 0;
}
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ============ Toast ============ */
.toast {
  position: fixed; top: 20px; right: 20px; z-index: 200;
  padding: 12px 18px; border-radius: var(--radius);
  color: #fff; font-size: 14px; font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toast-in .2s ease-out;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-warning { background: var(--warning); }

/* ============ Pagination ============ */
.pager {
  padding: 12px 18px; display: flex;
  justify-content: space-between; align-items: center;
  font-size: 13px; color: var(--text-muted);
}

/* ============ Utils ============ */
.flex { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.ml-auto { margin-left: auto; }
.mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; } .mb-6 { margin-bottom: 24px; }
.text-sm { font-size: 12.5px; } .text-xs { font-size: 11.5px; }
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger); }
.font-bold { font-weight: 700; } .font-semibold { font-weight: 600; }
.hidden { display: none; }
.row-low { background: #fef2f2 !important; }

/* Diff viewer */
.diff {
  background: var(--surface-2); border-radius: var(--radius);
  padding: 8px 12px; font-family: "SF Mono", Consolas, monospace;
  font-size: 12px; line-height: 1.7;
}
.diff .old { color: var(--danger); }
.diff .new { color: var(--success); }

/* ============ Batch lines table (inside movement modal) ============ */
.lines-table {
  width: 100%; border-collapse: collapse; font-size: 13px;
  background: var(--surface-2); border-radius: var(--radius);
  overflow: hidden; border: 1px solid var(--border);
}
.lines-table th {
  background: #fff; text-align: left; padding: 8px 10px;
  font-size: 12px; font-weight: 600; color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.lines-table td {
  padding: 6px 10px; border-bottom: 1px solid var(--border);
  background: #fff;
}
.lines-table tr:last-child td { border-bottom: none; }
.lines-table select.input, .lines-table input.input {
  padding: 5px 8px; font-size: 13px;
}
.line-total {
  background: var(--primary-soft); color: var(--primary-text);
  padding: 10px 14px; border-radius: var(--radius);
  font-weight: 600; font-size: 14px;
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 10px;
}

/* ============ Period picker ============ */
.period-picker {
  display: flex; gap: 6px; align-items: center;
}
.period-picker .input {
  width: auto;
}
.period-tabs {
  display: flex; gap: 2px;
  background: var(--bg); padding: 3px;
  border-radius: var(--radius); border: 1px solid var(--border);
}
.period-tabs button {
  padding: 5px 10px; font-size: 12px;
  background: transparent; border: none; cursor: pointer;
  border-radius: var(--radius-sm); color: var(--text-muted);
  font-family: inherit;
}
.period-tabs button.active {
  background: #fff; color: var(--primary); font-weight: 600;
  box-shadow: var(--shadow-sm);
}
.period-tabs button:not(.active):hover {
  background: rgba(255,255,255,.5); color: var(--text);
}

/* ============ Dispatch report group row ============ */
.dispatch-group { background: #fff; }
.dispatch-group summary {
  padding: 10px 14px; cursor: pointer;
  display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  list-style: none;
}
.dispatch-group summary::-webkit-details-marker { display: none; }
.dispatch-group summary::before {
  content: "▶"; font-size: 10px; color: var(--text-muted);
  transition: transform .15s;
}
.dispatch-group[open] summary::before { transform: rotate(90deg); }
.dispatch-group summary:hover { background: var(--surface-2); }

/* ============ Scrollable modal body ============ */
.modal-body-scroll {
  max-height: calc(90vh - 140px);
  overflow-y: auto;
}

/* ============ Copy dropdown (for reports) ============ */
.copy-dropdown {
  position: relative; display: inline-block;
}
.copy-menu {
  position: absolute; right: 0; top: 100%;
  margin-top: 4px; background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  min-width: 160px; z-index: 50;
  overflow: hidden;
}
.copy-menu button {
  display: block; width: 100%; text-align: left;
  padding: 8px 14px; font-size: 13px;
  background: transparent; border: none; cursor: pointer;
  color: var(--text); font-family: inherit;
}
.copy-menu button:hover { background: var(--surface-2); }
.copy-menu button + button { border-top: 1px solid var(--border); }

/* ============ Report snapshot wrapper ============ */
.report-snapshot {
  background: #fff; padding: 18px;
}
.report-snapshot table { width: auto; min-width: 100%; }
.report-snapshot .snapshot-title {
  font-size: 18px; font-weight: 700; margin-bottom: 4px;
}
.report-snapshot .snapshot-subtitle {
  font-size: 13px; color: var(--text-muted); margin-bottom: 14px;
}

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* Responsive tweaks */
@media (max-width: 960px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .filter-grid, .filter-grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
  .form-grid-2 { grid-template-columns: 1fr; }
}


/* === Searchable product combobox (movement modal) === */
.prod-combo {
  position: relative;
}
.prod-combo-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  max-height: 260px;
  overflow-y: auto;
  z-index: 9999;
  margin-top: 4px;
}
.prod-combo-item {
  padding: 6px 10px;
  cursor: pointer;
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 13px;
  border-bottom: 1px solid var(--surface-2);
}
.prod-combo-item:last-child { border-bottom: none; }
.prod-combo-item:hover { background: var(--surface-2); }
.prod-combo-item.active { background: var(--primary-soft, #eef2ff); color: var(--primary); }
.prod-combo-item.combo-highlight { background: var(--surface-2); outline: 2px solid var(--primary, #4f46e5); outline-offset: -2px; }
.prod-combo-item .mono { min-width: 70px; color: var(--muted); }


/* === Dashboard trend bar chart (pure CSS, no Chart.js) === */
.trend-chart {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.trend-legend {
  display: flex;
  gap: 16px;
  font-size: 13px;
  align-items: center;
}
.trend-legend .legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin-right: 6px;
  vertical-align: middle;
}
/* Chart body: Y-axis (fixed left) + bars (scrollable right) */
.trend-chart-body {
  display: flex;
  align-items: stretch;
}
.trend-yaxis {
  flex: 0 0 auto;
  width: 48px;
  height: 260px;
  padding: 22px 6px 8px 0;  /* matches trend-bars padding so ticks align with bar heights */
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-end;
  border-right: 1px solid var(--border);
}
.trend-ytick {
  font-size: 10px;
  color: var(--muted);
  font-family: ui-monospace, monospace;
  line-height: 1;
}
.trend-bars {
  flex: 1 1 auto;
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 260px;
  padding: 22px 4px 8px;  /* extra top padding so value labels above bars aren't clipped */
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.trend-bar-col {
  flex: 1 0 auto;
  min-width: 54px;  /* 2 bars (22px each) + gap room for labels */
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
}
.trend-bar-stack {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 220px;
  width: 100%;
  justify-content: center;
}
.trend-bar {
  /* position:relative so the value label (absolutely positioned inside)
     anchors to the bar's top edge — rising/falling with the bar. */
  position: relative;
  width: 18px;
  min-width: 18px;
  min-height: 1px;
  border-radius: 3px 3px 0 0;
  transition: height 0.3s;
}
.trend-bar-val {
  /* Sits just above the bar's top edge and follows it as height changes. */
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 2px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  line-height: 1;
  white-space: nowrap;
  pointer-events: none;
}
.trend-bar.bar-in  { background: #10b981; }
.trend-bar.bar-out { background: #ef4444; }
.trend-bar-col:hover .trend-bar { opacity: 0.85; }
.trend-bar-label {
  margin-top: 6px;
  font-size: 11px;
  color: var(--muted);
  font-family: ui-monospace, monospace;
  white-space: nowrap;
}

/* ---------- Trend toolbar helpers (v1.0.8) ---------- */
.btn-group {
  display: inline-flex;
  gap: 2px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px;
  background: var(--bg-soft, #f9fafb);
  flex-shrink: 0;
}
.btn-group .btn {
  border-radius: 4px;
  padding: 6px 14px;
  font-size: 13px;
  line-height: 1.2;
  white-space: nowrap;
  min-width: 58px;
  text-align: center;
}
.btn-group .btn.btn-ghost { background: transparent; border: none; color: var(--muted); }
.btn-group .btn.btn-ghost:hover { background: var(--bg, #fff); color: var(--text); }
.btn-group .btn.btn-primary { box-shadow: 0 1px 2px rgba(0,0,0,0.1); }
.input-sm { padding: 6px 10px; font-size: 13px; height: 34px; line-height: 1.2; }

/* ---------- v1.0.16 规格安全库存 micro-UI ---------- */
.btn-xs { padding: 2px 8px; font-size: 12px; height: 26px; line-height: 1.2; }
.table-compact th, .table-compact td { padding: 6px 8px; font-size: 13px; }
.row-warn { background: #fef2f2; }
.text-danger { color: #dc2626; }

/* ---------- Duplicate shipment warning (v1.0.8) ---------- */
.dup-warning {
  background: #fffbeb;
  border: 1px solid #fbbf24;
  border-radius: 8px;
  padding: 0;
  overflow: hidden;
}
.dup-warning-header {
  padding: 10px 14px;
  background: #fef3c7;
  border-bottom: 1px solid #fbbf24;
  color: #92400e;
  font-size: 14px;
}
.dup-warning-body { padding: 12px 14px; }
.dup-hit {
  border-left: 3px solid #fbbf24;
  padding: 8px 12px;
  margin-bottom: 8px;
  background: #fff;
  border-radius: 4px;
}
.dup-hit-line { font-size: 13px; margin-bottom: 4px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.dup-hit-movs { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 4px; border-top: 1px dashed #fde68a; }
.dup-mov {
  font-size: 12px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  padding: 3px 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.dup-warning-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

/* v1.0.22.1 fix: 警告闪烁提示（首次显示时吸引注意力） */
@keyframes dupFlashAnim {
  0%   { box-shadow: 0 0 0 0 rgba(251, 191, 36, 0.9); transform: scale(1.00); }
  50%  { box-shadow: 0 0 0 14px rgba(251, 191, 36, 0.0); transform: scale(1.02); }
  100% { box-shadow: 0 0 0 0 rgba(251, 191, 36, 0.0); transform: scale(1.00); }
}
.dup-flash { animation: dupFlashAnim 0.9s ease-out 2; }

/* ---------- Shipment progress chip (partial shipment) ---------- */
.chip-partial {
  background: #fff7ed;
  color: #c2410c;
  border: 1px solid #fed7aa;
  font-weight: 600;
}
.chip-xs { font-size: 10px; padding: 1px 6px; line-height: 1.4; }

/* 地址结构化展示 (v1.0.30) */
.addr-parsed-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.addr-parsed-table td {
  padding: 3px 8px;
  border-bottom: 1px solid var(--border-color, #e5e7eb);
}
.addr-parsed-table .addr-label {
  width: 60px;
  color: var(--text-muted, #6b7280);
  font-size: 12px;
  white-space: nowrap;
}


/* 流水页面：表格填满视口，内部滚动 */
.movements-page {
  display: flex; flex-direction: column;
  height: 100%; overflow: hidden;
}
.movements-page .card {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.movements-page .table-wrap {
  flex: 1; min-height: 0; overflow: auto;
  /* 兜底：flex 链断裂时直接限高 */
  max-height: calc(100vh - 280px);
}
