/* ==========================================================================
   SPS HISTORY & CASHFLOW - CSS STYLING (LỊCH SỬ LỆNH & DÒNG TIỀN)
   Chuẩn giao diện 100% SPS Webtrade:
   1. Lịch sử đặt lệnh
   2. Lệnh đã hủy
   3. Lãi/Lỗ đã thực hiện
   4. Lịch sử giao dịch tiền
   ========================================================================== */

#sps-history-tab {
    width: 100%;
    min-height: calc(100vh - 120px);
    display: none;
    flex-direction: column;
    gap: 16px;
    padding: 16px 20px;
    box-sizing: border-box;
    background: #090d16;
    color: #e2e8f0;
}

#sps-history-tab.active {
    display: flex;
}

/* ── Top Navigation Subtabs ────────────────────────────────────────── */
.sps-hist-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 6px;
    overflow-x: auto;
}

.sps-hist-tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 8px;
    background: transparent;
    border: 1px solid transparent;
    color: #94a3b8;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.sps-hist-tab-btn:hover {
    color: #f1f5f9;
    background: rgba(255, 255, 255, 0.04);
}

.sps-hist-tab-btn.active {
    background: #1e293b;
    color: #38bdf8;
    border-color: rgba(56, 189, 248, 0.35);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

/* ── Content Panes ─────────────────────────────────────────────────── */
.sps-hist-pane {
    display: none;
    flex-direction: column;
    gap: 14px;
    width: 100%;
}

.sps-hist-pane.active {
    display: flex;
}

/* ── Pane Card ─────────────────────────────────────────────────────── */
.sps-hist-card {
    background: #0d131f;
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 10px;
    padding: 16px 20px;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* ── Card Title & Header ───────────────────────────────────────────── */
.sps-hist-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sps-hist-title {
    font-size: 17px;
    font-weight: 700;
    color: #f8fafc;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.sps-hist-title::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 18px;
    background: #3b82f6;
    border-radius: 2px;
}

/* ── Filter Toolbar ────────────────────────────────────────────────── */
.sps-hist-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 10px 14px;
}

.sps-hist-filter-group {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.sps-hist-select {
    background: #111827;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    color: #e2e8f0;
    font-size: 13px;
    padding: 6px 12px;
    height: 34px;
    outline: none;
    cursor: pointer;
    min-width: 140px;
}

.sps-hist-select:focus {
    border-color: #3b82f6;
}

.sps-hist-date-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #111827;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    padding: 2px 10px;
    height: 34px;
    box-sizing: border-box;
}

.sps-hist-date-lbl {
    font-size: 12px;
    color: #94a3b8;
    white-space: nowrap;
}

.sps-hist-date-input {
    background: transparent;
    border: none;
    color: #f1f5f9;
    font-size: 13px;
    font-family: inherit;
    outline: none;
    width: 110px;
    cursor: pointer;
}

.sps-hist-date-input::-webkit-calendar-picker-indicator {
    filter: invert(0.8);
    cursor: pointer;
}

/* Green Search Button (Khớp SPS: #059669) */
.sps-hist-btn-search {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: #059669;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    padding: 0 18px;
    height: 34px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.sps-hist-btn-search:hover {
    background: #10b981;
}

.sps-hist-btn-search:active {
    background: #047857;
}

/* Download / Export Button (Top right icon) */
.sps-hist-btn-export {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #cbd5e1;
    border-radius: 6px;
    font-size: 12.5px;
    padding: 0 12px;
    height: 34px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.sps-hist-btn-export:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.25);
}

/* ── Table Container ───────────────────────────────────────────────── */
.sps-hist-table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    background: #080c14;
}

.sps-hist-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    text-align: left;
    white-space: nowrap;
}

.sps-hist-table th {
    background: #111827;
    color: #94a3b8;
    padding: 8px 10px;
    font-weight: 700;
    font-size: 11.5px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    border-right: 1px solid rgba(255, 255, 255, 0.04);
}

