:root {
    --primary: #ff8c42;
    --primary-dark: #e67a35;
    --secondary: #6c5ce7;
    --success: #00b894;
    --warning: #fdcb6e;
    --danger: #e74c3c;
    --bg: #f5f6fa;
    --card-bg: #ffffff;
    --text: #2d3436;
    --text-light: #636e72;
    --border: #dfe6e9;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --radius: 10px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    font-size: 14px;
}

.app {
    display: flex;
    min-height: 100vh;
}

/* 侧边栏 */
.sidebar {
    width: 200px;
    background: var(--card-bg);
    border-right: 1px solid var(--border);
    padding: 20px 0;
    position: fixed;
    height: 100vh;
    z-index: 100;
    flex-shrink: 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 16px 20px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 12px;
}

.logo-icon { font-size: 24px; }
.logo-text { font-size: 16px; font-weight: 700; color: var(--primary); }

.nav-menu { list-style: none; padding: 0 10px; }
.nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 4px;
    font-size: 14px;
}
.nav-item:hover { background: #fff3e6; color: var(--primary); }
.nav-item.active { background: var(--primary); color: white; }
.nav-icon { font-size: 16px; width: 20px; text-align: center; }

/* 主内容 */
.main-content {
    flex: 1;
    margin-left: 200px;
    padding: 20px 28px;
    min-width: 0;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.top-bar h1 { font-size: 22px; font-weight: 700; }

/* 按钮 */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: opacity 0.2s;
    background: #e9ecef;
    color: var(--text);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.btn:hover { opacity: 0.8; }
.btn-primary { background: var(--primary); color: white; }
.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-small { padding: 4px 10px; font-size: 12px; }

/* 内容区 */
.content { min-height: 400px; }

/* 卡片 */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
    transition: transform 0.15s;
}
.card:hover { transform: translateY(-2px); }

.card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}
.card-avatar {
    width: 48px; height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--warning));
    display: flex; align-items: center; justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}
.card-title { font-size: 16px; font-weight: 700; }
.card-subtitle { font-size: 12px; color: var(--text-light); }

.card-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
}
.info-item {
    background: var(--bg);
    padding: 8px;
    border-radius: 6px;
}
.info-label { font-size: 10px; color: var(--text-light); text-transform: uppercase; letter-spacing: 0.5px; }
.info-value { font-size: 14px; font-weight: 600; margin-top: 2px; }

.card-actions {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
}

/* 表格 */
.table-container {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}
.data-table th {
    background: var(--bg);
    padding: 12px 14px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}
.data-table td {
    padding: 12px 14px;
    border-top: 1px solid var(--border);
    font-size: 13px;
    vertical-align: middle;
}
.data-table tr:hover { background: #fff9f5; }

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}
.badge-success { background: #d4edda; color: #155724; }
.badge-warning { background: #fff3cd; color: #856404; }
.badge-danger { background: #f8d7da; color: #721c24; }
.badge-info { background: #d1ecf1; color: #0c5460; }

/* 筛选栏 */
.filter-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    align-items: center;
}
.filter-bar select, .filter-bar input {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    background: white;
}

/* 库存布局 */
.inventory-layout {
    display: flex;
    gap: 16px;
}
.inventory-sidebar {
    width: 160px;
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 14px;
    box-shadow: var(--shadow);
    height: fit-content;
    flex-shrink: 0;
}
.section-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    margin-bottom: 10px;
    letter-spacing: 0.5px;
}
.category-list { list-style: none; }
.category-item {
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    margin-bottom: 3px;
}
.category-item:hover { background: var(--bg); }
.category-item.active { background: var(--primary); color: white; }

.inventory-main { flex: 1; min-width: 0; }

.warning-banner {
    background: #fff3cd;
    border: 1px solid #fdcb6e;
    border-radius: 6px;
    padding: 10px 14px;
    margin-bottom: 12px;
    font-size: 13px;
    display: none;
}
.warning-banner.show { display: block; }

/* 统计 */
.stats-filters {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    align-items: center;
}
.stats-filters input, .stats-filters select {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
}

.stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}
.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
    text-align: center;
}
.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 4px;
}
.stat-label { font-size: 12px; color: var(--text-light); }

.stats-charts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}
.chart-box {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
}
.chart-box h3 { font-size: 14px; margin-bottom: 12px; font-weight: 600; }
.chart-bar {
    display: flex;
    align-items: center;
    margin-bottom: 6px;
    gap: 8px;
}
.chart-bar-label { width: 70px; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chart-bar-track { flex: 1; background: var(--bg); border-radius: 3px; height: 16px; overflow: hidden; }
.chart-bar-fill { height: 100%; border-radius: 3px; }
.chart-bar-value { width: 60px; text-align: right; font-size: 11px; font-weight: 600; }

/* 模态框 */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal-overlay.show { display: flex; }

.modal {
    background: var(--card-bg);
    border-radius: var(--radius);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-close {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: var(--text-light);
    line-height: 1;
}

.modal-body { padding: 20px; }
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 20px;
    border-top: 1px solid var(--border);
}

/* 表单 */
.form-group { margin-bottom: 14px; }
.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--text-light);
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
}
.form-group textarea { resize: vertical; min-height: 60px; }

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* Toast */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--text);
    color: white;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 13px;
    z-index: 2000;
    display: none;
    box-shadow: var(--shadow);
    max-width: 300px;
}
.toast.show { display: block; }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 50px 20px;
    color: var(--text-light);
}
.empty-state-icon { font-size: 40px; margin-bottom: 10px; }
.empty-state-text { font-size: 14px; }

/* 响应式 */
@media (max-width: 768px) {
    .sidebar { width: 56px; }
    .logo-text, .nav-item span:last-child { display: none; }
    .main-content { margin-left: 56px; padding: 12px; }
    .cards-grid { grid-template-columns: 1fr; }
    .stats-charts { grid-template-columns: 1fr; }
    .inventory-layout { flex-direction: column; }
    .inventory-sidebar { width: 100%; }
    .form-row { grid-template-columns: 1fr; }
    .stats-filters { flex-direction: column; align-items: stretch; }
    .stats-filters > * { width: 100%; }
}
