/* 订单管理：母单状态筛选条（与 .table-card 叠用时收紧内边距） */
.record-status-toolbar.table-card {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

.page-header { margin-bottom: 1.5rem; display: flex; justify-content: space-between; align-items: center; }
.page-header h1 { font-size: 1.75rem; font-weight: 600; color: #495057; margin: 0; }
.page-header p { color: #6c757d; margin: 0.5rem 0 0 0; }
.filter-card { background: #fff; border-radius: 8px; padding: 1.5rem; box-shadow: 0 2px 4px rgba(0,0,0,0.1); margin-bottom: 1.5rem; }
.filter-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.filter-row:last-child { margin-bottom: 0; }
.table-card { background: #fff; border-radius: 8px; padding: 1.5rem; box-shadow: 0 2px 4px rgba(0,0,0,0.1); margin-bottom: 1.5rem; }
.table { margin-bottom: 0; }
.table thead { background-color: #f8f9fa; }
.table th { font-weight: 600; color: #495057; border-bottom: 2px solid #dee2e6; white-space: nowrap; }
/* 主列表表头居中（仅直接子表，不含展开行内嵌子单表） */
.table-card > .table-responsive > .table > thead > tr > th {
    text-align: center !important;
    vertical-align: middle;
}
.sort-control-group .form-select { min-width: 11rem; }
.premium-wear-panel {
    padding: 1rem 1.25rem;
}
.premium-wear-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.875rem;
}
.premium-wear-header h2 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    font-weight: 700;
    color: #343a40;
    margin: 0;
}
.premium-wear-controls {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.premium-wear-controls .form-select {
    width: auto;
    min-width: 7.5rem;
}
.premium-wear-threshold {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin: 0;
    color: #6c757d;
    font-size: 0.8125rem;
    font-weight: 600;
    white-space: nowrap;
}
.premium-wear-threshold .form-control {
    width: 5.25rem;
}
.premium-wear-metrics {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0.625rem;
    margin-bottom: 0.875rem;
}
.premium-wear-metric {
    min-height: 4.25rem;
    padding: 0.625rem 0.75rem;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    background: #f8f9fa;
}
.premium-wear-metric-label {
    color: #6c757d;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
}
.premium-wear-metric-value {
    color: #212529;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.25;
}
.premium-wear-loading {
    grid-column: 1 / -1;
    padding: 0.75rem;
    color: #6c757d;
    text-align: center;
    border: 1px dashed #ced4da;
    border-radius: 6px;
}
.premium-wear-grid {
    display: grid;
    grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
    gap: 0.875rem;
}
.premium-wear-section {
    min-width: 0;
}
.premium-wear-section h3 {
    margin: 0 0 0.5rem 0;
    color: #495057;
    font-size: 0.875rem;
    font-weight: 700;
}
.premium-wear-table {
    font-size: 0.8125rem;
    border: 1px solid #e9ecef;
}
.premium-wear-table th {
    font-size: 0.75rem;
    background: #f1f3f5;
}
.premium-wear-table th,
.premium-wear-table td {
    text-align: center;
    vertical-align: middle;
    white-space: nowrap;
}
@media (max-width: 1200px) {
    .premium-wear-metrics {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
    .premium-wear-grid {
        grid-template-columns: 1fr;
    }
}
@media (max-width: 768px) {
    .premium-wear-header {
        align-items: stretch;
        flex-direction: column;
    }
    .premium-wear-controls {
        justify-content: flex-start;
    }
    .premium-wear-metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
@media (max-width: 520px) {
    .premium-wear-metrics {
        grid-template-columns: 1fr;
    }
}
.table td { vertical-align: middle; }
.table th.col-expand,
.table td.col-expand {
    width: 2.25rem;
    min-width: 2.25rem;
    max-width: 2.5rem;
    text-align: center;
    padding-left: 0.35rem;
    padding-right: 0.35rem;
    vertical-align: middle;
}
.table .col-expand .btn-expand-sub {
    color: #495057;
    padding: 0.15rem 0.25rem;
    line-height: 1;
    border: none;
    background: transparent;
}
.table .col-expand .btn-expand-sub:hover,
.table .col-expand .btn-expand-sub:focus {
    color: #0d6efd;
    background: rgba(13, 110, 253, 0.08);
    border-radius: 4px;
}
.table th.col-time,
.table td.col-time {
    min-width: 10rem;
    text-align: center;
    vertical-align: middle;
}
.sub-orders-fill {
    padding: 0.5rem 0.75rem;
    background: #f1f3f5;
    border-radius: 6px;
    border-left: 3px solid #6c757d;
}
.sub-orders-fill .table-sub-legs {
    font-size: 0.8125rem;
    margin-bottom: 0;
}
.sub-orders-fill .table-sub-legs th {
    white-space: nowrap;
    font-size: 0.75rem;
    padding: 0.35rem 0.5rem;
}
.sub-orders-fill .table-sub-legs td {
    padding: 0.35rem 0.5rem;
    vertical-align: middle;
}
.status-badge { padding: 0.35em 0.65em; font-size: 0.875rem; font-weight: 600; }
.status-pending { background-color: #6c757d !important; color: #fff !important; }
.status-submitted { background-color: #0d6efd !important; color: #fff !important; }
.status-partial-filled { background-color: #ffc107 !important; color: #1a1a1a !important; }
.status-filled { background-color: #198754 !important; color: #fff !important; }
.status-cancelled { background-color: #fd7e14 !important; color: #fff !important; }
.status-failed { background-color: #dc3545 !important; color: #fff !important; }
.order-details { display: none; background-color: #f8f9fa; padding: 1rem; border-radius: 6px; margin-top: 0.5rem; border-left: 3px solid #0d6efd; }
.order-details.show { display: block; }
.detail-section { background-color: #fff; border-radius: 4px; padding: 0.875rem; margin-bottom: 0.75rem; box-shadow: 0 1px 2px rgba(0,0,0,0.08); }
.detail-section:last-child { margin-bottom: 0; }
.detail-section h6 { font-weight: 600; color: #495057; margin-bottom: 0.75rem; padding-bottom: 0.5rem; border-bottom: 1px solid #e9ecef; display: flex; align-items: center; gap: 0.5rem; font-size: 0.95rem; }
.detail-section h6 i { font-size: 1rem; }
.detail-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.5rem; }
@media (max-width: 1400px) { .detail-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 992px) { .detail-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 768px) { .detail-grid { grid-template-columns: 1fr; } }
.detail-item { display: flex; flex-direction: column; gap: 0.2rem; padding: 0.5rem; background-color: #f8f9fa; border-radius: 3px; border-left: 2px solid #dee2e6; transition: all 0.2s ease; }
.detail-item:hover { background-color: #e9ecef; border-left-color: #0d6efd; }
.detail-item.full-width { grid-column: 1 / -1; }
.detail-label { font-weight: 500; color: #6c757d; font-size: 0.8rem; margin-bottom: 0.15rem; }
.detail-value { color: #212529; font-weight: 500; font-size: 0.875rem; word-break: break-word; }
.detail-value .badge { font-size: 0.75rem; font-weight: 600; }
.detail-value .status-submitted { background-color: #0d6efd !important; color: #fff !important; }
.detail-value .status-pending { background-color: #6c757d !important; color: #fff !important; }
.detail-value .status-filled { background-color: #198754 !important; color: #fff !important; }
.detail-value .status-cancelled { background-color: #fd7e14 !important; color: #fff !important; }
.detail-value .status-failed { background-color: #dc3545 !important; color: #fff !important; }
.detail-value .status-partial-filled { background-color: #ffc107 !important; color: #1a1a1a !important; }
.pagination-wrapper { display: flex; justify-content: space-between; align-items: center; margin-top: 1rem; }
.pagination-info { color: #6c757d; font-size: 0.9rem; }
.direction-open { color: #198754; }
.direction-close { color: #fd7e14; }
/* 操作列保持足够宽，确保详情/删除等按钮都可见 */
.table th.col-actions,
.table td.col-actions {
    min-width: 260px;
    text-align: center;
    vertical-align: middle;
}
.table td.col-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    justify-content: center;
}
.table td.col-actions .btn { margin: 0; flex-shrink: 0; }

/*
 * trade_record.record_status（订单状态）
 * 使用浅底 + 深色字，避免仅命中 color:#fff 而背景未生效时在白/浅灰表格行上不可见。
 */
.table-card .badge.status-badge.rs-opening,
.detail-value .badge.status-badge.rs-opening {
    background-color: #e9ecef !important;
    color: #343a40 !important;
    border: 1px solid #adb5bd !important;
}
.table-card .badge.status-badge.rs-opened,
.detail-value .badge.status-badge.rs-opened {
    background-color: #d1e7dd !important;
    color: #0f5132 !important;
    border: 1px solid #198754 !important;
}
.table-card .badge.status-badge.rs-closing,
.detail-value .badge.status-badge.rs-closing {
    background-color: #fff3cd !important;
    color: #664d03 !important;
    border: 1px solid #e0a800 !important;
}
.table-card .badge.status-badge.rs-closed,
.detail-value .badge.status-badge.rs-closed {
    background-color: #cfe2ff !important;
    color: #052c65 !important;
    border: 1px solid #0d6efd !important;
}
.table-card .badge.status-badge.rs-aborted,
.detail-value .badge.status-badge.rs-aborted {
    background-color: #ffe5d0 !important;
    color: #984c0c !important;
    border: 1px solid #fd7e14 !important;
}
.table-card .badge.status-badge.rs-unknown,
.detail-value .badge.status-badge.rs-unknown {
    background-color: #dee2e6 !important;
    color: #212529 !important;
    border: 1px solid #adb5bd !important;
}
