/* ================================
   梅睿贸易 - ERP v2 扩展样式
   ================================ */

/* ===== 导航分组标签 ===== */
.nav-group-label {
    padding: 16px 20px 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: rgba(255,255,255,0.3);
    letter-spacing: 1px;
}

/* ===== 统计网格（仪表盘） ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 20px;
}

/* ===== 卡片容器 ===== */
.card-box {
    background: #fff;
    border-radius: 10px;
    padding: 16px;
    box-shadow: 0 1px 6px rgba(0,0,0,0.04);
    margin-bottom: 16px;
}

/* ===== Tab 栏（订单页） ===== */
.tab-bar {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    background: #eef0f4;
    border-radius: 8px;
    padding: 3px;
}
.tab-btn {
    flex: 1;
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    background: transparent;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    color: #666;
}
.tab-btn.active {
    background: #fff;
    color: #1a73e8;
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.tab-btn:hover:not(.active) { color: #333; }

.order-panel { min-height: 100px; }

/* ===== 侧边栏布局 ===== */
.with-sidebar {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}
.sidebar-tree {
    width: 260px;
    min-width: 260px;
    max-width: 600px;
    background: #fff;
    border-radius: 10px;
    padding: 12px;
    box-shadow: 0 1px 6px rgba(0,0,0,0.04);
    height: calc(100vh - 160px);
    overflow-y: auto;
    position: sticky;
    top: 20px;
    border: 1px solid #e9ecef;
    position: relative;
}

/* ===== 侧边树状区/左侧面板横向拖拽手柄 ===== */
.sidebar-resizer {
    position: absolute;
    top: 0;
    right: -3px;
    width: 6px;
    height: 100%;
    cursor: col-resize;
    z-index: 10;
    border-radius: 0 3px 3px 0;
    transition: background 0.15s;
}
.sidebar-resizer:hover,
.sidebar-resizer.resizing {
    background: rgba(26, 115, 232, 0.3);
}
.sidebar-tree .tree-title {
    font-size: 13px;
    font-weight: 600;
    color: #555;
    padding: 4px 8px 10px;
    border-bottom: 1px solid #eee;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.sidebar-tree .tree-title .tree-root-btn {
    font-size: 11px;
    color: #1a73e8;
    cursor: pointer;
    padding: 2px 8px;
    border-radius: 4px;
}
.sidebar-tree .tree-title .tree-root-btn:hover { background: #e8f0fe; }

.sidebar-tree .tree-node {
    margin: 2px 0;
}
.sidebar-tree .tree-node-content {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 5px 8px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.15s;
    background: #f2f4f7;
}
.sidebar-tree .tree-node:nth-child(odd) > .tree-node-content {
    background: #f2f4f7;
}
.sidebar-tree .tree-node:nth-child(even) > .tree-node-content {
    background: #edf0f5;
}
.sidebar-tree .tree-node-content:hover { background: #e0e5ee; }
.sidebar-tree .tree-node-content.active { background: #d4defa; color: #1a73e8; font-weight: 600; }
.sidebar-tree .tree-node-content .tree-toggle {
    font-size: 10px;
    color: #aaa;
    width: 14px;
    text-align: center;
    flex-shrink: 0;
}
.sidebar-tree .tree-node-content .tree-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 11px;
}
.sidebar-tree .tree-node-content .tree-count {
    font-size: 11px;
    color: #bbb;
    margin-left: 4px;
}
.sidebar-tree .tree-node-actions {
    display: none;
    gap: 2px;
    flex-shrink: 0;
}
.sidebar-tree .tree-node-content:hover .tree-node-actions {
    display: flex;
}
.sidebar-tree .tree-node-actions button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 12px;
    padding: 0 2px;
    color: #888;
    line-height: 1;
}
.sidebar-tree .tree-node-actions button:hover { color: #1a73e8; }
.sidebar-tree .tree-node-actions .btn-del:hover { color: #ea4335; }
.sidebar-tree .tree-children { padding-left: 16px; }
.sidebar-tree .tree-leaf {
    padding: 5px 8px 5px 24px;
    font-size: 12px;
    color: #666;
    border-radius: 6px;
    cursor: pointer;
}
.sidebar-tree .tree-leaf:hover { background: #f0f4ff; color: #1a73e8; }

.sidebar-tree .tree-add-input {
    width: 100%;
    padding: 4px 8px;
    border: 1px solid #1a73e8;
    border-radius: 4px;
    font-size: 12px;
    margin: 2px 0;
    outline: none;
}

/* ===== 树状分层颜色 ===== */
.sidebar-tree .tree-node-content[data-level="1"] { background: #e3f2fd !important; border-left: 3px solid #1976d2; }
.sidebar-tree .tree-node-content[data-level="2"] { background: #e8f5e9 !important; border-left: 3px solid #388e3c; }
.sidebar-tree .tree-node-content[data-level="3"] { background: #fff8e1 !important; border-left: 3px solid #f57c00; }
.sidebar-tree .tree-node-content[data-level="4"] { background: #f3e5f5 !important; border-left: 3px solid #7b1fa2; }
.sidebar-tree .tree-node-content[data-level="1"]:hover,
.sidebar-tree .tree-node-content[data-level="2"]:hover,
.sidebar-tree .tree-node-content[data-level="3"]:hover,
.sidebar-tree .tree-node-content[data-level="4"]:hover { background: #e0e5ee !important; }
.sidebar-tree .tree-node-content[data-level="1"].active,
.sidebar-tree .tree-node-content[data-level="2"].active,
.sidebar-tree .tree-node-content[data-level="3"].active,
.sidebar-tree .tree-node-content[data-level="4"].active { background: #bbdefb !important; }
.sidebar-tree .tree-node-content[data-level="1"] { font-weight: 600; }

/* ===== 主内容区（带侧栏） ===== */
.main-content-right {
    flex: 1;
    min-width: 0;
}

/* ===== 产品表格（多列） ===== */
.product-table th {
    white-space: nowrap;
    font-size: 12px;
    text-align: center;
}
.product-table td {
    font-size: 12px;
    padding: 8px 10px;
    border-bottom: 1px solid #e8eaed;
}
.product-table tbody tr:hover {
    background: #f8f9fe !important;
}
.product-table tbody tr:nth-child(even) {
    background: #fafbfc;
}
.product-table .img-preview,
.product-info-table .img-preview {
    width: 36px;
    height: 36px;
    object-fit: cover;
    border-radius: 4px;
    display: block;
    margin: 0 auto;
}

/* ===== 产品信息表格 ===== */
.product-info-table th {
    text-align: center;
}
.product-info-table td {
    border-bottom: 1px solid #e8eaed;
}
.product-info-table tbody tr:hover {
    background: #f8f9fe !important;
}
.product-info-table tbody tr:nth-child(even) {
    background: #fafbfc;
}

/* ===== 响应式 ===== */
@media (max-width: 1024px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .stats-row { grid-template-columns: 1fr 1fr; }
    .form-grid { grid-template-columns: 1fr; }
}

/* ===== 表格拖拽 ===== */
.tbl-dragging {
    opacity: 0.5;
    background: #e3f2fd !important;
}
.tbl-drag-over {
    border-left: 3px solid #1a73e8 !important;
}
/* ===== 列拖拽手柄 ===== */
.col-resizer {
    opacity: 0.5;
    border-right: 1px solid #d0d5dd;
    transition: opacity 0.15s;
}
.col-resizer:hover,
th:hover .col-resizer {
    opacity: 1;
    background: #93c5fd !important;
    border-right-color: #93c5fd;
}

/* ===== 表头居中 ===== */
.table-wrap th {
    text-align: center !important;
    vertical-align: middle !important;
}

/* ===== 表格正文美化 ===== */
.table-wrap td {
    border-bottom: 1px solid #e8eaed;
    padding: 8px 10px;
    font-size: 12px;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
}
.table-wrap tbody tr:hover {
    background: #f8f9fe !important;
}
.table-wrap tbody tr:nth-child(even) {
    background: #fafbfc;
}

/* ===== 固定表头（粘性） ===== */
.table-wrap thead th {
    position: sticky;
    top: 0;
    z-index: 5;
    background: #f8f9fa !important;
    border-bottom: 2px solid #d0d5dd;
}
.table-wrap thead tr {
    height: 48px;
}
/* 统一行高 */
.table-wrap tbody tr {
    height: 50px;
}
/* 预览图片统一大小 */
.table-wrap .img-preview,
.product-table .img-preview,
.product-info-table .img-preview {
    width: 36px !important;
    height: 36px !important;
    object-fit: cover;
    border-radius: 4px;
    display: block;
    margin: 0 auto;
}

/* ===== 表单英文标注 ===== */
.label-en {
    display: block;
    font-size: 10px;
    color: #a0aec0;
    font-weight: 400;
    letter-spacing: 0.3px;
    user-select: none;
    margin-top: 2px;
}

.toolbar { padding-left: 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }

/* ===== 工具栏下拉框/输入框美化 ===== */
.toolbar select {
    padding: 5px 10px;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    font-size: 12px;
    color: #666;
    background: #fff;
    cursor: pointer;
    outline: none;
    min-height: 30px;
}
.toolbar select:hover { border-color: #bbb; }
.toolbar select:focus {
    border-color: #1a73e8;
    box-shadow: 0 0 0 2px rgba(26,115,232,0.1);
}

/* 工具栏搜索框 */
.toolbar .search-input {
    padding: 5px 10px;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    font-size: 12px;
    color: #666;
    background: #f5f6f7;
    outline: none;
    min-height: 30px;
}
.toolbar .search-input::placeholder { color: #bbb; }
.toolbar .search-input:focus {
    border-color: #1a73e8;
    background: #fff;
    box-shadow: 0 0 0 2px rgba(26,115,232,0.1);
}

/* ===== 表单下拉框占位选项浅色 ===== */
.form-group select option[value=""] {
    color: #bbb;
}

/* ===== 全局复选框加大 ===== */
input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #1a73e8;
    flex-shrink: 0;
}

/* 详情弹窗值样式 */
.detail-val {
    font-size: 14px;
    color: #333;
    padding: 9px 12px;
    background: #fff;
    border: 1.5px solid #333;
    border-radius: 6px;
    min-height: 18px;
    line-height: 1.4;
    width: 100%;
    box-sizing: border-box;
}

/* form-group 跨整行 */
.form-section .form-group.full {
    grid-column: 1 / -1;
}

/* ===== 表单分区卡片 ===== */
.form-section {
    border-radius: 10px;
    padding: 16px 20px;
    margin-bottom: 14px;
    border: 1px solid #eef0f4;
    background: #fff;
    position: relative;
    overflow: hidden;
}
.form-section::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 4px;
}
.form-section.sec-blue::before { background: #1a73e8; }
.form-section.sec-green::before { background: #34a853; }
.form-section.sec-purple::before { background: #9c27b0; }
.form-section.sec-teal::before { background: #009688; }
.form-section.sec-orange::before { background: #ff9800; }
.form-section.sec-red::before { background: #ea4335; }
.form-section.sec-gray::before { background: #9e9e9e; }

.form-section.sec-blue { background: #f5f9ff; }
.form-section.sec-green { background: #f3faf4; }
.form-section.sec-purple { background: #faf5fd; }
.form-section.sec-teal { background: #f0faf9; }
.form-section.sec-orange { background: #fff8f0; }
.form-section.sec-red { background: #fdf5f5; }
.form-section.sec-gray { background: #f8f8f8; }

.form-section-title {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    display: flex;
    align-items: center;
    gap: 6px;
    grid-column: 1 / -1;
}
.form-section-title .en {
    font-size: 11px;
    font-weight: 400;
    color: #aaa;
    margin-left: 4px;
}
.form-section-title .unit-sel {
    margin-left: auto;
    font-size: 12px;
}
.form-section-title .unit-sel select {
    padding: 2px 8px;
    border-radius: 6px;
    border: 1px solid #ddd;
    font-size: 12px;
    background: #fff;
}

/* 分区内字段横向排列 - 直接对 form-section 设 grid */
.form-section {
    border-radius: 10px;
    padding: 16px 20px;
    margin-bottom: 14px;
    border: 1px solid #eef0f4;
    background: #fff;
    position: relative;
    overflow: hidden;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px 16px;
    align-items: start;
}

/* 尺寸行布局 */
.dim-row {
    display: flex;
    align-items: end;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
    grid-column: 1 / -1;
}
.dim-row .dim-label {
    font-size: 12px;
    color: #888;
    min-width: 90px;
    padding-bottom: 8px;
}
.dim-row .dim-input {
    width: 80px;
}
.dim-row .dim-arrow {
    color: #ccc;
    padding-bottom: 8px;
    font-size: 13px;
}
.dim-row .dim-vol {
    flex: 1;
    min-width: 120px;
}
.dim-row .dim-vol input {
    background: #f0f2f5;
    color: #666;
    font-weight: 600;
}
.dim-row .dim-vol label {
    font-size: 11px;
    color: #aaa;
}

/* ===== 工具栏标签文字 ===== */
.toolbar-label {
    font-size: 12px;
    color: #999;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    align-self: center;
    padding: 6px 0;
    line-height: 1;
}
