/**
 * 软件名称：鄂野电商ERP管理系统
 * 版本号：V1.0
 * 著作权人：湖北鄂西甄选供应链管理有限公司
 */

/* ═══════════════════════════════════════════════════════════════════
   全局样式
   ═══════════════════════════════════════════════════════════════════ */

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', sans-serif; font-size: 14px; color: #333; background: #f0f2f5; }

/* 登录页 */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, #1890ff 0%, #096dd9 100%); }
.login-box { background: #fff; border-radius: 8px; padding: 40px; width: 400px; box-shadow: 0 8px 24px rgba(0,0,0,0.15); }
.login-box h1 { text-align: center; font-size: 24px; color: #1890ff; margin-bottom: 8px; }
.login-box .subtitle { text-align: center; color: #999; margin-bottom: 30px; font-size: 13px; }
.login-box .field { margin-bottom: 20px; }
.login-box label { display: block; margin-bottom: 6px; font-weight: 500; color: #555; }
.login-box input { width: 100%; padding: 10px 12px; border: 1px solid #d9d9d9; border-radius: 4px; font-size: 14px; transition: border-color 0.3s; }
.login-box input:focus { border-color: #1890ff; outline: none; box-shadow: 0 0 0 2px rgba(24,144,255,0.2); }
.login-box .error-msg { color: #ff4d4f; font-size: 13px; margin-top: 8px; text-align: center; }

/* 主布局 */
.app-layout { display: flex; height: 100vh; }
.sidebar { width: 220px; background: #001529; color: #fff; flex-shrink: 0; display: flex; flex-direction: column; }
.sidebar .logo { padding: 20px 16px; font-size: 17px; font-weight: bold; border-bottom: 1px solid rgba(255,255,255,0.1); text-align: center; color: #fff; }
.sidebar .logo small { display: block; font-size: 11px; color: rgba(255,255,255,0.5); font-weight: normal; margin-top: 2px; }
.sidebar nav { flex: 1; overflow-y: auto; padding: 8px 0; }
.sidebar .nav-item { display: block; padding: 12px 24px; color: rgba(255,255,255,0.65); text-decoration: none; cursor: pointer; transition: all 0.2s; font-size: 14px; white-space: nowrap; }
.sidebar .nav-item:hover, .sidebar .nav-item.active { color: #fff; background: #1890ff; }

/* 层级导航：父节点 */
.sidebar .nav-parent { display: block; padding: 10px 24px; color: rgba(255,255,255,0.45); cursor: pointer; font-size: 13px; white-space: nowrap; transition: all 0.2s; user-select: none; }
.sidebar .nav-parent:hover { color: rgba(255,255,255,0.85); background: rgba(255,255,255,0.05); }
.sidebar .nav-parent-icon { display: inline-block; width: 14px; font-size: 10px; transition: transform 0.2s; color: rgba(255,255,255,0.35); }
.sidebar .nav-parent.open .nav-parent-icon { transform: rotate(90deg); }

/* 子项 */
.sidebar .nav-group { overflow: hidden; transition: max-height 0.25s ease; max-height: 0; }
.sidebar .nav-group.open { max-height: 300px; }
.sidebar .nav-item.sub { padding: 10px 24px 10px 44px; font-size: 13px; }
.main-area { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.topbar { background: #fff; padding: 0 24px; height: 54px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #e8e8e8; box-shadow: 0 1px 4px rgba(0,0,0,0.05); }
.topbar .user-info { display: flex; align-items: center; gap: 12px; }
.topbar .user-info span { color: #666; font-size: 13px; }
.content { flex: 1; overflow-y: auto; padding: 20px; }

/* 通用组件 */
.btn { display: inline-block; padding: 8px 16px; border: 1px solid #d9d9d9; border-radius: 4px; background: #fff; color: #333; cursor: pointer; font-size: 14px; transition: all 0.2s; line-height: 1.4; }
.btn:hover { border-color: #1890ff; color: #1890ff; }
.btn-primary { background: #1890ff; border-color: #1890ff; color: #fff; }
.btn-primary:hover { background: #40a9ff; border-color: #40a9ff; color: #fff; }
.btn-danger { background: #ff4d4f; border-color: #ff4d4f; color: #fff; }
.btn-danger:hover { background: #ff7875; border-color: #ff7875; color: #fff; }
.btn-success { background: #52c41a; border-color: #52c41a; color: #fff; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

.card { background: #fff; border-radius: 6px; padding: 20px; margin-bottom: 16px; box-shadow: 0 1px 2px rgba(0,0,0,0.06); }
.card h3 { font-size: 16px; margin-bottom: 16px; padding-bottom: 10px; border-bottom: 1px solid #f0f0f0; color: #333; }
.card-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 12px; flex-wrap: wrap; }

table { width: 100%; border-collapse: collapse; }
table th, table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #f0f0f0; font-size: 13px; }
table th { background: #fafafa; font-weight: 600; color: #555; white-space: nowrap; }
table tr:hover { background: #fafafa; }

.search-box { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.search-box input, .search-box select { padding: 7px 10px; border: 1px solid #d9d9d9; border-radius: 4px; font-size: 13px; min-width: 120px; }
.search-box input:focus, .search-box select:focus { border-color: #1890ff; outline: none; }

/* 标签 */
.tag { display: inline-block; padding: 2px 8px; border-radius: 3px; font-size: 12px; }
.tag-blue { background: #e6f7ff; color: #1890ff; }
.tag-green { background: #f6ffed; color: #52c41a; }
.tag-orange { background: #fff7e6; color: #fa8c16; }
.tag-red { background: #fff2f0; color: #ff4d4f; }
.tag-gray { background: #f5f5f5; color: #999; }

/* 状态标签 */
.status-pending { color: #fa8c16; }
.status-approved { color: #1890ff; }
.status-shipped { color: #722ed1; }
.status-completed { color: #52c41a; }
.status-refunding { color: #ff4d4f; }
.status-refunded { color: #999; }

/* 模态框 */
.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.show { display: flex; }
.modal { background: #fff; border-radius: 8px; width: 90%; max-width: 920px; max-height: 88vh; overflow-y: auto; box-shadow: 0 8px 24px rgba(0,0,0,0.2); }
.modal-header { padding: 16px 20px; border-bottom: 1px solid #f0f0f0; display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { margin: 0; font-size: 16px; }
.modal-body { padding: 20px; }
.modal-footer { padding: 12px 20px; border-top: 1px solid #f0f0f0; display: flex; justify-content: flex-end; gap: 8px; }
.modal-close { cursor: pointer; font-size: 20px; color: #999; background: none; border: none; }
.modal-close:hover { color: #333; }

/* 表单 */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 500; color: #555; font-size: 13px; }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: 8px 12px; border: 1px solid #d9d9d9; border-radius: 4px; font-size: 13px; font-family: inherit; }
.form-group textarea { resize: vertical; min-height: 60px; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: #1890ff; outline: none; box-shadow: 0 0 0 2px rgba(24,144,255,0.1); }
.form-row { display: flex; gap: 16px; }
.form-row .form-group { flex: 1; }

/* 统计卡片 */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card { background: #fff; border-radius: 6px; padding: 20px; box-shadow: 0 1px 2px rgba(0,0,0,0.06); }
.stat-card .label { font-size: 13px; color: #999; margin-bottom: 8px; }
.stat-card .value { font-size: 28px; font-weight: bold; color: #333; }
.stat-card .value.blue { color: #1890ff; }
.stat-card .value.green { color: #52c41a; }
.stat-card .value.orange { color: #fa8c16; }
.stat-card .value.red { color: #ff4d4f; }

/* 图表容器 */
.chart-container { display: flex; align-items: flex-end; gap: 12px; height: 200px; padding: 10px 0; }
.chart-bar { flex: 1; background: #1890ff; border-radius: 4px 4px 0 0; position: relative; min-width: 30px; transition: height 0.3s; }
.chart-bar .bar-label { position: absolute; bottom: -22px; left: 50%; transform: translateX(-50%); font-size: 11px; color: #999; white-space: nowrap; }
.chart-bar .bar-value { position: absolute; top: -20px; left: 50%; transform: translateX(-50%); font-size: 12px; color: #333; white-space: nowrap; font-weight: 500; }

/* 空态 */
.empty-state { text-align: center; padding: 60px 20px; color: #999; }
.empty-state p { margin-top: 12px; font-size: 14px; }

/* 分页 */
.pagination { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-top: 16px; font-size: 13px; }
.pagination button { padding: 4px 10px; border: 1px solid #d9d9d9; border-radius: 4px; background: #fff; cursor: pointer; }
.pagination button:disabled { color: #d9d9d9; cursor: not-allowed; }
.pagination button:hover:not(:disabled) { border-color: #1890ff; color: #1890ff; }
.pagination .page-info { color: #999; }

/* 隐藏 */
.hidden { display: none !important; }

/* Toast */
.toast { position: fixed; top: 20px; right: 20px; z-index: 2000; background: #52c41a; color: #fff; padding: 12px 20px; border-radius: 4px; font-size: 14px; box-shadow: 0 4px 12px rgba(0,0,0,0.15); animation: slideIn 0.3s ease-out; }
.toast.error { background: #ff4d4f; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* 响应式 */
@media (max-width: 768px) {
  .sidebar { width: 60px; }
  .sidebar .logo { font-size: 14px; padding: 12px 8px; }
  .sidebar .logo small { display: none; }
  .sidebar .nav-item { padding: 12px 8px; font-size: 0; text-align: center; }
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
}

/* ═══ oclient 风格：三栏布局（左分类树+中央表单+右信息面板）═══ */
.ocl-layout { display: flex; gap: 12px; height: calc(100vh - 100px); }
.ocl-left { width: 220px; flex-shrink: 0; background: #fff; border-radius: 6px; overflow-y: auto; box-shadow: 0 1px 2px rgba(0,0,0,0.06); }
.ocl-center { flex: 1; background: #fff; border-radius: 6px; overflow-y: auto; box-shadow: 0 1px 2px rgba(0,0,0,0.06); }
.ocl-right { width: 260px; flex-shrink: 0; background: #fff; border-radius: 6px; overflow-y: auto; box-shadow: 0 1px 2px rgba(0,0,0,0.06); }

/* 分类树 */
.tree-panel { padding: 12px; }
.tree-panel h4 { font-size: 13px; color: #666; margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px solid #f0f0f0; }
.tree-node { padding: 4px 0; }
.tree-item { display: flex; align-items: center; padding: 5px 8px; cursor: pointer; border-radius: 4px; font-size: 13px; user-select: none; }
.tree-item:hover { background: #f0f5ff; }
.tree-item.active { background: #e6f7ff; color: #1890ff; font-weight: 500; }
.tree-toggle { display: inline-block; width: 18px; text-align: center; color: #999; cursor: pointer; }
.tree-children { margin-left: 18px; }
.tree-children.hidden { display: none; }

/* 页签导航 */
.tab-bar { display: flex; border-bottom: 2px solid #f0f0f0; padding: 0 16px; background: #fafafa; border-radius: 6px 6px 0 0; }
.tab-item { padding: 10px 16px; cursor: pointer; font-size: 13px; color: #666; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all 0.2s; white-space: nowrap; }
.tab-item:hover { color: #1890ff; }
.tab-item.active { color: #1890ff; border-bottom-color: #1890ff; font-weight: 500; }
.tab-content { padding: 16px; display: none; }
.tab-content.active { display: block; }

/* 商品表单分区 */
.gform-section { margin-bottom: 20px; }
.gform-section h5 { font-size: 13px; color: #1890ff; margin-bottom: 10px; padding-bottom: 6px; border-bottom: 1px solid #e8e8e8; }
.gform-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 20px; }
.gform-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px 16px; }
.gform-item { display: flex; align-items: center; gap: 8px; }
.gform-item label { min-width: 70px; text-align: right; font-size: 12px; color: #666; white-space: nowrap; }
.gform-item input, .gform-item select { flex: 1; padding: 5px 8px; border: 1px solid #d9d9d9; border-radius: 3px; font-size: 12px; }
.gform-item input:focus, .gform-item select:focus { border-color: #1890ff; outline: none; }
.gform-item input[readonly] { background: #f5f5f5; color: #999; }
.gform-item .unit { font-size: 12px; color: #999; min-width: 20px; }
.gform-check { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.gform-check input[type="checkbox"] { width: auto; }

/* 商品列表工具栏 */
.glist-toolbar { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid #f0f0f0; flex-wrap: wrap; gap: 8px; }
.glist-toolbar h3 { margin: 0; font-size: 15px; }

/* 仓库网格面板 */
.wh-panel { padding: 12px; }
.wh-panel h4 { font-size: 13px; color: #666; margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px solid #f0f0f0; }
.wh-grid { width: 100%; border-collapse: collapse; font-size: 12px; }
.wh-grid th, .wh-grid td { padding: 6px 8px; text-align: right; border-bottom: 1px solid #f0f0f0; }
.wh-grid th { background: #fafafa; font-weight: 500; color: #666; }
.wh-grid td:first-child, .wh-grid th:first-child { text-align: left; }

/* 操作按钮栏 */
.ocl-actions { display: flex; gap: 6px; padding: 10px 16px; border-bottom: 1px solid #f0f0f0; background: #fafafa; flex-wrap: wrap; }
.ocl-actions .btn { font-size: 12px; padding: 4px 12px; }

/* 响应式 */
@media (max-width: 1200px) {
  .ocl-right { display: none; }
}
@media (max-width: 900px) {
  .ocl-left { display: none; }
}

/* ═══ 开单中心 表单式布局 ═══ */
.vform-card { padding: 0; overflow: hidden; }
.vform-titlebar {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; background: #f0f5ff; border-bottom: 2px solid #d6e4ff;
}
.vform-title { font-size: 17px; font-weight: 600; }
.vform-head {
  display: flex; flex-wrap: wrap; gap: 12px;
  padding: 14px 16px; background: #fafafa; border-bottom: 1px solid #eee;
}
.vfield { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 200px; }
.vfield label { white-space: nowrap; color: #666; font-size: 13px; }
.vfield input, .vfield select { flex: 1; padding: 6px 8px; border: 1px solid #d9d9d9; border-radius: 4px; }
.vitems { margin: 0; border-collapse: collapse; width: 100%; }
.vitems th { background: #fafafa; font-size: 12px; padding: 8px 4px; border-bottom: 2px solid #e8e8e8; }
.vitems td { padding: 4px; border-bottom: 1px solid #f0f0f0; text-align: center; }
.vitems .vgoods { width: 100%; padding: 5px; }
.vitems input[type="number"], .vitems .vrate { width: 100%; padding: 5px; text-align: right; border: 1px solid #d9d9d9; border-radius: 4px; box-sizing: border-box; }
.vitems .vprice, .vitems .vamount, .vitems .vtax, .vitems .vtotal { text-align: right; padding-right: 8px; font-variant-numeric: tabular-nums; color: #333; }
.vitems .vtotal { font-weight: 600; }
.vform-foot {
  display: flex; gap: 28px; justify-content: flex-end; align-items: center;
  padding: 12px 16px; background: #fffbe6; border-top: 1px solid #ffe58f; font-size: 14px;
}
.vform-meta { padding: 8px 16px; color: #999; font-size: 12px; background: #fafafa; }
@media (max-width: 768px) {
  .vform-head { flex-direction: column; }
  .vitems { font-size: 12px; }
  .vform-foot { flex-wrap: wrap; gap: 10px; }
}

/* ═══ 商品管理 三栏布局 ═══ */
.goods-layout { display: flex; gap: 12px; height: calc(100vh - 110px); }
.goods-panel { overflow-y: auto; background: #fff; border-radius: 6px; box-shadow: 0 1px 2px rgba(0,0,0,0.06); }
.goods-left { width: 220px; flex-shrink: 0; }
.goods-center { flex: 1; min-width: 0; }
.goods-right { width: 280px; flex-shrink: 0; padding: 12px; }

/* 分类树 */
.cat-tree-header { padding: 12px 14px; font-weight: 600; font-size: 14px; border-bottom: 1px solid #f0f0f0; color: #333; }
.cat-tree-list { padding: 6px 0; max-height: calc(100vh - 250px); overflow-y: auto; }
.cat-tree-item { padding: 7px 14px; cursor: pointer; font-size: 13px; color: #555; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: background 0.15s; }
.cat-tree-item:hover { background: #f0f5ff; }
.cat-tree-item.active { background: #e6f7ff; color: #1890ff; font-weight: 500; }
.cat-tree-footer { padding: 10px 14px; border-top: 1px solid #f0f0f0; }
.goods-search-input { width: 100%; padding: 6px 10px; border: 1px solid #d9d9d9; border-radius: 4px; font-size: 13px; }
.goods-search-input:focus { border-color: #1890ff; outline: none; }

/* 商品表单 */
.goods-form-card { margin-bottom: 0; }
.goods-form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 16px; }
.goods-form-grid .form-group { margin-bottom: 12px; }
.goods-form-grid .form-group label { font-size: 12px; }
.goods-form-grid .form-group input,
.goods-form-grid .form-group select,
.goods-form-grid .form-group textarea { padding: 6px 8px; font-size: 12px; }

/* 页签 */
.goods-tabs { display: flex; gap: 0; border-bottom: 2px solid #e8e8e8; margin-bottom: 16px; padding: 0; }
.goods-tab { padding: 10px 20px; cursor: pointer; font-size: 13px; color: #666; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all 0.2s; }
.goods-tab:hover { color: #1890ff; }
.goods-tab.active { color: #1890ff; border-bottom-color: #1890ff; font-weight: 500; }
.goods-tab-content { min-height: 300px; }

/* 选中行高亮 */
.goods-selected-row { background: #e6f7ff !important; }

@media (max-width: 1200px) {
  .goods-layout { flex-direction: column; height: auto; }
  .goods-left, .goods-right { width: 100%; }
  .goods-left { max-height: 200px; }
  .goods-right { max-height: 300px; }
  .goods-form-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .goods-form-grid { grid-template-columns: 1fr; }
}
