:root {
  --primary: #4f46e5;
  --primary-light: #818cf8;
  --primary-dark: #4338ca;
  --primary-soft: #eef2ff;
  --accent: #7c3aed;
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;
  --sidebar-bg: #17143a;
  --sidebar-bg-2: #241f5e;
  --sidebar-width: 260px;
  --bg-light: #f3f4fb;
  --card-border: #e9ebf5;
  --card-shadow: 0 1px 2px rgba(16,24,40,.05), 0 4px 14px -4px rgba(16,24,40,.08);
  --card-hover-shadow: 0 14px 28px -10px rgba(16,24,40,.14);
  --radius: 14px;
  --radius-sm: 9px;
}

* { box-sizing: border-box; }

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: linear-gradient(180deg, #f8f9fd 0%, #eef1f8 100%);
  background-attachment: fixed;
  color: #1e293b;
  font-size: .9rem;
}

/* ===== 侧边栏 ===== */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: linear-gradient(180deg, var(--sidebar-bg-2) 0%, var(--sidebar-bg) 100%);
  color: #e0e7ff;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transition: transform .3s ease;
}

.sidebar-brand {
  padding: 1.25rem 1.25rem .75rem;
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: .6rem;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.sidebar-brand .logo-icon {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--primary-light), var(--accent));
  border-radius: 10px;
  box-shadow: 0 4px 12px -4px rgba(124,58,237,.55);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.sidebar-user {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
  font-size: .85rem;
}

.sidebar-user .role-badge {
  display: inline-block;
  background: rgba(255,255,255,.12);
  padding: 2px 10px;
  border-radius: 20px;
  font-size: .75rem;
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: .75rem 0;
}

.sidebar-nav .nav-section {
  padding: .5rem 1.25rem .25rem;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: rgba(255,255,255,.35);
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .6rem 1.25rem;
  color: #c7d2fe;
  text-decoration: none;
  font-size: .88rem;
  border-left: 3px solid transparent;
  transition: all .15s ease;
}

.sidebar-nav a:hover, .sidebar-nav a.active {
  background: linear-gradient(90deg, rgba(99,102,241,.22), rgba(255,255,255,.04));
  color: #fff;
  border-left-color: var(--primary-light);
}

.sidebar-nav a .nav-icon {
  width: 20px; text-align: center;
  font-size: 1rem;
  opacity: .7;
}

.sidebar-footer {
  padding: .75rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,.08);
}

.sidebar-footer a {
  color: #c7d2fe;
  text-decoration: none;
  font-size: .85rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}

.sidebar-footer a:hover { color: #fff; }

/* ===== 主内容区 ===== */
.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
}

.top-bar {
  background: rgba(255,255,255,.9);
  backdrop-filter: blur(10px);
  padding: .75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #e9ebf5;
  box-shadow: 0 4px 16px -8px rgba(16,24,40,.08);
  position: sticky;
  top: 0;
  z-index: 999;
}

.top-bar .page-title {
  font-size: 1.1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: .5rem;
}

.top-bar .page-title .sub {
  font-size: .8rem;
  font-weight: 400;
  color: #64748b;
}

.mobile-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  color: #475569;
}

.page-content {
  padding: 1.5rem;
}

/* ===== 卡片 ===== */
.card {
  background: #fff;
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  margin-bottom: 1.25rem;
}

.card-header {
  background: transparent;
  border-bottom: 1px solid #f1f5f9;
  padding: 1rem 1.25rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .5rem;
}

.card-body { padding: 1.25rem; }

/* 卡片头部左侧标题区域样式 */
.card-header > div:first-child {
  flex: 1 1 0;
  min-width: 0;
}
.card-header > .badge {
  flex-shrink: 0;
}
.card-scroll-arrows {
  flex-shrink: 0;
  margin-left: auto;
}

.card:hover { box-shadow: var(--card-hover-shadow); }

