/* ===== 全局样式 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
    --primary: #1890ff;
    --primary-dark: #096dd9;
    --primary-light: #e6f7ff;
    --success: #52c41a;
    --warning: #faad14;
    --danger: #ff4d4f;
    --text: #333;
    --text-secondary: #666;
    --text-light: #999;
    --border: #e8e8e8;
    --bg: #f5f5f5;
    --bg-white: #fff;
    --sidebar-bg: #001529;
    --sidebar-hover: #1890ff;
    --radius: 6px;
    --shadow: 0 2px 8px rgba(0,0,0,.1);
    --shadow-lg: 0 4px 16px rgba(0,0,0,.15);
}
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    color: var(--text);
    background: var(--bg);
    font-size: 14px;
    line-height: 1.6;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; }
ul, ol { list-style: none; }

/* ===== 顶部导航栏 ===== */
.topbar {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
    height: 56px;
    display: flex;
    align-items: center;
    padding: 0 24px;
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 100;
    box-shadow: 0 1px 4px rgba(0,0,0,.05);
}
.topbar-logo { font-size: 20px; font-weight: 700; color: var(--primary); margin-right: 40px; }
.topbar-logo span { color: var(--text); font-weight: 400; font-size: 14px; margin-left: 8px; }
.topbar-nav { display: flex; gap: 4px; }
.topbar-nav a {
    display: block; padding: 8px 16px; color: var(--text); border-radius: var(--radius);
    transition: all .2s; font-size: 14px;
}
.topbar-nav a:hover, .topbar-nav a.active { color: var(--primary); background: var(--primary-light); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.topbar-user { display: flex; align-items: center; gap: 8px; cursor: pointer; position: relative; }
.topbar-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 14px; }
.topbar-dropdown {
    position: absolute; top: 100%; right: 0; background: #fff; border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow-lg); min-width: 150px;
    display: none; padding: 4px 0; margin-top: 8px;
}
.topbar-dropdown.show { display: block; }
.topbar-dropdown a { display: block; padding: 8px 16px; color: var(--text); }
.topbar-dropdown a:hover { background: var(--primary-light); color: var(--primary); }
.topbar-dropdown .divider { border-top: 1px solid var(--border); margin: 4px 0; }
.topbar-badge { position: relative; }
.topbar-badge .badge {
    position: absolute; top: -6px; right: -10px; background: var(--danger); color: #fff;
    font-size: 10px; width: 18px; height: 18px; border-radius: 50%; display: flex;
    align-items: center; justify-content: center;
}
.topbar-cart { font-size: 20px; cursor: pointer; }

/* ===== 按钮 ===== */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 8px 20px; border: 1px solid var(--border); border-radius: var(--radius);
    font-size: 14px; cursor: pointer; transition: all .2s; background: #fff; color: var(--text);
    white-space: nowrap;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #ff7875; color: #fff; }