.sps-hist-table th.th-group {
    text-align: center;
    background: #162032;
    color: #cbd5e1;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sps-hist-table td {
    padding: 8px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    border-right: 1px solid rgba(255, 255, 255, 0.02);
    color: #e2e8f0;
}

.sps-hist-table tr:hover td {
    background: rgba(255, 255, 255, 0.025);
}

/* Footer / Tổng cộng row */
.sps-hist-table tfoot tr td {
    background: #0f172a;
    border-top: 2px solid rgba(255, 255, 255, 0.12);
    font-weight: 700;
    color: #f1f5f9;
    padding: 10px 10px;
}

/* Highlight & Tag Styles */
.sps-cell-buy {
    color: #10b981 !important;
    font-weight: 700;
}

.sps-cell-sell {
    color: #ef4444 !important;
    font-weight: 700;
}

.sps-cell-num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.sps-cell-desc {
    min-width: 320px;
    white-space: normal !important;
    word-break: break-word;
    line-height: 1.45;
    text-align: left;
}

/* ── Tối ưu phân bổ cột bảng Sao kê tiền chuẩn 100% ── */
#sps-cash-table {
    width: 100%;
    min-width: 100%;
    table-layout: auto;
}

#sps-cash-table th:first-child,
#sps-cash-table td:first-child {
    width: 150px;
    min-width: 140px;
}

#sps-cash-table th.sps-cell-num,
#sps-cash-table td.sps-cell-num {
    width: 105px;
    min-width: 95px;
    text-align: right;
}

#sps-cash-table th.sps-cell-desc,
#sps-cash-table td.sps-cell-desc {
    width: auto;
    min-width: 320px;
    white-space: normal !important;
    word-break: break-word;
    line-height: 1.45;
    text-align: left;
}

.sps-cell-pnl-pos {
    color: #10b981 !important;
    font-weight: 700;
    text-align: right;
}

.sps-cell-pnl-neg {
    color: #ef4444 !important;
    font-weight: 700;
    text-align: right;
}