/* ===== 状态徽标 ===== */
.badge-status {
  padding: .25em .65em;
  border-radius: 20px;
  font-size: .78rem;
  font-weight: 500;
}

.badge-status.new { background: #dbeafe; color: #1d4ed8; }
.badge-status.pending { background: #fef3c7; color: #b45309; }
.badge-status.ordering { background: #fef3c7; color: #b45309; }
.badge-status.ready { background: #d1fae5; color: #065f46; }
.badge-status.production { background: #e0e7ff; color: #3730a3; }
.badge-status.done { background: #d1fae5; color: #065f46; }
.badge-status.draft { background: #f1f5f9; color: #475569; }
.badge-status.ordered { background: #dbeafe; color: #1d4ed8; }
.badge-status.partial { background: #fef3c7; color: #b45309; }
.badge-status.full { background: #d1fae5; color: #065f46; }
.badge-status.completed { background: #d1fae5; color: #065f46; }

/* ===== 表格 ===== */
.table-wrapper { overflow-x: auto; }

.table {
  margin-bottom: 0;
  font-size: .875rem;
}

.table th {
  font-weight: 600;
  color: #475569;
  border-top: none;
  white-space: nowrap;
  background: #f8fafc;
}

.table td { vertical-align: middle; }

.table-hover tbody tr:hover {
  background: #f1f5f9;
}

/* ===== 表单 ===== */
.form-control, .form-select {
  border-radius: var(--radius-sm);
  border: 1px solid #dfe3f0;
  background-color: #fbfcff;
  padding: .5rem .75rem;
  font-size: .875rem;
  transition: all .15s ease;
}

.form-control:focus, .form-select:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}

.form-label { font-weight: 500; font-size: .85rem; color: #334155; }
.form-text { font-size: .78rem; }

/* ===== 按钮 ===== */
.btn {
  border-radius: var(--radius-sm);
  font-size: .875rem;
  padding: .45rem 1rem;
  font-weight: 500;
  transition: all .15s ease;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  border: 1px solid transparent;
  box-shadow: 0 4px 12px -4px rgba(79,70,229,.45);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-dark) 0%, #6d28d9 100%);
  border: 1px solid transparent;
  box-shadow: 0 6px 16px -4px rgba(79,70,229,.55);
  transform: translateY(-1px);
}

.btn-outline-primary {
  color: var(--primary);
  border-color: var(--primary);
}
.btn-outline-primary:hover {
  background: var(--primary);
  color: #fff;
}

.btn-sm { padding: .3rem .65rem; font-size: .8rem; }
.btn-xs { padding: .15rem .5rem; font-size: .75rem; }

/* ===== 统计卡片 ===== */
.stat-card {
  padding: 1.25rem;
  border-radius: var(--radius);
  background: #fff;
  border: 1px solid var(--card-border);
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.stat-card .stat-label {
  font-size: .8rem;
  color: #64748b;
  margin-bottom: .25rem;
}

.stat-card .stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.2;
}

.stat-card .stat-icon {
  width: 42px; height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

/* ===== 首页统计卡片网格（5卡等宽铺满） ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: .75rem;
}
@media (min-width: 1200px) {
  .stats-grid { grid-template-columns: repeat(5, 1fr); }
}
.stats-grid .stat-card {
  cursor: pointer;
  height: 100%;
  transition: box-shadow .15s ease, transform .15s ease;
}
.stats-grid .stat-card:hover {
  box-shadow: var(--card-hover-shadow);
  transform: translateY(-2px);
}
.purchase-status-value {
  font-size: 1.15rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* ===== 首页看板大框统一风格 ===== */
.box-title {
  font-size: .95rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: .35rem;
}
.box-sub {
  font-size: .72rem;
  color: #94a3b8;
  font-weight: 400;
  margin-top: 2px;
}
.box-body {
  max-height: 360px;
  overflow-y: hidden;
}
.box-item {
  padding: .7rem 1.1rem;
  border-bottom: 1px solid #f1f5f9;
}
.box-item:last-child { border-bottom: none; }
.quick-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .55rem;
  padding: 1rem 1.1rem;
}
/* ===== 提货卡片 ===== */
.pickup-grid {
}
.pickup-card {
  height: 100%;
  background: #fff;
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  padding: 1.15rem 1.3rem;
  display: flex;
  flex-direction: column;
  gap: .65rem;
  transition: box-shadow .15s ease, transform .15s ease;
}
.pickup-card:hover {
  box-shadow: var(--card-hover-shadow);
  transform: translateY(-2px);
}
.pickup-card.picked {
  background: #f8fafc;
  border-style: dashed;
}
.pickup-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: .5rem;
}
.pickup-addr {
  font-weight: 600;
  font-size: .92rem;
  color: #0f172a;
  word-break: break-all;
  line-height: 1.35;
}
.pickup-line {
  font-size: .84rem;
  color: #475569;
  display: flex;
  gap: .45rem;
  word-break: break-all;
}
.pickup-label {
  color: #94a3b8;
  flex-shrink: 0;
}
.pickup-head-actions {
  display: flex;
  align-items: center;
  gap: .5rem;
}
.pickup-delivery {
  background: #f8fafc;
  border: 1px solid #eef2f7;
  border-radius: 10px;
  padding: .55rem .7rem;
  display: flex;
  flex-direction: column;
  gap: .4rem;
}
.pickup-delivery-head {
  font-size: .72rem;
  font-weight: 700;
  color: #64748b;
  letter-spacing: .02em;
}
.pickup-remark {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  gap: .5rem;
  font-size: .88rem;
  color: #64748b;
  background: #f8fafc;
  border: 1px solid #eef2f7;
  border-radius: 10px;
  padding: .5rem .7rem;
  word-break: break-all;
  line-height: 1.5;
}
.pickup-no {
  font-size: .86rem;
  color: #64748b;
  font-weight: 600;
}
.pickup-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.4;
  word-break: break-all;
  margin-top: .15rem;
}
.pickup-body {
  display: flex;
  align-items: stretch;
  gap: 1rem;
}
.pickup-count {
  flex: 0 1 auto;
  min-width: 68px;
  max-width: 45%;
  background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
  border-radius: 12px;
  padding: .55rem .4rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.pickup-count.picked {
  background: #f1f5f9;
}
.pickup-count-num {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.25;
  word-break: break-all;
  overflow-wrap: anywhere;
  width: 100%;
}
.pickup-count.picked .pickup-count-num {
  color: #94a3b8;
}
.pickup-count-label {
  font-size: .74rem;
  color: #64748b;
  margin-top: 3px;
  font-weight: 500;
}
.pickup-detail {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: .55rem;
}
.pickup-detail-line {
  display: flex;
  align-items: flex-start;
  gap: .5rem;
  font-size: .94rem;
  color: #334155;
  min-width: 0;
}
.pickup-detail-line > .pickup-map-link,
.pickup-detail-line > .pickup-tel-link,
.pickup-detail-line > .pickup-detail-text {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.pickup-detail-icon {
  font-size: .92rem;
  flex-shrink: 0;
  margin-top: 1px;
}
.pickup-detail-tag {
  font-size: .62rem;
  background: #eef2ff;
  color: #4f46e5;
  border-radius: 4px;
  padding: 2px 6px;
  flex-shrink: 0;
  font-weight: 700;
  line-height: 1.4;
  margin-top: 1px;
}
.pickup-detail-text {
  word-break: break-all;
  line-height: 1.5;
}
.pickup-line-strong {
  font-weight: 600;
  color: #0f172a;
  font-size: .9rem;
  line-height: 1.4;
}
.copy-btn {
  border: 1px solid var(--card-border);
  background: #fff;
  border-radius: 10px;
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  color: #64748b;
  padding: 0;
  transition: all .15s ease;
}
.copy-btn:hover {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: var(--primary-light);
}
.copy-btn-blue { background: #eef2ff; color: #4f46e5; border-color: #c7d2fe; }
.copy-btn-blue:hover { background: #e0e7ff; color: #3730a3; border-color: #a5b4fc; }
.copy-btn-green { background: #ecfdf5; color: #059669; border-color: #a7f3d0; }
.copy-btn-green:hover { background: #d1fae5; color: #047857; border-color: #6ee7b7; }
.pickup-card .badge {
  font-size: .82rem;
  padding: .42em .75em;
}
.pickup-prio {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding-top: .55rem;
  border-top: 1px solid #f1f5f9;
  margin-top: auto;
}
.prio-btn {
  border: none;
  background: none;
  font-size: 1.55rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  color: #cbd5e1;
  transition: transform .15s ease;
}
.prio-btn:hover { transform: scale(1.2); }
.prio-btn.prio-1 { color: #ef4444; }
.prio-btn.prio-2 { color: #f59e0b; }
.prio-btn.prio-3 { color: #3b82f6; }
.prio-tag {
  font-size: .78rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
}
.prio-tag-1 { background: #fef2f2; color: #dc2626; }
.prio-tag-2 { background: #fffbeb; color: #b45309; }
.prio-tag-3 { background: #eff6ff; color: #2563eb; }
.prio-tag-0 { background: #f1f5f9; color: #94a3b8; }
.copy-btn.copied {
  background: #d1fae5;
  color: #059669;
  border-color: #6ee7b7;
}
.pickup-stat-chip {
  background: #fff;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  box-shadow: var(--card-shadow);
  padding: .65rem .5rem;
  text-align: center;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.pickup-stat-chip .chip-num {
  font-size: 1.4rem;
  font-weight: 800;
  line-height: 1.1;
}
.pickup-stat-chip .chip-label {
  font-size: .75rem;
  color: #64748b;
  margin-top: 3px;
  font-weight: 500;
}
.chip-primary { color: var(--primary); }
.chip-green { color: #059669; }
.chip-red { color: #dc2626; }
.pickup-card.unpicked {
  border-left: 4px solid #f59e0b;
}
.pickup-card.picked {
  border-left: 4px solid #22c55e;
}
.pickup-card.cancelled {
  border-left: 4px solid #cbd5e1;
  background: #f8fafc;
}
.pickup-card.cancelled .pickup-no,
.pickup-card.cancelled .pickup-title,
.pickup-card.cancelled .pickup-detail {
  color: #94a3b8;
}
.pickup-card.cancelled .pickup-title,
.pickup-card.cancelled .pickup-detail-line {
  text-decoration: line-through;
}
.addr-quick {
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #334155;
  font-weight: 600;
}
.addr-quick:hover {
  background: #eef2ff;
  border-color: #c7d2fe;
  color: #4f46e5;
}
.pickup-map-link {
  color: var(--primary);
  text-decoration: none;
  border-bottom: 1px dashed #c7d2fe;
  word-break: break-all;
  line-height: 1.5;
  transition: color .15s ease;
}
.pickup-map-link:hover {
  color: var(--primary-dark);
  border-bottom-style: solid;
}
.pickup-tel-link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}
.pickup-tel-link:hover {
  text-decoration: underline;
}
.pickup-foot {
  margin-top: auto;
  padding-top: .6rem;
  border-top: 1px solid #f1f5f9;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .5rem;
  font-size: .8rem;
  color: #94a3b8;
}
/* ===== 看板列表 ===== */
.list-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .75rem 0;
  border-bottom: 1px solid #f1f5f9;
}

.list-item:last-child { border-bottom: none; }

/* ===== 分页 ===== */
.pagination { margin-bottom: 0; }
.page-link {
  border: none;
  color: var(--primary);
  padding: .4rem .85rem;
  font-size: .85rem;
  border-radius: var(--radius-sm);
  margin: 0 2px;
}
.page-link:hover { background: #eef2ff; }
.page-item.active .page-link {
  background: var(--primary);
}

/* ===== 提示 ===== */
.alert {
  border: none;
  border-radius: var(--radius-sm);
}

/* ===== 搜索栏 ===== */
.search-bar {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}

/* ===== 标签 & 颜色辅助 ===== */
.text-danger-light { color: #ef4444; }
.bg-danger-soft { background: #fef2f2; }
.bg-warning-soft { background: #fffbeb; }
.bg-success-soft { background: #f0fdf4; }

.stock-low { color: #ef4444; font-weight: 600; }
.stock-ok { color: #22c55e; }

/* ===== 空状态 ===== */
.empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: #94a3b8;
}

.empty-state .empty-icon {
  font-size: 2.5rem;
  margin-bottom: .75rem;
}

/* ===== 加载遮罩 ===== */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.show {
    transform: translateX(0);
  }
  .main-content { margin-left: 0; }
  .mobile-toggle { display: block; }
  .page-content { padding: 1rem; }
  .stat-card .stat-value { font-size: 1.4rem; }
}



/* ===== 发货日历（常规月历） ===== */
.cal-nav { display:flex; align-items:center; justify-content:space-between; margin-bottom:.5rem; }
.cal-month-title { font-weight:600; color:#334155; font-size:.95rem; }
.cal-grid { display:grid; grid-template-columns:repeat(7,1fr); gap:4px; margin-bottom:4px; }
.cal-cell { min-height:44px; display:flex; flex-direction:column; align-items:center; justify-content:center; border-radius:10px; }
.cal-head-cell { min-height:22px; font-size:.72rem; color:#94a3b8; font-weight:600; }
.cal-day { cursor:pointer; border:1.5px solid transparent; background:#f8fafc; transition:all .15s ease; }
.cal-day:hover { transform:scale(1.06); box-shadow:0 3px 10px rgba(0,0,0,.1); }
.cal-day-num { font-size:.95rem; font-weight:600; color:#334155; line-height:1.2; }
.cal-day.cal-today { border-color:#4f46e5; background:#eef2ff; }
.cal-day.cal-today .cal-day-num { color:#3730a3; }
.cal-day.cal-pending { background:#eef2ff; border-color:#c7d2fe; }
.cal-day.cal-pending .cal-day-num { color:#4338ca; }
.cal-day.cal-shipped { background:#dcfce7; border-color:#86efac; }
.cal-day.cal-shipped .cal-day-num { color:#166534; }
.cal-dot { width:6px; height:6px; border-radius:50%; margin-top:3px; }
.dot-shipped { background:#16a34a; }
.dot-pending { background:#6366f1; }
.cal-summary { display:flex; align-items:center; justify-content:space-between; gap:8px; flex-wrap:wrap; margin-top:10px; padding-top:10px; border-top:1px solid #f1f5f9; font-size:.8rem; color:#64748b; }
.cal-summary-main b { color:#4f46e5; font-size:1.05rem; }
.cal-legend { display:inline-flex; align-items:center; gap:12px; font-size:.72rem; color:#64748b; }
.legend-item { display:inline-flex; align-items:center; gap:4px; }
.legend-dot { width:10px; height:10px; border-radius:3px; }
.legend-box { width:10px; height:10px; border-radius:3px; border:2px solid #4f46e5; background:#eef2ff; }



/* ===== 卡片内部翻页箭头 ===== */
.card-scroll-arrows { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; }
.cs-btn { width: 46px; height: 46px; border-radius: 12px; border: 1px solid #e2e8f0; background: #f8fafc; color: #4f46e5; font-size: 1.4rem; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all .15s ease; padding: 0; }
.cs-btn:hover { background: #eef2ff; border-color: #a5b4fc; }
.cs-btn:active { transform: scale(.92); }


/* 缺料配件采购状态徽标 */
.chip-badge { padding: 1px 8px; border-radius: 10px; font-size: .68rem; font-weight: 600; white-space: nowrap; }
.chip-badge.chip-red { background: #fee2e2; color: #dc2626; border: 1px solid #fecaca; }
.chip-badge.chip-yellow { background: #fef3c7; color: #b45309; border: 1px solid #fde68a; }

/* ===== Mobile Responsive ===== */
@media (max-width: 576px) {
  .page-content { padding: .75rem; }
  .card-header { padding: .75rem 1rem; }
  .card-header span { font-size: .85rem; }
  .card-body { padding: .75rem; }
  .stat-card { padding: .85rem; }
  .stat-card .stat-value { font-size: 1.25rem; }
  .purchase-status-value { font-size: 1rem !important; gap: 4px !important; }
  .stat-card .stat-label { font-size: .72rem; }
  .stat-card .stat-icon { width: 34px; height: 34px; font-size: 1rem; }
  .table { font-size: .78rem; }
  .table-wrapper { overflow-x: auto; }
  .top-bar { padding: .6rem 1rem; }
  .top-bar .page-title { font-size: .95rem; }
  .btn { font-size: .82rem; padding: .35rem .75rem; }
  .cs-btn { width: 40px; height: 40px; font-size: 1.2rem; }
  .cal-grid { gap: 2px; }
  .cal-cell { min-height: 38px; }
  .cal-day-num { font-size: .85rem; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: .5rem; }
  .stats-grid .stat-card:last-child:nth-child(odd) { grid-column: 1 / -1; }
}@media (min-width: 577px) and (max-width: 768px) {
  .stat-card .stat-value { font-size: 1.4rem; }
  .table { font-size: .82rem; }
}

.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,.3);
  z-index: 999;
}

@media (max-width: 768px) {
  .sidebar-overlay.active { display: block; }
}


/* ===== 移动端专用样式块 ===== */
.m-only { display: none; }

.ship-badge, .stock-badge {
  padding: 2px 10px; border-radius: 20px; font-size: .72rem; font-weight: 600; white-space: nowrap;
}
.ship-badge.ship-1 { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.ship-badge.ship-0 { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }
.stock-badge.stock-badge-low { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }
.stock-badge.stock-badge-ok { background: #dcfce7; color: #166534; border: 1px solid #86efac; }

@media (max-width: 576px) {
  .m-only { display: inline-flex; }

  /* 搜索栏移动端适配 */
  .search-bar .search-sel, .search-bar .search-inp { width: 100% !important; }
  .search-bar .btn { flex: 1; }

  /* 移动端：表头隐藏、行转卡片 */
  .table-cards thead { display: none; }
  .table-cards, .table-cards tbody, .table-cards tr, .table-cards td { display: block; width: 100%; }
  .table-cards { border: none; }
  .table-cards tbody { display: flex; flex-direction: column; gap: .75rem; }
  .table-cards tr {
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    padding: .55rem .85rem .45rem;
    margin: 0;
  }
  .table-cards td {
    border: none;
    padding: .35rem 0;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .6rem;
  }
  .table-cards td::before {
    content: attr(data-label);
    flex-shrink: 0;
    font-size: .72rem;
    font-weight: 600;
    color: #94a3b8;
  }
  .table-cards td.cell-order {
    padding: .15rem 0 .5rem;
    border-bottom: 1px dashed #eef2f7;
    margin-bottom: .25rem;
  }
  .table-cards td.cell-order::before { content: none; }
  .table-cards .cell-order-no { font-size: 1.05rem; font-weight: 700; color: var(--primary); }
  .table-cards td.cell-progress-wrap { display: block; }
  .table-cards td.cell-progress-wrap::before { content: attr(data-label); display: block; margin-bottom: .15rem; }
  .table-cards .cell-progress { width: 100%; }
  .table-cards td.cell-actions {
    justify-content: flex-end;
    gap: .5rem;
    border-top: 1px solid #f1f5f9;
    padding-top: .55rem;
    margin-top: .2rem;
  }
  .table-cards td.cell-actions::before { content: none; }
  .table-cards .btn-xs { padding: .4rem .8rem; font-size: .82rem; }
  .table-cards .ship-select { width: 110px !important; }
}

/* ===== 移动端整体美化（追加） ===== */
.sidebar-close {
  display: none;
  position: absolute;
  top: 14px; right: 14px;
  width: 36px; height: 36px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.07);
  color: #c7d2fe;
  font-size: 1rem; line-height: 1;
  cursor: pointer;
  align-items: center; justify-content: center;
  z-index: 5;
}
.sidebar-close:active { transform: scale(.9); background: rgba(255,255,255,.14); }

@media (max-width: 768px) {
  /* 侧边栏抽屉优化 */
  .sidebar { width: 280px; box-shadow: 8px 0 40px rgba(15,23,42,.35); }
  .sidebar-close { display: flex; }
  .sidebar-brand { padding-right: 3.2rem; }
  .sidebar-nav a { padding: .85rem 1.3rem; font-size: .95rem; }
  .sidebar-footer a { padding: .45rem 0; }

  /* 顶栏汉堡按钮 */
  .mobile-toggle {
    width: 42px; height: 42px;
    border-radius: 12px;
    background: #f1f5f9;
    font-size: 1.3rem;
    display: flex; align-items: center; justify-content: center;
  }
  .mobile-toggle:active { background: #e2e8f0; }

  /* 表单控件：防 iOS 聚焦缩放 + 大触控区 */
  .form-control, .form-select {
    font-size: 16px !important;
    min-height: 44px;
  }

  /* 按钮触控区放大 */
  .btn { min-height: 40px; }
  .btn-sm { min-height: 38px; }
  .btn-xs { min-height: 36px; }

  /* 分页大按钮 */
  .pagination .page-link {
    min-width: 44px; min-height: 44px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: .95rem;
    margin: 0 2px;
    border-radius: 10px !important;
  }
  .pagination { gap: 2px; }

  /* 页面底部留白（含 iPhone 安全区） */
  .page-content { padding-bottom: calc(2.5rem + env(safe-area-inset-bottom)); }

  /* 闪讯条间距 */
  .page-content > .alert { margin-bottom: 1rem; border-radius: 12px; }
}

@media (max-width: 576px) {
  /* 顶栏收窄时隐藏角色文字，只保留用户名 */
  .top-bar > div:last-child { font-size: .72rem !important; max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .top-bar .page-title { min-width: 0; }
  .top-bar .page-title .sub { display: none; }
  .stats-grid { gap: .6rem; }
  .stat-card { border-radius: 12px; }
  .card { border-radius: 12px; }
  .cs-btn { width: 42px; height: 42px; font-size: 1.25rem; border-radius: 10px; }
}

/* ===== 滚动条主题化 ===== */
/* Chrome / Edge / Safari（WebKit） */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: #eef1f8; border-radius: 6px; }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--primary-light), var(--primary));
  border-radius: 6px;
  border: 2px solid #eef1f8;
}
::-webkit-scrollbar-thumb:hover { background: var(--primary-dark); }
::-webkit-scrollbar-corner { background: transparent; }

/* Firefox */
* { scrollbar-width: thin; scrollbar-color: var(--primary-light) #eef1f8; }

/* 页面级滚动条更细 */
html::-webkit-scrollbar { width: 12px; }

/* 侧边栏（深色背景）内部滚动条 */
.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.28); border: none; }
.sidebar-nav::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.45); }
.sidebar-nav { scrollbar-color: rgba(255,255,255,.28) transparent; }

/* 卡片内部滚动容器（如首页大框） */
.box-body::-webkit-scrollbar { width: 6px; height: 6px; }
.box-body::-webkit-scrollbar-thumb { border-width: 1px; }
.box-body { scrollbar-color: var(--primary-light) #eef1f8; }

/* 表格横向滚动容器 */
.table-wrapper::-webkit-scrollbar { height: 8px; }
