:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --success-color: #27ae60;
    --danger-color: #e74c3c;
    --warning-color: #f39c12;
    --border-color: #e9ecef;
    --sidebar-width: 260px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f5f7fa;
    color: var(--primary-color);
    font-size: 14px;
}

.sidebar {
    width: var(--sidebar-width);
    background: white;
    border-right: 1px solid var(--border-color);
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 1000;
    transition: transform 0.3s ease;
}

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    text-align: center;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
}
.sidebar-header h3 { color: white; font-size: 1.2rem; margin: 0; }

.sidebar-menu { padding: 20px 0; }
.menu-item {
    display: block;
    padding: 12px 20px;
    color: #4a5568;
    text-decoration: none;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}
.menu-item:hover { background-color: #f7fafc; color: var(--secondary-color); }
.menu-item.active { background-color: #ebf5ff; color: var(--secondary-color); border-left-color: var(--secondary-color); }
.menu-item i { width: 24px; margin-right: 12px; text-align: center; }

.menu-divider { height: 1px; background: var(--border-color); margin: 15px 20px; }
.menu-header { padding: 8px 20px; font-size: 0.75rem; text-transform: uppercase; color: #718096; }

.main-content { margin-left: var(--sidebar-width); padding: 20px; min-height: 100vh; transition: margin-left 0.3s ease; }
@media (max-width: 768px) { .main-content { margin-left: 0; padding: 15px; } }

.menu-toggle {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1100;
    background: var(--secondary-color);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
@media (max-width: 768px) { .menu-toggle { display: flex; align-items: center; justify-content: center; } }

.top-nav {
    background: white;
    padding: 12px 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
@media (max-width: 768px) { .top-nav { margin-top: 50px; padding: 10px 15px; } }

.page-title { font-size: 1.3rem; font-weight: 500; margin: 0; }
@media (max-width: 768px) { .page-title { font-size: 1.1rem; } }

.user-info { display: flex; align-items: center; gap: 15px; flex-wrap: wrap; }
.user-name { font-weight: 500; }
.user-role { background: #f0f0f0; padding: 4px 12px; border-radius: 20px; font-size: 0.75rem; }

.card { background: white; border-radius: 12px; box-shadow: 0 1px 2px rgba(0,0,0,0.05); margin-bottom: 20px; }
.card-header { padding: 12px 20px; border-bottom: 1px solid var(--border-color); font-weight: 500; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }
.card-body { padding: 20px; }
@media (max-width: 768px) { .card-header { padding: 10px 15px; } .card-body { padding: 15px; } }

.stats-card { background: white; border-radius: 12px; padding: 15px; text-align: center; cursor: pointer; transition: all 0.2s; border: 1px solid var(--border-color); margin-bottom: 15px; }
.stats-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.1); border-color: var(--secondary-color); }
.stats-number { font-size: 1.8rem; font-weight: 600; color: var(--secondary-color); margin-bottom: 5px; }
.stats-label { color: #718096; font-size: 0.8rem; }

.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; min-width: 600px; }
.table th { text-align: left; padding: 10px 12px; background: #f8f9fa; font-weight: 500; border-bottom: 2px solid var(--border-color); font-size: 0.85rem; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--border-color); vertical-align: middle; font-size: 0.85rem; }
.table tbody tr:hover { background-color: #f8f9fa; }

.btn { display: inline-block; padding: 8px 16px; border-radius: 6px; font-size: 0.85rem; font-weight: 500; cursor: pointer; border: none; transition: all 0.2s; }
.btn-sm { padding: 4px 10px; font-size: 0.75rem; }
.btn-primary { background-color: var(--secondary-color); color: white; }
.btn-primary:hover { background-color: #2980b9; }
.btn-success { background-color: var(--success-color); color: white; }
.btn-success:hover { background-color: #219653; }
.btn-danger { background-color: var(--danger-color); color: white; }
.btn-warning { background-color: var(--warning-color); color: white; }
.btn-outline-primary { background: transparent; border: 1px solid var(--secondary-color); color: var(--secondary-color); }
.btn-outline-primary:hover { background: var(--secondary-color); color: white; }

.form-group { margin-bottom: 15px; }
.form-label { display: block; margin-bottom: 5px; font-weight: 500; font-size: 0.85rem; }
.form-control, .form-select { width: 100%; padding: 8px 12px; border: 1px solid var(--border-color); border-radius: 6px; font-size: 0.85rem; }
.form-control:focus, .form-select:focus { outline: none; border-color: var(--secondary-color); box-shadow: 0 0 0 2px rgba(52,152,219,0.1); }

.status-badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 0.7rem; font-weight: 500; white-space: nowrap; }
.status-pending_purchase { background: #fff3cd; color: #856404; }
.status-pending_manager { background: #cce5ff; color: #004085; }
.status-pending_ship { background: #d4edda; color: #155724; }
.status-shipped { background: #d4edda; color: #155724; }
.status-completed { background: #d4edda; color: #155724; }
.status-rejected { background: #f8d7da; color: #721c24; }
.status-no_stock { background: #f8d7da; color: #721c24; }

.excel-area { border: 2px dashed var(--border-color); border-radius: 8px; padding: 15px; text-align: center; cursor: pointer; transition: all 0.2s; }
.excel-area:hover { border-color: var(--secondary-color); background-color: #f8f9fa; }
.excel-area i { font-size: 28px; color: var(--secondary-color); margin-bottom: 8px; }

.modal { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); z-index: 2000; align-items: center; justify-content: center; }
.modal.show { display: flex; }
.modal-dialog { width: 100%; max-width: 800px; max-height: 90vh; overflow-y: auto; background: white; border-radius: 12px; }
@media (max-width: 768px) { .modal-dialog { max-width: 95%; margin: 10px auto; } }
.modal-lg { max-width: 1000px; }
.modal-xl { max-width: 1200px; }
.modal-header { padding: 12px 15px; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; }
.modal-title { font-size: 1rem; font-weight: 500; margin: 0; }
.modal-close { background: none; border: none; font-size: 1.2rem; cursor: pointer; color: #718096; }
.modal-body { padding: 15px; max-height: 60vh; overflow-y: auto; }
.modal-footer { padding: 12px 15px; border-top: 1px solid var(--border-color); display: flex; justify-content: flex-end; gap: 10px; }

.pagination { display: flex; justify-content: center; gap: 5px; list-style: none; margin-top: 20px; flex-wrap: wrap; }
.page-link { display: block; padding: 6px 10px; border: 1px solid var(--border-color); border-radius: 6px; color: var(--primary-color); text-decoration: none; cursor: pointer; font-size: 0.8rem; }
.page-link:hover { background: var(--secondary-color); color: white; border-color: var(--secondary-color); }
.page-item.active .page-link { background: var(--secondary-color); color: white; border-color: var(--secondary-color); }

.tree-node { padding: 8px 12px; margin: 2px 0; border-radius: 6px; cursor: pointer; }
.tree-node:hover { background-color: #f0f7ff; }

.timeline { position: relative; padding: 15px 0; }
.timeline-item { position: relative; padding-left: 25px; padding-bottom: 15px; border-left: 2px solid #e9ecef; }
.timeline-item:last-child { border-left-color: transparent; }
.timeline-item::before { content: ''; position: absolute; left: -7px; top: 0; width: 12px; height: 12px; border-radius: 50%; background: #3498db; border: 2px solid white; }
.timeline-item .time { font-size: 0.7rem; color: #718096; margin-bottom: 3px; }
.timeline-item .status { font-weight: 500; margin-bottom: 3px; }
.timeline-item .location { font-size: 0.75rem; color: #4a5568; }

.notification-badge { position: relative; cursor: pointer; }
.notification-dot { position: absolute; top: -5px; right: -5px; width: 8px; height: 8px; background: var(--danger-color); border-radius: 50%; }

.login-container { display: flex; justify-content: center; align-items: center; min-height: 100vh; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); padding: 20px; }
.login-card { background: white; border-radius: 20px; padding: 30px 25px; width: 100%; max-width: 380px; box-shadow: 0 20px 40px rgba(0,0,0,0.1); }

.text-center { text-align: center; }
.text-muted { color: #718096; }
.cursor-pointer { cursor: pointer; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.d-flex { display: flex; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }
.w-100 { width: 100%; }

/* 响应式按钮 - 手机全宽，电脑自适应 */
@media (max-width: 768px) {
    .btn {
        width: 100%;
        margin-bottom: 8px;
    }
    .d-flex.gap-2 {
        flex-direction: column;
    }
    .d-flex.gap-2 .btn {
        margin-right: 0;
        width: 100%;
    }
}

@media (min-width: 769px) {
    .btn {
        width: auto;
    }
    .d-flex.gap-2 {
        flex-direction: row;
    }
}

/* 电脑端按钮正常大小 */
@media (min-width: 769px) {
    .w-md-auto {
        width: auto !important;
    }
    .justify-content-start {
        justify-content: flex-start !important;
    }
}

/* 经理界面表格列宽优化 */
#productTable th:nth-child(1) { width: 18%; }  /* 型号 */
#productTable th:nth-child(2) { width: 12%; }  /* 产品描述 */
#productTable th:nth-child(3) { width: 8%; }   /* 品牌 */
#productTable th:nth-child(4) { width: 5%; }   /* 数量 */
#productTable th:nth-child(5) { width: 5%; }   /* 单位 */
#productTable th:nth-child(6) { width: 8%; }   /* 备注 */
#productTable th:nth-child(7) { width: 8%; }   /* 成本价 */
#productTable th:nth-child(8) { width: 6%; }   /* 溢价率 */
#productTable th:nth-child(9) { width: 5%; }   /* 汇率 */
#productTable th:nth-child(10) { width: 10%; } /* 单价 */
#productTable th:nth-child(11) { width: 15%; } /* 总金额 */

/* 移动端适配 */
@media (max-width: 768px) {
    #productTable th,
    #productTable td {
        white-space: nowrap;
    }
}

/* 经理界面表格列宽优化 - 产品描述列隐藏 */
#productTable th:nth-child(1) { width: 24%; }   /* 型号 */
#productTable th:nth-child(2) { display: none; } /* 产品描述 - 隐藏 */
#productTable td:nth-child(2) { display: none; } /* 产品描述内容 - 隐藏 */
#productTable th:nth-child(3) { width: 8%; }    /* 品牌 */
#productTable th:nth-child(4) { width: 5%; }    /* 数量 */
#productTable th:nth-child(5) { width: 5%; }    /* 单位 */
#productTable th:nth-child(6) { width: 8%; }    /* 备注 */
#productTable th:nth-child(7) { width: 8%; }    /* 成本价 */
#productTable th:nth-child(8) { width: 10%; }   /* 溢价率 */
#productTable th:nth-child(9) { width: 10%; }   /* 汇率 */
#productTable th:nth-child(10) { width: 10%; }  /* 单价 */
#productTable th:nth-child(11) { width: 12%; }  /* 总金额 */

/* 移动端适配 */
@media (max-width: 768px) {
    #productTable th,
    #productTable td {
        white-space: nowrap;
    }
}

/* 采购界面表格列宽 */
#productTable.purchaser-view th:nth-child(1) { width: 27%; }   /* 型号 */
#productTable.purchaser-view th:nth-child(2) { width: 18%; }   /* 产品描述 */
#productTable.purchaser-view th:nth-child(3) { width: 9%; }    /* 品牌 */
#productTable.purchaser-view th:nth-child(4) { width: 9%; }    /* 数量 */
#productTable.purchaser-view th:nth-child(5) { width: 7%; }    /* 单位 */
#productTable.purchaser-view th:nth-child(6) { width: 14%; }   /* 备注 */
#productTable.purchaser-view th:nth-child(7) { width: 16%; }   /* 成本价 */