.sps-badge-status {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.sps-badge-filled {
    color: #10b981;
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.sps-badge-canceled {
    color: #94a3b8;
    background: rgba(148, 163, 184, 0.12);
    border: 1px solid rgba(148, 163, 184, 0.25);
}

.sps-badge-pending {
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.sps-badge-rejected {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* ── Pagination Bar ────────────────────────────────────────────────── */
.sps-hist-pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 4px 4px;
    flex-wrap: wrap;
    gap: 10px;
}

.sps-hist-page-left {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #94a3b8;
    font-size: 12px;
}

.sps-hist-page-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

.sps-hist-page-btn {
    background: #111827;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #cbd5e1;
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.sps-hist-page-btn:hover:not(:disabled) {
    background: #1e293b;
    color: #ffffff;
}

.sps-hist-page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.sps-hist-page-current {
    font-size: 12.5px;
    font-weight: 700;
    color: #38bdf8;
    padding: 0 4px;
}

/* ── Empty State ───────────────────────────────────────────────────── */
.sps-hist-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 48px 16px;
    text-align: center;
}

.sps-hist-empty-icon {
    font-size: 40px;
    line-height: 1;
    margin-bottom: 2px;
}

.sps-hist-empty-title {
    font-size: 14.5px;
    font-weight: 700;
    color: #94a3b8;
}

.sps-hist-empty-desc {
    font-size: 12px;
    color: #64748b;
    max-width: 440px;
    line-height: 1.5;
}

/* ── Light Mode Support ────────────────────────────────────────────── */
body.light-mode #sps-history-tab,
body:not(.dark-mode):not(.cosmic-mode) #sps-history-tab {
    background: #f8fafc;
    color: #1e293b;
}

body.light-mode .sps-hist-nav,
body:not(.dark-mode):not(.cosmic-mode) .sps-hist-nav {
    background: #ffffff;
    border-color: #e2e8f0;
}

body.light-mode .sps-hist-tab-btn,
body:not(.dark-mode):not(.cosmic-mode) .sps-hist-tab-btn {
    color: #64748b;
}

body.light-mode .sps-hist-tab-btn.active,
body:not(.dark-mode):not(.cosmic-mode) .sps-hist-tab-btn.active {
    background: #eff6ff;
    color: #2563eb;
    border-color: #bfdbfe;
}

body.light-mode .sps-hist-card,
body:not(.dark-mode):not(.cosmic-mode) .sps-hist-card {
    background: #ffffff;
    border-color: #e2e8f0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

body.light-mode .sps-hist-title,
body:not(.dark-mode):not(.cosmic-mode) .sps-hist-title {
    color: #0f172a;
}

body.light-mode .sps-hist-toolbar,
body:not(.dark-mode):not(.cosmic-mode) .sps-hist-toolbar {
    background: #f1f5f9;
    border-color: #e2e8f0;
}

body.light-mode .sps-hist-select,
body.light-mode .sps-hist-date-item,
body:not(.dark-mode):not(.cosmic-mode) .sps-hist-select,
body:not(.dark-mode):not(.cosmic-mode) .sps-hist-date-item {
    background: #ffffff;
    border-color: #cbd5e1;
    color: #0f172a;
}

body.light-mode .sps-hist-date-input,
body:not(.dark-mode):not(.cosmic-mode) .sps-hist-date-input {
    color: #0f172a;
}

body.light-mode .sps-hist-date-input::-webkit-calendar-picker-indicator,
body:not(.dark-mode):not(.cosmic-mode) .sps-hist-date-input::-webkit-calendar-picker-indicator {
    filter: none;
}

body.light-mode .sps-hist-table-wrap,
body:not(.dark-mode):not(.cosmic-mode) .sps-hist-table-wrap {
    background: #ffffff;
    border-color: #e2e8f0;
}

body.light-mode .sps-hist-table th,
body:not(.dark-mode):not(.cosmic-mode) .sps-hist-table th {
    background: #f1f5f9;
    color: #475569;
    border-color: #e2e8f0;
}

body.light-mode .sps-hist-table th.th-group,
body:not(.dark-mode):not(.cosmic-mode) .sps-hist-table th.th-group {
    background: #e2e8f0;
    color: #1e293b;
}

body.light-mode .sps-hist-table td,
body:not(.dark-mode):not(.cosmic-mode) .sps-hist-table td {
    color: #334155;
    border-color: #f1f5f9;
}

body.light-mode .sps-hist-table tr:hover td,
body:not(.dark-mode):not(.cosmic-mode) .sps-hist-table tr:hover td {
    background: #f8fafc;
}

body.light-mode .sps-hist-table tfoot tr td,
body:not(.dark-mode):not(.cosmic-mode) .sps-hist-table tfoot tr td {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #0f172a;
}

/* Badges & Actions for Condition Orders & Matches */
.sps-cond-type-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.3);
}

.sps-status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.sps-status-pending {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.sps-status-triggered {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.sps-status-cancelled {
    background: rgba(148, 163, 184, 0.15);
    color: #94a3b8;
    border: 1px solid rgba(148, 163, 184, 0.25);
}

.sps-status-expired {
    background: rgba(244, 63, 94, 0.15);
    color: #fb7185;
    border: 1px solid rgba(244, 63, 94, 0.3);
}

.sps-btn-cancel-cond {
    padding: 3px 10px;
    font-size: 12px;
    font-weight: 600;
    color: #f43f5e;
    background: rgba(244, 63, 94, 0.1);
    border: 1px solid rgba(244, 63, 94, 0.3);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.sps-btn-cancel-cond:hover {
    background: #f43f5e;
    color: #ffffff;
    border-color: #f43f5e;
}

/* ===================================================
   STR DYNAMIC THEME SYSTEM INTEGRATION (#sps-history-tab)
   =================================================== */

#sps-history-tab {
    background: var(--str-bg-base, #090d16) !important;
    color: var(--str-text-main, #e2e8f0) !important;
    transition: background 0.25s ease, color 0.25s ease;
}

/* Nav Subtabs */
.sps-hist-nav {
    background: var(--str-bg-surface, rgba(15, 23, 42, 0.7)) !important;
    border-color: var(--str-border-subtle, rgba(255, 255, 255, 0.08)) !important;
    transition: all 0.25s ease;
}
.sps-hist-tab-btn {
    color: var(--str-text-muted, #94a3b8) !important;
    transition: all 0.2s ease;
}
.sps-hist-tab-btn:hover {
    color: var(--str-text-main, #f1f5f9) !important;
    background: var(--str-accent-soft, rgba(255, 255, 255, 0.04)) !important;
}
.sps-hist-tab-btn.active {
    background: var(--str-accent, #2563eb) !important;
    color: var(--str-accent-fg, #ffffff) !important;
    border-color: var(--str-accent, #38bdf8) !important;
    box-shadow: 0 4px 14px var(--str-accent-soft, rgba(37, 99, 235, 0.35)) !important;
}

/* Card & Title */
.sps-hist-card {
    background: var(--str-bg-card, #0d131f) !important;
    border-color: var(--str-border-subtle, rgba(255, 255, 255, 0.07)) !important;
    transition: all 0.25s ease;
}
.sps-hist-header {
    border-bottom-color: var(--str-border-subtle, rgba(255, 255, 255, 0.06)) !important;
}
.sps-hist-title {
    color: var(--str-text-main, #f8fafc) !important;
}
.sps-hist-title::before {
    background: var(--str-accent, #3b82f6) !important;
}

/* Filter Toolbar */
.sps-hist-toolbar {
    background: var(--str-bg-surface, rgba(15, 23, 42, 0.5)) !important;
    border-color: var(--str-border-subtle, rgba(255, 255, 255, 0.05)) !important;
    transition: all 0.25s ease;
}
.sps-hist-select,
.sps-hist-date-item {
    background: var(--str-bg-base, #111827) !important;
    border-color: var(--str-border-subtle, rgba(255, 255, 255, 0.12)) !important;
    color: var(--str-text-main, #e2e8f0) !important;
    transition: all 0.2s ease;
}
.sps-hist-select:focus,
.sps-hist-date-item:focus-within {
    border-color: var(--str-accent, #3b82f6) !important;
    box-shadow: 0 0 0 2px var(--str-accent-soft, rgba(59, 130, 246, 0.2)) !important;
}
.sps-hist-date-lbl {
    color: var(--str-text-muted, #94a3b8) !important;
}
.sps-hist-date-input {
    color: var(--str-text-main, #f1f5f9) !important;
}

/* Search Button */
.sps-hist-btn-search {
    background: var(--str-accent, #059669) !important;
    color: var(--str-accent-fg, #ffffff) !important;
    transition: all 0.2s ease;
}
.sps-hist-btn-search:hover {
    filter: brightness(1.1);
    box-shadow: 0 4px 12px var(--str-accent-soft, rgba(16, 185, 129, 0.35)) !important;
}

/* Export Button */
.sps-hist-btn-export {
    background: var(--str-bg-surface, rgba(255, 255, 255, 0.05)) !important;
    border-color: var(--str-border-subtle, rgba(255, 255, 255, 0.12)) !important;
    color: var(--str-text-muted, #cbd5e1) !important;
    transition: all 0.2s ease;
}
.sps-hist-btn-export:hover {
    background: var(--str-accent-soft, rgba(255, 255, 255, 0.1)) !important;
    border-color: var(--str-accent, #3b82f6) !important;
    color: var(--str-text-main, #ffffff) !important;
}

/* Table Container & Elements */
.sps-hist-table-wrap {
    background: var(--str-bg-card, #080c14) !important;
    border-color: var(--str-border-subtle, rgba(255, 255, 255, 0.08)) !important;
}
.sps-hist-table th {
    background: var(--str-bg-surface, #111827) !important;
    color: var(--str-text-muted, #94a3b8) !important;
    border-bottom-color: var(--str-border-subtle, rgba(255, 255, 255, 0.08)) !important;
    border-right-color: var(--str-border-subtle, rgba(255, 255, 255, 0.04)) !important;
}
.sps-hist-table th.th-group {
    background: var(--str-bg-surface, #162032) !important;
    color: var(--str-text-main, #cbd5e1) !important;
    border-bottom-color: var(--str-border-subtle, rgba(255, 255, 255, 0.1)) !important;
}
.sps-hist-table td {
    border-bottom-color: var(--str-border-subtle, rgba(255, 255, 255, 0.05)) !important;
    border-right-color: var(--str-border-subtle, rgba(255, 255, 255, 0.02)) !important;
    color: var(--str-text-main, #e2e8f0) !important;
}
.sps-hist-table tr:hover td {
    background: var(--str-accent-soft, rgba(255, 255, 255, 0.025)) !important;
}
.sps-hist-table tfoot tr td {
    background: var(--str-bg-surface, #0f172a) !important;
    border-top: 2px solid var(--str-border-subtle, rgba(255, 255, 255, 0.12)) !important;
    color: var(--str-text-main, #f1f5f9) !important;
}

/* Pagination Bar */
.sps-hist-page-left {
    color: var(--str-text-muted, #94a3b8) !important;
}
.sps-hist-page-btn {
    background: var(--str-bg-surface, #111827) !important;
    border-color: var(--str-border-subtle, rgba(255, 255, 255, 0.1)) !important;
    color: var(--str-text-muted, #cbd5e1) !important;
    transition: all 0.15s ease;
}
.sps-hist-page-btn:hover:not(:disabled) {
    background: var(--str-accent-soft, #1e293b) !important;
    border-color: var(--str-accent, #3b82f6) !important;
    color: var(--str-text-main, #ffffff) !important;
}
.sps-hist-page-current {
    color: var(--str-accent, #38bdf8) !important;
}

/* Badges */
.sps-cond-type-badge {
    background: var(--str-accent-soft, rgba(56, 189, 248, 0.15)) !important;
    color: var(--str-accent, #38bdf8) !important;
    border-color: var(--str-accent, rgba(56, 189, 248, 0.3)) !important;
}

/* Empty State */
.sps-hist-empty-title {
    color: var(--str-text-muted, #94a3b8) !important;
}
.sps-hist-empty-desc {
    color: var(--str-text-muted, #64748b) !important;
}

/* ===================================================
   LIGHT MODE OVERRIDES (#sps-history-tab)
   =================================================== */
body:not(.dark-mode):not(.cosmic-mode) #sps-history-tab,
body.str-pure-white #sps-history-tab {
    background: #ffffff !important;
    color: #0f172a !important;
}

body:not(.dark-mode):not(.cosmic-mode) .sps-hist-nav,
body.str-pure-white .sps-hist-nav {
    background: #f8fafc !important;
    border-color: #e2e8f0 !important;
}

body:not(.dark-mode):not(.cosmic-mode) .sps-hist-tab-btn,
body.str-pure-white .sps-hist-tab-btn {
    color: #64748b !important;
}
body:not(.dark-mode):not(.cosmic-mode) .sps-hist-tab-btn.active,
body.str-pure-white .sps-hist-tab-btn.active {
    background: var(--str-accent, #2563eb) !important;
    color: #ffffff !important;
    border-color: var(--str-accent, #2563eb) !important;
}

body:not(.dark-mode):not(.cosmic-mode) .sps-hist-card,
body.str-pure-white .sps-hist-card,
body:not(.dark-mode):not(.cosmic-mode) .sps-hist-table-wrap,
body.str-pure-white .sps-hist-table-wrap {
    background: #ffffff !important;
    border-color: #e2e8f0 !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04) !important;
}

body:not(.dark-mode):not(.cosmic-mode) .sps-hist-title,
body.str-pure-white .sps-hist-title {
    color: #0f172a !important;
}

body:not(.dark-mode):not(.cosmic-mode) .sps-hist-toolbar,
body.str-pure-white .sps-hist-toolbar {
    background: #f8fafc !important;
    border-color: #e2e8f0 !important;
}

body:not(.dark-mode):not(.cosmic-mode) .sps-hist-select,
body.str-pure-white .sps-hist-select,
body:not(.dark-mode):not(.cosmic-mode) .sps-hist-date-item,
body.str-pure-white .sps-hist-date-item {
    background: #ffffff !important;
    border-color: #cbd5e1 !important;
    color: #0f172a !important;
}

body:not(.dark-mode):not(.cosmic-mode) .sps-hist-date-input,
body.str-pure-white .sps-hist-date-input {
    color: #0f172a !important;
}
body:not(.dark-mode):not(.cosmic-mode) .sps-hist-date-input::-webkit-calendar-picker-indicator,
body.str-pure-white .sps-hist-date-input::-webkit-calendar-picker-indicator {
    filter: none !important;
}

body:not(.dark-mode):not(.cosmic-mode) .sps-hist-table th,
body.str-pure-white .sps-hist-table th {
    background: #f1f5f9 !important;
    color: #334155 !important;
    border-color: #cbd5e1 !important;
}
body:not(.dark-mode):not(.cosmic-mode) .sps-hist-table th.th-group,
body.str-pure-white .sps-hist-table th.th-group {
    background: #e2e8f0 !important;
    color: #0f172a !important;
    border-color: #cbd5e1 !important;
}
body:not(.dark-mode):not(.cosmic-mode) .sps-hist-table td,
body.str-pure-white .sps-hist-table td {
    color: #0f172a !important;
    border-color: #f1f5f9 !important;
}
body:not(.dark-mode):not(.cosmic-mode) .sps-hist-table tr:hover td,
body.str-pure-white .sps-hist-table tr:hover td {
    background: #f8fafc !important;
}
body:not(.dark-mode):not(.cosmic-mode) .sps-hist-table tfoot tr td,
body.str-pure-white .sps-hist-table tfoot tr td {
    background: #f1f5f9 !important;
    border-top: 2px solid #cbd5e1 !important;
    color: #0f172a !important;
}

body:not(.dark-mode):not(.cosmic-mode) .sps-hist-page-btn,
body.str-pure-white .sps-hist-page-btn {
    background: #ffffff !important;
    border-color: #cbd5e1 !important;
    color: #334155 !important;
}

body:not(.dark-mode):not(.cosmic-mode) .sps-hist-btn-export,
body.str-pure-white .sps-hist-btn-export {
    background: #f1f5f9 !important;
    border-color: #cbd5e1 !important;
    color: #334155 !important;
}

/* ===================================================
   COSMIC MODE OVERRIDES (#sps-history-tab)
   =================================================== */
body.cosmic-mode #sps-history-tab,
body.str-bg-cosmic #sps-history-tab {
    background: #060913 !important;
}

body.cosmic-mode .sps-hist-nav,
body.str-bg-cosmic .sps-hist-nav,
body.cosmic-mode .sps-hist-card,
body.str-bg-cosmic .sps-hist-card,
body.cosmic-mode .sps-hist-table-wrap,
body.str-bg-cosmic .sps-hist-table-wrap {
    background: rgba(15, 23, 42, 0.7) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
}

/* ===================================================
   THEMED BORDERS OVERRIDES (#sps-history-tab)
   =================================================== */
body.str-themed-borders .sps-hist-nav,
body.str-themed-borders .sps-hist-card,
body.str-themed-borders .sps-hist-table-wrap {
    border-color: var(--str-accent, #3b82f6) !important;
    box-shadow: 0 0 12px var(--str-accent-soft, rgba(59, 130, 246, 0.15)) !important;
}