.btn-warning { background: var(--warning); color: #fff; border-color: var(--warning); }
.btn-sm { padding: 4px 12px; font-size: 12px; }
.btn-lg { padding: 12px 32px; font-size: 16px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-text { background: transparent; border-color: transparent; color: var(--primary); }
.btn-text:hover { background: var(--primary-light); }

/* ===== 表单 ===== */
.form-group { margin-bottom: 16px; }
.form-label { display: block; margin-bottom: 6px; font-weight: 500; color: var(--text); }
.form-label .required { color: var(--danger); margin-left: 4px; }
.form-input, .form-select, .form-textarea {
    width: 100%; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius);
    font-size: 14px; outline: none; transition: border-color .2s; font-family: inherit;
}
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(24,144,255,.2); }
.form-textarea { resize: vertical; min-height: 80px; }
.form-select { background: #fff; cursor: pointer; }
.form-check { display: flex; align-items: center; gap: 8px; }
.form-check input[type="checkbox"], .form-check input[type="radio"] { width: 16px; height: 16px; }
.form-hint { font-size: 12px; color: var(--text-light); margin-top: 4px; }
.form-error { font-size: 12px; color: var(--danger); margin-top: 4px; }
.form-row { display: flex; gap: 16px; }
.form-row > * { flex: 1; }
.form-inline { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.form-inline .form-group { margin-bottom: 0; }

/* ===== 卡片 ===== */
.card {
    background: var(--bg-white); border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 24px; margin-bottom: 16px;
}
.card-header {
    display: flex; align-items: center; justify-content: space-between;
    padding-bottom: 16px; border-bottom: 1px solid var(--border); margin-bottom: 16px;
}
.card-title { font-size: 16px; font-weight: 600; }

/* ===== 表格 ===== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
table th, table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); }
table th { background: #fafafa; font-weight: 600; color: var(--text-secondary); white-space: nowrap; }
table tr:hover { background: #fafafa; }
table .text-right { text-align: right; }
table .text-center { text-align: center; }

/* ===== 分页 ===== */
.pagination { display: flex; justify-content: center; align-items: center; gap: 8px; margin-top: 16px; }
.pagination button {
    padding: 6px 12px; border: 1px solid var(--border); background: #fff;
    border-radius: var(--radius); cursor: pointer; transition: all .2s;
}
.pagination button:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.pagination button.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination button:disabled { opacity: .5; cursor: not-allowed; }
.pagination .page-info { color: var(--text-secondary); font-size: 13px; }

/* ===== 标签/徽章 ===== */
.tag {
    display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 12px;
    margin-right: 4px;
}
.tag-primary { background: var(--primary-light); color: var(--primary); }
.tag-success { background: #f6ffed; color: var(--success); }
.tag-warning { background: #fffbe6; color: var(--warning); }
.tag-danger { background: #fff2f0; color: var(--danger); }
.tag-default { background: #f5f5f5; color: var(--text-secondary); }

/* ===== 弹框 ===== */
.modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,.45);
    z-index: 200; display: flex; align-items: center; justify-content: center;
}
.modal {
    background: #fff; border-radius: 8px; box-shadow: var(--shadow-lg);
    width: 90%; max-width: 600px; max-height: 85vh; overflow-y: auto;
    display: flex; flex-direction: column;
}
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 24px; border-bottom: 1px solid var(--border);
    flex-shrink: 0; position: sticky; top: 0; background: #fff; z-index: 1;
}
.modal-header h3 { font-size: 16px; }
.modal-close { font-size: 20px; cursor: pointer; color: var(--text-light); background: none; border: none; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 24px; overflow-y: auto; flex: 1; }
.modal-footer {
    padding: 12px 24px; border-top: 1px solid var(--border);
    display: flex; justify-content: flex-end; gap: 12px;
    flex-shrink: 0;
}

/* ===== 消息提示 ===== */
.toast-container { position: fixed; top: 72px; right: 24px; z-index: 300; display: flex; flex-direction: column; gap: 8px; }
.toast {
    padding: 12px 20px; border-radius: var(--radius); box-shadow: var(--shadow-lg);
    display: flex; align-items: center; gap: 8px; animation: slideIn .3s; min-width: 280px;
}
.toast-success { background: #f6ffed; border: 1px solid #b7eb8f; color: #52c41a; }
.toast-error { background: #fff2f0; border: 1px solid #ffccc7; color: #ff4d4f; }
.toast-warning { background: #fffbe6; border: 1px solid #ffe58f; color: #faad14; }
.toast-info { background: #e6f7ff; border: 1px solid #91d5ff; color: #1890ff; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ===== 加载状态 ===== */
.loading { text-align: center; padding: 40px; color: var(--text-light); }
.loading-spinner {
    display: inline-block; width: 32px; height: 32px; border: 3px solid var(--border);
    border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== 搜索栏 ===== */
.search-bar {
    display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap;
    padding: 16px 0;
}
.search-bar .form-group { margin-bottom: 0; }
.search-bar .form-input { min-width: 200px; }

/* ===== 空状态 ===== */
.empty { text-align: center; padding: 60px 20px; color: var(--text-light); }
.empty-icon { font-size: 48px; margin-bottom: 12px; }

/* ===== 商品卡片 ===== */
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.product-card {
    background: #fff; border-radius: var(--radius); overflow: hidden;
    box-shadow: var(--shadow); transition: all .3s; cursor: pointer;
}
.product-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.product-card-img { height: 200px; background: #f5f5f5; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.product-card-img img { width: 100%; height: 100%; object-fit: cover; }
.product-card-body { padding: 16px; }
.product-card-name { font-size: 14px; font-weight: 500; margin-bottom: 8px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.product-card-price { color: var(--danger); font-size: 18px; font-weight: 600; }
.product-card-price .unit { font-size: 12px; font-weight: 400; }
.product-card-footer { display: flex; justify-content: space-between; align-items: center; padding: 0 16px 16px; }
.product-card-sales { font-size: 12px; color: var(--text-light); }

/* ===== 步骤条 ===== */
.steps { display: flex; margin-bottom: 24px; }
.step { flex: 1; text-align: center; position: relative; }
.step::after {
    content: ''; position: absolute; top: 14px; left: 50%; right: -50%; height: 2px;
    background: var(--border); z-index: 0;
}
.step:last-child::after { display: none; }
.step-num {
    width: 30px; height: 30px; border-radius: 50%; background: var(--border);
    color: var(--text-light); display: inline-flex; align-items: center; justify-content: center;
    font-weight: 600; position: relative; z-index: 1; margin-bottom: 8px;
}
.step.active .step-num { background: var(--primary); color: #fff; }
.step.active::after { background: var(--primary); }
.step.completed .step-num { background: var(--success); color: #fff; }
.step.completed::after { background: var(--success); }
.step-label { font-size: 13px; color: var(--text-light); }
.step.active .step-label { color: var(--primary); font-weight: 500; }

/* ===== Tabs 标签页 ===== */
.tabs { display: flex; border-bottom: 2px solid var(--border); margin-bottom: 16px; }
.tab {
    padding: 10px 20px; cursor: pointer; color: var(--text-secondary);
    border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all .2s;
}
.tab:hover { color: var(--primary); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 500; }

/* ===== 两栏布局 ===== */
.two-col { display: flex; gap: 16px; }
.two-col-main { flex: 1; min-width: 0; }
.two-col-side { width: 280px; flex-shrink: 0; }

/* ===== 统计卡片 ===== */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
    background: #fff; border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow);
    display: flex; align-items: center; gap: 16px;
}
.stat-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 24px; }
.stat-icon.blue { background: var(--primary-light); color: var(--primary); }
.stat-icon.green { background: #f6ffed; color: var(--success); }
.stat-icon.orange { background: #fffbe6; color: var(--warning); }
.stat-icon.red { background: #fff2f0; color: var(--danger); }
.stat-value { font-size: 24px; font-weight: 700; }
.stat-label { font-size: 13px; color: var(--text-secondary); }

/* ===== 进度条 ===== */
.progress { height: 8px; background: #f0f0f0; border-radius: 4px; overflow: hidden; margin: 8px 0; }
.progress-bar { height: 100%; background: var(--primary); border-radius: 4px; transition: width .3s; }

/* ===== 响应式 ===== */
@media (max-width: 768px) {
    .two-col { flex-direction: column; }
    .two-col-side { width: 100%; }
    .product-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
    .form-row { flex-direction: column; }
    .topbar { padding: 0 12px; }
    .topbar-nav { display: none; }
}

/* ===== 工具类 ===== */
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-8 { gap: 8px; }
.gap-16 { gap: 16px; }
.hidden { display: none !important; }
