/* ============================================================
   库存系统 - 设计系统
   ============================================================ */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #dbeafe;
  --bg: #f1f5f9;
  --sidebar-bg: #0f172a;
  --sidebar-hover: #1e293b;
  --sidebar-active: #2563eb;
  --card-bg: #ffffff;
  --text: #1e293b;
  --text-secondary: #64748b;
  --text-light: #94a3b8;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --success: #10b981;
  --success-bg: #d1fae5;
  --warning: #d97706;
  --warning-bg: #fef3c7;
  --danger: #dc2626;
  --danger-bg: #fee2e2;
  --info: #2563eb;
  --info-bg: #dbeafe;
  --purple: #7c3aed;
  --purple-bg: #ede9fe;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -2px rgba(0,0,0,.05);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.08), 0 4px 6px -4px rgba(0,0,0,.05);
  --radius: 10px;
  --radius-sm: 6px;
  --sidebar-width: 220px;
  --topbar-height: 56px;
}

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

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

a { color: var(--primary); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ============ 通用按钮 ============ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: #fff;
  color: var(--text); font-size: 14px; font-weight: 500;
  transition: all .15s ease; white-space: nowrap;
}
.btn:hover { background: var(--border-light); }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover { filter: brightness(.92); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(.92); }
.btn-danger-plain { color: var(--danger); }
.btn-danger-plain:hover { background: var(--danger-bg, #fee2e2); border-color: var(--danger); }
.btn-warning { background: var(--warning); border-color: var(--warning); color: #fff; }
.btn-sm { padding: 4px 10px; font-size: 12px; border-radius: 5px; }
.btn-lg { padding: 10px 24px; font-size: 15px; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-icon {
  width: 28px; height: 28px; padding: 0; display: inline-flex;
  align-items: center; justify-content: center; border-radius: 5px;
  border: 1px solid var(--border); background: #fff;
}
.btn-icon:hover { background: var(--border-light); }
.btn-icon svg { width: 14px; height: 14px; }
.btn-icon.danger:hover { background: var(--danger-bg); color: var(--danger); border-color: var(--danger); }
.btn-icon.primary:hover { background: var(--primary-light); color: var(--primary); border-color: var(--primary); }

/* ============ 登录页 ============ */
.login-page {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 50%, #2563eb 100%);
  overflow: hidden;
}
.login-bg-shape {
  position: absolute; border-radius: 50%;
  background: rgba(255,255,255,.05);
  animation: float 8s ease-in-out infinite;
}
.shape-1 { width: 500px; height: 500px; top: -150px; left: -100px; }
.shape-2 { width: 300px; height: 300px; bottom: -80px; right: -60px; animation-delay: 2s; }
.shape-3 { width: 150px; height: 150px; top: 30%; right: 20%; animation-delay: 4s; }
@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-30px) rotate(10deg); }
}
.login-card {
  position: relative; z-index: 2; width: 400px;
  background: #fff; border-radius: 16px; padding: 40px 36px;
  box-shadow: 0 25px 50px rgba(0,0,0,.25);
  animation: loginIn .5s ease;
}
@keyframes loginIn {
  from { opacity: 0; transform: translateY(30px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo-icon {
  width: 56px; height: 56px; margin: 0 auto 16px;
  background: linear-gradient(135deg, var(--primary), #3b82f6);
  border-radius: 14px; display: flex; align-items: center; justify-content: center;
  color: #fff;
}
.login-logo-icon svg { width: 28px; height: 28px; }
.login-logo h1 { font-size: 22px; font-weight: 700; color: var(--text); }
.login-logo p { font-size: 13px; color: var(--text-secondary); margin-top: 6px; }
.login-card .form-group { margin-bottom: 18px; }
.login-card .form-group label { display: block; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.input-wrap { position: relative; }
.input-wrap svg:first-child {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--text-light); pointer-events: none;
}
.input-wrap input {
  width: 100%; padding: 10px 12px 10px 38px;
  border: 1.5px solid var(--border); border-radius: 8px;
  font-size: 14px; outline: none; transition: border-color .15s;
  background: #fff; color: var(--text);
}
.input-wrap input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.input-wrap input.error { border-color: var(--danger); }
.input-wrap .toggle-pwd {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--text-light); padding: 4px;
  display: flex; align-items: center;
}
.toggle-pwd svg { width: 16px; height: 16px; }
.field-error { font-size: 12px; color: var(--danger); margin-top: 4px; min-height: 16px; }
.login-alert {
  display: none; padding: 10px 14px; margin-bottom: 16px;
  background: var(--danger-bg); color: var(--danger);
  border-radius: 8px; font-size: 13px; border: 1px solid #fecaca;
}
.login-alert.show { display: block; animation: shake .4s ease; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}
.login-card .btn-block { padding: 11px; font-size: 15px; margin-top: 4px; }
.login-tip {
  margin-top: 14px; text-align: center;
  font-size: 12px; color: var(--text-light);
  background: var(--border-light); padding: 8px; border-radius: 6px;
}
.login-footer-links { margin-top: 14px; text-align: center; }
.link-muted { color: var(--text-light); font-size: 13px; }
.link-muted:hover { color: var(--primary); }
.login-copyright {
  position: absolute; bottom: 20px; left: 0; right: 0;
  text-align: center; color: rgba(255,255,255,.5); font-size: 12px; z-index: 2;
}

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

/* ---- 侧边栏 ---- */
.sidebar {
  width: var(--sidebar-width); background: var(--sidebar-bg);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 50;
  transition: transform .25s ease;
}
.sidebar-logo {
  height: var(--topbar-height); display: flex; align-items: center;
  padding: 0 18px; gap: 10px; border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-logo-icon {
  width: 32px; height: 32px; border-radius: 8px;
  background: linear-gradient(135deg, var(--primary), #3b82f6);
  display: flex; align-items: center; justify-content: center;
  color: #fff; flex-shrink: 0;
}
.sidebar-logo-icon svg { width: 18px; height: 18px; }
.sidebar-logo-text { color: #fff; font-size: 16px; font-weight: 700; letter-spacing: 1px; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 10px; }
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 2px; }
.nav-section-title {
  font-size: 11px; color: rgba(255,255,255,.35); font-weight: 600;
  padding: 14px 10px 6px; text-transform: uppercase; letter-spacing: 1px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 8px; margin-bottom: 2px;
  color: rgba(255,255,255,.65); font-size: 14px; transition: all .15s;
  position: relative;
}
.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; }
.nav-item:hover { background: var(--sidebar-hover); color: #fff; }
.nav-item.active { background: var(--sidebar-active); color: #fff; font-weight: 600; }
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.08);
}
.sidebar-user-avatar, .topbar-user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #06b6d4);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { color: #fff; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { color: rgba(255,255,255,.45); font-size: 11px; }
.sidebar-logout {
  background: none; border: none; color: rgba(255,255,255,.45);
  padding: 6px; border-radius: 6px; display: flex;
  transition: all .15s;
}
.sidebar-logout:hover { color: #fff; background: rgba(255,255,255,.1); }
.sidebar-logout svg { width: 16px; height: 16px; }

/* ---- 主区域 ---- */
.main {
  flex: 1; margin-left: var(--sidebar-width);
  display: flex; flex-direction: column; min-height: 100vh;
  min-width: 0;
}
.topbar {
  height: var(--topbar-height); background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 24px; gap: 14px;
  position: sticky; top: 0; z-index: 40;
}
.topbar-toggle {
  background: none; border: none; color: var(--text-secondary);
  padding: 6px; border-radius: 6px; display: none;
}
.topbar-toggle svg { width: 20px; height: 20px; }
.topbar-toggle:hover { background: var(--border-light); }
.topbar-title { font-size: 17px; font-weight: 700; color: var(--text); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 18px; }
.topbar-date { font-size: 13px; color: var(--text-secondary); }
.topbar-user { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--text); cursor: pointer; padding: 6px 10px; border-radius: 8px; transition: background .15s; }
.topbar-user:hover { background: rgba(0, 0, 0, .05); }

/* 个人信息设置弹窗 */
.profile-head { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; padding-bottom: 18px; border-bottom: 1px solid var(--border); }
.profile-avatar { width: 52px; height: 52px; border-radius: 50%; background: linear-gradient(135deg, #4f7cff, #6a5cff); color: #fff; font-size: 22px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.profile-name { font-size: 16px; font-weight: 700; margin-bottom: 2px; }
.profile-section { font-size: 13px; font-weight: 700; margin: 18px 0 10px; padding-top: 16px; border-top: 1px dashed var(--border); color: var(--text); }
.content { flex: 1; padding: 24px; }

/* ============ 页面通用 ============ */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; flex-wrap: wrap; gap: 12px;
}
.page-header h3 { font-size: 18px; font-weight: 700; }
.page-header .sub { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.header-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.card {
  background: var(--card-bg); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); border: 1px solid var(--border-light);
}
.card-body { padding: 20px; }
.card-header {
  padding: 16px 20px; border-bottom: 1px solid var(--border-light);
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.card-header h4 { font-size: 15px; font-weight: 700; }

/* ============ 仪表盘 ============ */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card {
  background: #fff; border-radius: var(--radius); padding: 20px;
  border: 1px solid var(--border-light); box-shadow: var(--shadow-sm);
  cursor: pointer; transition: all .2s ease; position: relative; overflow: hidden;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.stat-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--primary);
}
.stat-card.sc-blue::before { background: var(--primary); }
.stat-card.sc-green::before { background: var(--success); }
.stat-card.sc-orange::before { background: var(--warning); }
.stat-card.sc-purple::before { background: var(--purple); }
.stat-card.sc-red::before { background: var(--danger); }
.stat-card.sc-cyan::before { background: #06b6d4; }
.stat-label { font-size: 13px; color: var(--text-secondary); margin-bottom: 8px; display: flex; align-items: center; justify-content: space-between; }
.stat-icon {
  width: 32px; height: 32px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
}
.stat-icon svg { width: 16px; height: 16px; }
.stat-icon.blue { background: var(--primary-light); color: var(--primary); }
.stat-icon.green { background: var(--success-bg); color: var(--success); }
.stat-icon.orange { background: var(--warning-bg); color: var(--warning); }
.stat-icon.purple { background: var(--purple-bg); color: var(--purple); }
.stat-icon.red { background: var(--danger-bg); color: var(--danger); }
.stat-icon.cyan { background: #cffafe; color: #0891b2; }
.stat-value { font-size: 26px; font-weight: 800; color: var(--text); line-height: 1.2; }
.stat-value.danger { color: var(--danger); }
.stat-trend { font-size: 12px; color: var(--text-light); margin-top: 6px; display: flex; align-items: center; gap: 4px; }
.trend-up { color: var(--success); font-weight: 600; }
.trend-down { color: var(--danger); font-weight: 600; }

.dashboard-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
.chart-wrap { position: relative; height: 320px; padding: 16px 20px; }
.chart-wrap-sm { position: relative; height: 280px; padding: 16px 20px; }

.todo-list { list-style: none; }
.todo-item {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 0; border-bottom: 1px solid var(--border-light);
}
.todo-item:last-child { border-bottom: none; }
.todo-icon {
  width: 36px; height: 36px; border-radius: 8px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.todo-icon svg { width: 16px; height: 16px; }
.todo-body { flex: 1; min-width: 0; }
.todo-title { font-size: 14px; font-weight: 600; color: var(--text); }
.todo-desc { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.todo-badge { flex-shrink: 0; }
.quick-links { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.quick-link {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 18px 10px; border-radius: var(--radius); cursor: pointer;
  background: var(--border-light); transition: all .2s; border: 1px solid transparent;
  color: var(--text); font-size: 13px; font-weight: 600;
}
.quick-link:hover { background: var(--primary-light); color: var(--primary); transform: translateY(-2px); }
.quick-link svg { width: 22px; height: 22px; }

/* ============ 筛选工具栏 ============ */
.filter-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 14px 20px; border-bottom: 1px solid var(--border-light);
  background: #fafbfd; border-radius: var(--radius) var(--radius) 0 0;
}
.filter-bar .form-control, .filter-bar select { width: auto; }
.filter-spacer { flex: 1; }
.search-input { position: relative; }
.search-input input { padding-left: 32px; }
.search-input svg {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px; color: var(--text-light); pointer-events: none;
}

/* ============ 表单控件 ============ */
.form-control {
  width: 100%; padding: 8px 12px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: 14px; outline: none; transition: border-color .15s;
  color: var(--text); background: #fff; font-family: inherit;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.08); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 70px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-item { margin-bottom: 16px; }
.form-item label { display: block; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.form-item label .req { color: var(--danger); margin-left: 2px; }
.form-item .form-control { width: 100%; }
.form-hint { font-size: 12px; color: var(--text-light); margin-top: 4px; }

/* ============ 表格 ============ */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  text-align: left; padding: 11px 14px;
  background: #f8fafc; color: var(--text-secondary);
  font-weight: 600; font-size: 12px; white-space: nowrap;
  border-bottom: 1px solid var(--border);
  text-transform: uppercase; letter-spacing: .3px;
}
.data-table td { padding: 11px 14px; border-bottom: 1px solid var(--border-light); vertical-align: middle; }
.data-table tbody tr { transition: background .12s; }
.data-table tbody tr:hover { background: #f8fafc; }
.data-table tbody tr.row-danger { background: #fef2f2; }
.data-table tbody tr.row-danger:hover { background: #fee2e2; }
.data-table .cell-main { font-weight: 600; color: var(--text); }
.data-table .cell-sub { font-size: 12px; color: var(--text-light); margin-top: 1px; }
/* 可点击的订单号：蓝色、悬停下划线 */
.order-link { color: var(--primary, #1a56db); font-weight: 600; text-decoration: none; cursor: pointer; }
.order-link:hover { text-decoration: underline; }
.table-actions { display: flex; gap: 6px; justify-content: flex-end; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-danger { color: var(--danger); font-weight: 600; }
.text-success { color: var(--success); font-weight: 600; }
.text-warning { color: var(--warning); font-weight: 600; }
.text-muted { color: var(--text-light); }
.money { font-variant-numeric: tabular-nums; font-weight: 600; }
.text-ellipsis { max-width: 180px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 复选框列 */
.data-table .col-check { width: 36px; }
input[type="checkbox"] {
  width: 15px; height: 15px; accent-color: var(--primary); cursor: pointer;
}

/* ============ 状态标签 ============ */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 20px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.badge::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge-blue { background: var(--info-bg); color: var(--info); }
.badge-green { background: var(--success-bg); color: #059669; }
.badge-orange { background: var(--warning-bg); color: var(--warning); }
.badge-red { background: var(--danger-bg); color: var(--danger); }
.badge-gray { background: #f1f5f9; color: var(--text-secondary); }
.badge-purple { background: var(--purple-bg); color: var(--purple); }
.badge-cyan { background: #cffafe; color: #0891b2; }

/* ============ 分页 ============ */
.pagination {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; flex-wrap: wrap; gap: 10px;
}
.pagination-info { font-size: 13px; color: var(--text-secondary); }
.pagination-btns { display: flex; gap: 6px; align-items: center; }
.page-btn {
  min-width: 30px; height: 30px; padding: 0 8px;
  border: 1px solid var(--border); border-radius: 6px; background: #fff;
  font-size: 13px; color: var(--text-secondary); display: inline-flex;
  align-items: center; justify-content: center; transition: all .15s;
}
.page-btn:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ============ 弹窗 ============ */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15,23,42,.5);
  z-index: 200; display: none; backdrop-filter: blur(2px);
  opacity: 0; transition: opacity .2s;
}
.modal-overlay.show { display: block; opacity: 1; }
.modal {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%) scale(.96);
  background: #fff; border-radius: 14px; z-index: 201;
  width: 560px; max-width: calc(100vw - 40px);
  max-height: calc(100vh - 60px); display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg); opacity: 0; transition: all .2s ease;
}
.modal.show { opacity: 1; transform: translate(-50%,-50%) scale(1); }
.modal-lg { width: 760px; }
.modal-xl { width: 900px; }
.modal-sm { width: 420px; }
.modal-header {
  padding: 18px 24px; border-bottom: 1px solid var(--border-light);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-header h3 { font-size: 17px; font-weight: 700; }
.modal-close {
  background: none; border: none; color: var(--text-light);
  padding: 6px; border-radius: 6px; display: flex; transition: all .15s;
}
.modal-close:hover { background: var(--border-light); color: var(--text); }
.modal-close svg { width: 18px; height: 18px; }
.modal-body { padding: 24px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 16px 24px; border-top: 1px solid var(--border-light);
  display: flex; justify-content: flex-end; gap: 10px;
}

/* 详情字段 */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 20px; }
.detail-item .detail-label { font-size: 12px; color: var(--text-light); margin-bottom: 3px; }
.detail-item .detail-value { font-size: 14px; font-weight: 600; color: var(--text); }
.detail-item.full { grid-column: 1 / -1; }

/* 订单商品行 */
.order-items-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.order-items-table th { text-align: left; padding: 8px 10px; background: #f8fafc; color: var(--text-secondary); font-size: 12px; border-bottom: 1px solid var(--border); }
.order-items-table td { padding: 8px 10px; border-bottom: 1px solid var(--border-light); }
.item-line-total { font-weight: 700; color: var(--text); }
.order-total-bar {
  display: flex; justify-content: flex-end; align-items: center; gap: 20px;
  padding: 14px 10px; font-size: 14px;
}
.order-total-bar .total-num { font-size: 20px; font-weight: 800; color: var(--danger); }

/* 编辑商品行：弹性列宽，无固定像素距离，随容器自适应（商品/批号/封装/库位/数量/单价/小计/删除） */
.edit-item-row { display: grid; grid-template-columns: minmax(150px, 1.7fr) minmax(68px, 1fr) minmax(68px, 1fr) minmax(68px, 1fr) minmax(54px, .8fr) minmax(64px, 1fr) minmax(64px, 1fr) auto 28px; gap: 8px; margin-bottom: 8px; align-items: center; }
.edit-item-head { margin-bottom: 4px; font-size: 12px; color: var(--text-light); font-weight: 500; }
.edit-item-head span { padding: 0 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.edit-item-row .line-total { font-size: 13px; font-weight: 700; text-align: right; padding-right: 4px; }

/* ---- 商品搜索选择器（可输入过滤 + 下拉选择） ---- */
.ppicker { position: relative; }
.ppicker .pp-input { padding-right: 30px; cursor: text; }
.ppicker .pp-caret { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; color: var(--text-light); pointer-events: none; }
.pp-dropdown { display: none; position: absolute; top: calc(100% + 4px); left: 0; right: 0; background: #fff; border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 24px rgba(15, 23, 42, .14); z-index: 60; max-height: 240px; overflow-y: auto; }
.pp-dropdown.show { display: block; }
.pp-opt { padding: 8px 12px; cursor: pointer; }
.pp-opt + .pp-opt { border-top: 1px solid var(--border-light); }
.pp-opt:hover, .pp-opt.active { background: #eff6ff; }
.pp-name { font-size: 13px; font-weight: 600; color: var(--text); line-height: 1.4; }
.pp-name .pp-code { color: var(--text-secondary); font-weight: 500; margin-right: 4px; }
.pp-spec { font-weight: 400; color: var(--text-light); margin-left: 6px; font-size: 12px; }
.pp-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.pp-stock { color: var(--success); }
.pp-low { color: var(--danger); font-weight: 600; }
.pp-empty { padding: 14px; text-align: center; font-size: 13px; color: var(--text-light); }
.pp-new { border-top: 1px dashed var(--border); }
.pp-new .pp-name { color: var(--primary); display: flex; align-items: center; gap: 6px; }
.pp-new-tag { font-size: 11px; font-weight: 600; background: #eff6ff; color: var(--primary); border: 1px solid #bfdbfe; border-radius: 4px; padding: 0 5px; line-height: 18px; flex: none; }
.pp-new-hint { font-size: 12px; color: var(--text-light); margin-top: 2px; }

/* ============ Toast ============ */
.toast-container {
  position: fixed; top: 20px; right: 20px; z-index: 300;
  display: flex; flex-direction: column; gap: 10px;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px; border-radius: 10px; background: #fff;
  box-shadow: var(--shadow-lg); font-size: 14px; font-weight: 500;
  border-left: 4px solid var(--primary);
  animation: toastIn .3s ease; min-width: 260px; max-width: 380px;
}
.toast.success { border-left-color: var(--success); }
.toast.success .toast-icon { color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.error .toast-icon { color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast.warning .toast-icon { color: var(--warning); }
.toast.info { border-left-color: var(--primary); }
.toast.info .toast-icon { color: var(--primary); }
.toast-icon { display: flex; flex-shrink: 0; }
.toast-icon svg { width: 18px; height: 18px; }
.toast.fade-out { animation: toastOut .3s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateX(60px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(60px); } }

/* ============ 空状态 ============ */
.empty-state {
  padding: 60px 20px; text-align: center; color: var(--text-light);
}
.empty-state svg { width: 48px; height: 48px; margin-bottom: 12px; color: #cbd5e1; }
.empty-state .empty-title { font-size: 15px; font-weight: 600; color: var(--text-secondary); margin-bottom: 4px; }
.empty-state .empty-desc { font-size: 13px; }

/* ============ 标签页 ============ */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border-light); margin-bottom: 20px; flex-wrap: wrap; }
.tab {
  padding: 10px 18px; font-size: 14px; font-weight: 600;
  color: var(--text-secondary); cursor: pointer; background: none;
  border: none; border-bottom: 2px solid transparent; margin-bottom: -2px;
  transition: all .15s; border-radius: 6px 6px 0 0;
  display: inline-flex; align-items: center; gap: 6px;
}
.tab:hover { color: var(--primary); background: var(--primary-light); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab .tab-count {
  background: var(--border-light); color: var(--text-secondary);
  font-size: 11px; padding: 1px 7px; border-radius: 10px;
}
.tab.active .tab-count { background: var(--primary-light); color: var(--primary); }

/* ============ 汇总条 ============ */
.summary-bar {
  display: flex; gap: 24px; flex-wrap: wrap;
  padding: 14px 20px; background: #fafbfd;
  border-radius: 0 0 var(--radius) var(--radius);
  font-size: 13px; color: var(--text-secondary);
  border-top: 1px solid var(--border-light);
}
.summary-bar b { color: var(--text); font-size: 14px; }

/* ============ 报表 ============ */
.report-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.report-kpi { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 16px; }
.report-kpi-item {
  background: #fff; border: 1px solid var(--border-light); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow-sm);
}
.report-kpi-item .kpi-label { font-size: 12px; color: var(--text-secondary); }
.report-kpi-item .kpi-value { font-size: 20px; font-weight: 800; margin-top: 4px; }

/* ============ 导入反馈 ============ */
.import-result { margin-top: 16px; }
.import-result-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 8px;
}
.import-result-item.ok { background: var(--success-bg); color: #065f46; }
.import-result-item.fail { background: var(--danger-bg); color: #991b1b; }

/* ============ 库存进度条 ============ */
.stock-bar { width: 100px; }
.stock-bar .bar-track { height: 6px; background: var(--border-light); border-radius: 3px; overflow: hidden; }
.stock-bar .bar-fill { height: 100%; border-radius: 3px; transition: width .3s; }
.stock-bar .bar-fill.ok { background: var(--success); }
.stock-bar .bar-fill.low { background: var(--warning); }
.stock-bar .bar-fill.crit { background: var(--danger); }

/* ============ 响应式 ============ */
@media (max-width: 1024px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .report-grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: 0 0 40px rgba(0,0,0,.3); }
  .main { margin-left: 0; }
  .topbar-toggle { display: flex; }
  .content { padding: 14px; }
  .form-row { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .quick-links { grid-template-columns: repeat(2, 1fr); }
  .login-card { width: calc(100vw - 32px); padding: 30px 24px; }
  .edit-item-row { grid-template-columns: minmax(110px, 1.5fr) minmax(52px, 1fr) minmax(52px, 1fr) minmax(52px, 1fr) minmax(44px, .8fr) minmax(50px, 1fr) minmax(50px, 1fr) auto 24px; gap: 6px; }
}
.sidebar-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 49; display: none;
}
.sidebar-mask.show { display: block; }

/* 打印 */
@media print {
  .sidebar, .topbar, .filter-bar, .pagination, .header-actions, .btn, .tabs { display: none !important; }
  .main { margin-left: 0; }
  .content { padding: 0; }
  .card { box-shadow: none; border: 1px solid #ccc; }
}

/* 滚动条 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* 登录/注册标签页 */
.login-tabs {
  display: flex; gap: 6px; margin-bottom: 20px;
  background: #f1f5f9; border-radius: 8px; padding: 4px;
}
.login-tab {
  flex: 1; padding: 8px 0; border: none; background: transparent; border-radius: 6px;
  font-size: 14px; font-weight: 600; color: #64748b; cursor: pointer; transition: all .2s;
}
.login-tab.active {
  background: #fff; color: var(--primary, #2563eb);
  box-shadow: 0 1px 3px rgba(0,0,0,.1);
}
.login-tab:hover:not(.active) { color: #334155; }
