* { margin:0; padding:0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', sans-serif; background: #f0f2f5; color: #333; }

/* ====== 布局 ====== */
.app-container { display: flex; min-height: 100vh; }
.sidebar { width: 220px; background: #001529; color: #fff; display: flex; flex-direction: column; position: fixed; top: 0; left: 0; bottom: 0; z-index: 100; }
.sidebar-logo { padding: 20px 16px; font-size: 18px; font-weight: 700; border-bottom: 1px solid rgba(255,255,255,0.1); display: flex; align-items: center; gap: 10px; }
.sidebar-logo span { color: #ffc53d; }
.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.sidebar-nav a { display: flex; align-items: center; gap: 10px; padding: 12px 20px; color: rgba(255,255,255,0.65); text-decoration: none; font-size: 14px; transition: all 0.2s; }
.sidebar-nav a:hover { color: #fff; background: rgba(255,255,255,0.08); }
.sidebar-nav a.active { color: #fff; background: #1890ff; }
.sidebar-footer { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,0.1); font-size: 12px; color: rgba(255,255,255,0.45); }
.main-content { margin-left: 220px; flex: 1; padding: 24px; min-height: 100vh; }

/* ====== 页面标题 ====== */
.page-header { margin-bottom: 24px; }
.page-header h1 { font-size: 24px; font-weight: 600; color: #1a1a1a; }
.page-header p { font-size: 14px; color: #666; margin-top: 4px; }

/* ====== 卡片 ====== */
.card { background: #fff; border-radius: 8px; padding: 24px; margin-bottom: 16px; box-shadow: 0 1px 2px rgba(0,0,0,0.06); }
.card-title { font-size: 16px; font-weight: 600; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid #f0f0f0; display: flex; justify-content: space-between; align-items: center; }

/* ====== 统计卡片 ====== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: #fff; border-radius: 8px; padding: 20px; box-shadow: 0 1px 2px rgba(0,0,0,0.06); }
.stat-card .stat-value { font-size: 28px; font-weight: 700; color: #1a1a1a; }
.stat-card .stat-label { font-size: 14px; color: #666; margin-top: 4px; }
.stat-card.warning .stat-value { color: #faad14; }
.stat-card.danger .stat-value { color: #f5222d; }
.stat-card.success .stat-value { color: #52c41a; }

/* ====== 表格 ====== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
table th { background: #fafafa; padding: 12px 16px; text-align: left; font-weight: 600; color: #333; border-bottom: 2px solid #e8e8e8; white-space: nowrap; }
table td { padding: 10px 16px; border-bottom: 1px solid #f0f0f0; }
table tr:hover td { background: #f5f5f5; }
table tr.alert-row td { background: #fff2f0; }
table tr.overstock-row td { background: #fffbe6; }

/* ====== 表单 ====== */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.form-group { margin-bottom: 12px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; color: #333; margin-bottom: 4px; }
.form-control { width: 100%; padding: 8px 12px; border: 1px solid #d9d9d9; border-radius: 4px; font-size: 14px; transition: border 0.2s; outline: none; }
.form-control:focus { border-color: #1890ff; box-shadow: 0 0 0 2px rgba(24,144,255,0.2); }
.form-control-sm { padding: 6px 10px; font-size: 13px; }
select.form-control { appearance: auto; }
textarea.form-control { resize: vertical; min-height: 60px; }

/* ====== 按钮 ====== */
.btn { display: inline-flex; align-items: center; gap: 4px; padding: 8px 16px; border: none; border-radius: 4px; font-size: 14px; cursor: pointer; transition: all 0.2s; text-decoration: none; line-height: 1.5; }
.btn-primary { background: #1890ff; color: #fff; }
.btn-primary:hover { background: #40a9ff; }
.btn-success { background: #52c41a; color: #fff; }
.btn-success:hover { background: #73d13d; }
.btn-danger { background: #f5222d; color: #fff; }
.btn-danger:hover { background: #ff4d4f; }
.btn-warning { background: #faad14; color: #fff; }
.btn-warning:hover { background: #ffc53d; }
.btn-default { background: #fff; color: #333; border: 1px solid #d9d9d9; }
.btn-default:hover { border-color: #1890ff; color: #1890ff; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* ====== 搜索栏 ====== */
.search-bar { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 16px; }
.search-bar .form-group { margin-bottom: 0; min-width: 150px; }

/* ====== 徽标 ====== */
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; font-weight: 500; }
.badge-danger { background: #fff1f0; color: #f5222d; }
.badge-warning { background: #fffbe6; color: #faad14; }
.badge-success { background: #f6ffed; color: #52c41a; }
.badge-normal { background: #e6f7ff; color: #1890ff; }

/* ====== 模态框 ====== */
.modal-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.45); z-index: 1000; justify-content: center; align-items: center; }
.modal-overlay.active { display: flex; }
.modal-box { background: #fff; border-radius: 8px; min-width: 500px; max-width: 90vw; max-height: 80vh; overflow-y: auto; box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.modal-header { padding: 16px 24px; border-bottom: 1px solid #f0f0f0; display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: #999; }
.modal-body { padding: 24px; }
.modal-footer { padding: 12px 24px; border-top: 1px solid #f0f0f0; display: flex; justify-content: flex-end; gap: 8px; }

/* ====== 消息提示 ====== */
.toast { position: fixed; top: 24px; right: 24px; z-index: 2000; padding: 12px 20px; border-radius: 6px; font-size: 14px; box-shadow: 0 4px 12px rgba(0,0,0,0.15); transform: translateX(150%); transition: transform 0.3s; max-width: 400px; }
.toast.show { transform: translateX(0); }
.toast-success { background: #f6ffed; border: 1px solid #b7eb8f; color: #52c41a; }
.toast-error { background: #fff2f0; border: 1px solid #ffa39e; color: #f5222d; }
.toast-info { background: #e6f7ff; border: 1px solid #91d5ff; color: #1890ff; }

/* ====== 标签页 ====== */
.tabs { display: flex; gap: 0; border-bottom: 2px solid #f0f0f0; margin-bottom: 16px; }
.tab-item { padding: 10px 20px; cursor: pointer; color: #666; font-size: 14px; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all 0.2s; }
.tab-item:hover { color: #1890ff; }
.tab-item.active { color: #1890ff; border-bottom-color: #1890ff; font-weight: 500; }

/* ====== 工具条 ====== */
.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; flex-wrap: wrap; gap: 8px; }
.toolbar-left { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.toolbar-right { display: flex; gap: 8px; align-items: center; }

/* ====== 登录页 ====== */
.login-page { display: flex; justify-content: center; align-items: center; min-height: 100vh; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.login-box { background: #fff; border-radius: 12px; padding: 40px; width: 380px; box-shadow: 0 8px 32px rgba(0,0,0,0.15); }
.login-box h2 { text-align: center; margin-bottom: 8px; font-size: 24px; color: #1a1a1a; }
.login-box .subtitle { text-align: center; color: #666; margin-bottom: 32px; font-size: 14px; }
.login-box .form-group { margin-bottom: 20px; }
.login-box .btn { width: 100%; padding: 10px; font-size: 16px; }
.login-error { color: #f5222d; font-size: 13px; margin-bottom: 12px; text-align: center; display: none; }

/* ====== 库存详情 ====== */
.stock-table .qty-cell { text-align: center; min-width: 50px; }
.stock-table .qty-low { color: #f5222d; font-weight: 600; }
.stock-table .qty-zero { color: #d9d9d9; }

/* ====== 响应式 ====== */
@media (max-width: 768px) {
  .sidebar { width: 60px; }
  .sidebar-logo span { display: none; }
  .sidebar-nav a span { display: none; }
  .main-content { margin-left: 60px; padding: 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .modal-box { min-width: auto; width: 95vw; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ====== 加载状态 ====== */
.loading { text-align: center; padding: 40px; color: #999; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading::before { content: ''; display: inline-block; width: 24px; height: 24px; border: 3px solid #e8e8e8; border-top-color: #1890ff; border-radius: 50%; animation: spin 0.8s linear infinite; margin-right: 8px; vertical-align: middle; }

/* ====== 空状态 ====== */
.empty-state { text-align: center; padding: 40px; color: #999; }
.empty-state .icon { font-size: 48px; margin-bottom: 12px; }
