/* ==========================================================================
   SPS DOM (Market Depth / Độ sâu thị trường) & Time & Sales (Khớp lệnh)
   Lấy trực tiếp từ SPS Webtrade (trading.sps360.vn)
   ========================================================================== */

/* Fix th-left specs column to avoid any text clipping or horizontal squishing */
#tonghop-tab aside.th-left {
    width: 265px !important;
    min-width: 265px !important;
    max-width: 265px !important;
    box-sizing: border-box !important;
    padding: 8px 10px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
}

#tonghop-tab aside.th-left .th-pd-row {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: 4px !important;
    white-space: nowrap !important;
    padding: 3.5px 0 !important;
}

#tonghop-tab aside.th-left .th-pd-row .lbl {
    white-space: nowrap !important;
    font-size: 11px !important;
    flex-shrink: 0 !important;
}

#tonghop-tab aside.th-left .th-pd-row .val {
    white-space: nowrap !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    text-align: right !important;
}

#tonghop-tab aside.th-dom-col,
.th-dom-col {
    background: var(--str-bg-surface, #141414);
    border: 1px solid var(--str-border-gold, var(--fs-accent-border, rgba(56, 189, 248, 0.42))) !important;
    border-radius: 10px !important;
    padding: 0;
    overflow: hidden;
    height: 100% !important;
    max-height: 100% !important;
    min-height: 0 !important;
    width: 220px !important;
    min-width: 210px !important;
    max-width: 230px !important;
    box-sizing: border-box !important;
    display: flex;
    flex-direction: column;
    position: relative;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    color: var(--str-text-main, #ffffff);
    transition: all 0.3s ease !important;
}

/* Match theme border and background exactly like th-left, th-chart-wrap, and th-right */
body.dark-mode #tonghop-tab aside.th-dom-col {
    background: var(--str-bg-surface, #141414) !important;
    border: 1px solid var(--str-border-gold, var(--fs-accent-border, rgba(56, 189, 248, 0.42))) !important;
    color: var(--str-text-main, #e2e8f0) !important;
}

body.cosmic-mode #tonghop-tab aside.th-dom-col {
    background: rgba(15, 23, 42, 0.6) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    border: 1px solid var(--str-border-gold, var(--fs-accent-border, rgba(56, 189, 248, 0.42))) !important;
    box-shadow: 0 0 15px rgba(56, 189, 248, 0.08) !important;
    color: var(--str-text-main, #e2e8f0) !important;
}

body.str-pure-black #tonghop-tab aside.th-dom-col {
    background: var(--str-bg-surface, #050505) !important;
    border: 1px solid var(--str-border-gold, var(--fs-accent-border, rgba(56, 189, 248, 0.42))) !important;
}

body.str-themed-borders #tonghop-tab aside.th-dom-col {
    border-color: var(--str-border-gold, var(--fs-accent-border, rgba(56, 189, 248, 0.45))) !important;
}

body.str-feng-shui-active #tonghop-tab aside.th-dom-col {
    background: var(--str-bg-surface, #141414) !important;
    border: 1px solid var(--fs-accent-border, var(--str-border-gold, rgba(56, 189, 248, 0.42))) !important;
    color: var(--str-text-main, #ffffff) !important;
}

body.str-feng-shui-active.str-bg-cosmic #tonghop-tab aside.th-dom-col {
    background: rgba(15, 23, 42, 0.48) !important;
    border: 1px solid var(--fs-accent-border, var(--str-border-gold, rgba(56, 189, 248, 0.42))) !important;
}

body.str-pure-white #tonghop-tab aside.th-dom-col,
body:not(.dark-mode):not(.cosmic-mode) #tonghop-tab aside.th-dom-col {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    color: #111827 !important;
}

/* Adjust th-main grid for 4 columns: th-left (265px), th-center (flex), th-dom (220px), th-right (325px) */
.th-main {
    grid-template-columns: 265px minmax(0, 1fr) 220px 325px !important;
    gap: 8px !important;
}

@media (max-width: 1440px) {
    .th-main {
        grid-template-columns: 260px minmax(0, 1fr) 215px 310px !important;
    }
    .th-dom-col {
        width: 215px !important;
        min-width: 205px !important;
    }
    #tonghop-tab aside.th-left {
        width: 260px !important;
        min-width: 260px !important;
        max-width: 260px !important;
    }
}

@media (max-width: 1250px) {
    .th-main {
        grid-template-columns: 255px minmax(0, 1fr) 205px 290px !important;
    }
    .th-dom-col {
        width: 205px !important;
        min-width: 195px !important;
    }
    #tonghop-tab aside.th-left {
        width: 255px !important;
        min-width: 255px !important;
        max-width: 255px !important;
    }
}

@media (max-width: 900px) {
    .th-dom-col {
        display: none !important;
    }
}

/* Header */
.sps-dom-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 6px 8px !important;
    gap: 6px !important;
    border-bottom: 1px solid var(--str-border-subtle, rgba(15, 23, 42, 0.08)) !important;
    background: var(--str-bg-surface, rgba(15, 23, 42, 0.02)) !important;
    flex-shrink: 0 !important;
    box-sizing: border-box !important;
}

.sps-dom-tabs {
    display: flex !important;
    align-items: center !important;
    gap: 5px !important;
    flex: 1 !important;
    min-width: 0 !important;
}

.sps-dom-tab-btn {
    background: transparent !important;
    border: 1px solid transparent !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
    -webkit-font-smoothing: antialiased !important;
    -moz-osx-font-smoothing: grayscale !important;
    text-rendering: optimizeLegibility !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    letter-spacing: 0.15px !important;
    white-space: nowrap !important;
    color: var(--str-text-muted, #94a3b8) !important;
    cursor: pointer;
    padding: 3.5px 7px !important;
    border-radius: 6px !important;
    transition: all 0.18s ease;
    line-height: 1.25;
    outline: none !important;
    box-shadow: none !important;
    user-select: none;
}

.sps-dom-tab-btn:hover {
    color: var(--fs-accent, var(--str-accent, #38bdf8)) !important;
    background: var(--str-accent-soft, rgba(148, 163, 184, 0.12)) !important;
}

.sps-dom-tab-btn:focus,
.sps-dom-tab-btn:focus-visible {
    outline: none !important;
}

.sps-dom-tab-btn.active {
    color: var(--fs-accent, var(--str-accent, #38bdf8)) !important;
    font-weight: 600 !important;
    background: var(--str-accent-soft, rgba(56, 189, 248, 0.14)) !important;
    border: 1px solid var(--str-accent, var(--str-border-gold, rgba(56, 189, 248, 0.42))) !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
}

body:not(.dark-mode):not(.cosmic-mode) .sps-dom-tab-btn.active {
    color: var(--str-accent, #1d4ed8) !important;
    background: var(--str-accent-soft, rgba(59, 130, 246, 0.1)) !important;
    border: 1px solid var(--str-accent, rgba(59, 130, 246, 0.35)) !important;
}

.sps-dom-tab-pipe {
    display: none !important;
}

.sps-dom-sym-badge {
    background: var(--str-accent-soft, rgba(56, 189, 248, 0.15)) !important;
    color: var(--str-accent, var(--fs-accent, #38bdf8)) !important;
    border: 1px solid var(--str-accent, var(--str-border-gold, rgba(56, 189, 248, 0.3))) !important;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 4px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    letter-spacing: 0.3px;
    margin-left: auto;
    white-space: nowrap;
    flex-shrink: 0;
}

body.dark-mode .sps-dom-sym-badge,
body.cosmic-mode .sps-dom-sym-badge {
    background: var(--str-accent-soft, rgba(56, 189, 248, 0.15)) !important;
    color: var(--str-accent, var(--fs-accent, #38bdf8)) !important;
    border-color: var(--str-accent, var(--str-border-gold, rgba(56, 189, 248, 0.3))) !important;
}

.sps-dom-expand-btn {
    background: transparent !important;
    border: 1px solid rgba(148, 163, 184, 0.25) !important;
    color: #94a3b8 !important;
    border-radius: 6px !important;
    width: 22px !important;
    height: 22px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer;
    padding: 0 !important;
    transition: all 0.18s ease;
    flex-shrink: 0 !important;
    margin-left: auto !important;
    outline: none !important;
}

.sps-dom-expand-btn:focus,
.sps-dom-expand-btn:focus-visible {
    outline: none !important;
}

.sps-dom-expand-btn:hover {
    color: var(--fs-accent, var(--str-accent, #38bdf8)) !important;
    border-color: var(--fs-accent, var(--str-accent, #38bdf8)) !important;
    background: var(--str-accent-soft, rgba(56, 189, 248, 0.14)) !important;
}

/* Panes */
.sps-dom-pane {
    display: none;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

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

/* Mode Filter Icons */
.sps-dom-modes {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
    flex-shrink: 0;
}

.sps-dom-mode-btn {
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    width: 22px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 2px;
    transition: all 0.15s;
}

.sps-dom-mode-btn:hover {
    background: var(--str-accent-soft, rgba(148, 163, 184, 0.15)) !important;
}

.sps-dom-mode-btn.active {
    background: var(--str-accent-soft, rgba(59, 130, 246, 0.14)) !important;
    border-color: var(--str-accent, var(--fs-accent, #38bdf8)) !important;
}

/* Mode icon glyphs */
.dom-icon-split {
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: 12px;
    height: 12px;
}
.dom-icon-split .bar-top {
    height: 5px;
    background: #ef4444;
    border-radius: 1px;
}
.dom-icon-split .bar-bot {
    height: 5px;
    background: #10b981;
    border-radius: 1px;
}

.dom-icon-bids {
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: 12px;
    height: 12px;
}
.dom-icon-bids .bar-full {
    height: 12px;
    background: #10b981;
    border-radius: 1px;
}

.dom-icon-asks {
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: 12px;
    height: 12px;
}
.dom-icon-asks .bar-full {
    height: 12px;
    background: #ef4444;
    border-radius: 1px;
}

.dom-icon-bars {
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: 12px;
    height: 12px;
}
.dom-icon-bars span {
    height: 2px;
    background: #64748b;
    border-radius: 1px;
}

/* Table Header */
.sps-dom-table-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    background: rgba(15, 23, 42, 0.03);
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
    flex-shrink: 0;
}

/* Scrollable DOM List */
.sps-dom-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

.sps-dom-asks, .sps-dom-bids {
    display: flex;
    flex-direction: column;
}

/* Row in DOM */
.sps-dom-row {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 3px 10px;
    font-size: 11.5px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
    user-select: none;
    transition: background 0.12s;
    height: 22px;
    box-sizing: border-box;
}

.sps-dom-row:hover {
    background: var(--str-accent-soft, rgba(56, 189, 248, 0.12)) !important;
}

.sps-dom-row.ask .sps-dom-price {
    color: #ef4444;
    font-weight: 700;
    z-index: 1;
}

.sps-dom-row.bid .sps-dom-price {
    color: #10b981;
    font-weight: 700;
    z-index: 1;
}

.sps-dom-row .sps-dom-vol {
    color: #475569;
    font-weight: 600;
    z-index: 1;
    text-align: right;
}

/* Horizontal Volume Depth Bar (from right to left) */
.sps-dom-bar {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    z-index: 0;
    pointer-events: none;
    transition: width 0.25s ease;
}

.sps-dom-row.ask .sps-dom-bar {
    background: rgba(239, 68, 68, 0.18);
}

.sps-dom-row.bid .sps-dom-bar {
    background: rgba(16, 185, 129, 0.18);
}

/* Middle Last Price / Spread Row */
.sps-dom-last-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    margin: 2px 0;
    border-top: 1px dashed rgba(148, 163, 184, 0.25);
    border-bottom: 1px dashed rgba(148, 163, 184, 0.25);
    background: rgba(15, 23, 42, 0.03);
    flex-shrink: 0;
    user-select: none;
}

.sps-dom-last-price {
    font-size: 14.5px;
    font-weight: 800;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.sps-dom-last-price.down {
    color: #ef4444;
}

.sps-dom-last-price.up {
    color: #10b981;
}

.sps-dom-last-arrow {
    font-size: 13px;
    font-weight: 800;
}
.sps-dom-last-arrow.down {
    color: #ef4444;
}
.sps-dom-last-arrow.up {
    color: #10b981;
}

/* Bottom Power Meter */
.sps-dom-power-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-top: 1px solid rgba(15, 23, 42, 0.08);
    background: rgba(15, 23, 42, 0.02);
    flex-shrink: 0;
}

.sps-power-val {
    font-size: 11px;
    font-weight: 800;
    min-width: 28px;
    font-variant-numeric: tabular-nums;
}

.sps-power-bid {
    color: #10b981;
    text-align: left;
}

.sps-power-ask {
    color: #ef4444;
    text-align: right;
}

.sps-power-track {
    flex: 1;
    height: 5px;
    border-radius: 3px;
    display: flex;
    overflow: hidden;
    background: #cbd5e1;
}

.sps-power-bar-bid {
    height: 100%;
    background: #10b981;
    transition: width 0.3s ease;
}

.sps-power-bar-ask {
    height: 100%;
    background: #ef4444;
    transition: width 0.3s ease;
}

/* PANE 2: KHỚP LỆNH (TIME & SALES) */
.sps-trades-table-head {
    display: grid;
    grid-template-columns: 58px 52px 46px 36px;
    align-items: center;
    padding: 6px 8px;
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    background: rgba(15, 23, 42, 0.03);
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    flex-shrink: 0;
    box-sizing: border-box;
}

.sps-trades-table-head span:last-child {
    text-align: center;
}

.sps-trades-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.sps-trade-row {
    display: grid;
    grid-template-columns: 58px 52px 46px 36px;
    align-items: center;
    padding: 3px 8px;
    font-size: 11.5px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-variant-numeric: tabular-nums;
    border-bottom: 1px solid rgba(15, 23, 42, 0.04);
    height: 22px;
    box-sizing: border-box;
}

.sps-trade-row:hover {
    background: rgba(15, 23, 42, 0.04);
}

.sps-trade-row .tr-time {
    color: #64748b;
    font-size: 11px;
}

.sps-trade-row .tr-price {
    color: #0f172a;
    font-weight: 700;
}

.sps-trade-row .tr-chg {
    font-weight: 700;
}

.sps-trade-row .tr-chg.up {
    color: #10b981;
}

.sps-trade-row .tr-chg.down {
    color: #ef4444;
}

.sps-trade-row .tr-vol {
    text-align: center;
    color: #475569;
    font-weight: 700;
}

/* Flash animation for new trades */
@keyframes spsTradeFlash {
    0% { background: rgba(59, 130, 246, 0.35); }
    100% { background: transparent; }
}

.sps-trade-flash {
    animation: spsTradeFlash 0.9s ease-out;
}

/* Empty state */
.sps-dom-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #94a3b8;
    font-size: 12px;
    text-align: center;
    padding: 20px;
}

/* ==========================================================================
   THEME SUPPORT: DARK MODE & COSMIC
   ========================================================================== */

body.dark-mode .th-dom-col,
body.cosmic-mode .th-dom-col {
    color: var(--str-text-main, #e2e8f0) !important;
}

body.dark-mode .sps-dom-header,
body.cosmic-mode .sps-dom-header {
    background: rgba(255, 255, 255, 0.03) !important;
    border-color: rgba(203, 213, 225, 0.12) !important;
}

body.dark-mode .sps-dom-tab-btn,
body.cosmic-mode .sps-dom-tab-btn {
    color: #94a3b8 !important;
}

body.dark-mode .sps-dom-tab-btn.active,
body.cosmic-mode .sps-dom-tab-btn.active {
    color: var(--str-accent, var(--fs-accent, #38bdf8)) !important;
    background: var(--str-accent-soft, rgba(56, 189, 248, 0.14)) !important;
    border: 1px solid var(--str-accent, var(--str-border-gold, rgba(56, 189, 248, 0.42))) !important;
}

body.dark-mode .sps-dom-expand-btn,
body.cosmic-mode .sps-dom-expand-btn {
    border-color: rgba(148, 163, 184, 0.25) !important;
    color: #94a3b8 !important;
}

body.dark-mode .sps-dom-expand-btn:hover,
body.cosmic-mode .sps-dom-expand-btn:hover {
    color: var(--str-accent, var(--fs-accent, #38bdf8)) !important;
    border-color: var(--str-accent, var(--fs-accent, #38bdf8)) !important;
    background: var(--str-accent-soft, rgba(56, 189, 248, 0.14)) !important;
}

body.dark-mode .sps-dom-modes,
body.cosmic-mode .sps-dom-modes {
    border-color: rgba(203, 213, 225, 0.08);
}

body.dark-mode .sps-dom-mode-btn:hover,
body.cosmic-mode .sps-dom-mode-btn:hover {
    background: rgba(255, 255, 255, 0.08);
}

body.dark-mode .sps-dom-table-head,
body.cosmic-mode .sps-dom-table-head,
body.dark-mode .sps-trades-table-head,
body.cosmic-mode .sps-trades-table-head {
    background: rgba(255, 255, 255, 0.03);
    color: #94a3b8;
    border-color: rgba(203, 213, 225, 0.1);
}

body.dark-mode .sps-dom-row:hover,
body.cosmic-mode .sps-dom-row:hover {
    background: var(--str-accent-soft, rgba(56, 189, 248, 0.15)) !important;
}

body.dark-mode .sps-dom-row .sps-dom-vol,
body.cosmic-mode .sps-dom-row .sps-dom-vol {
    color: #cbd5e1;
}

body.dark-mode .sps-dom-last-wrap,
body.cosmic-mode .sps-dom-last-wrap {
    background: rgba(255, 255, 255, 0.02);
    border-color: rgba(203, 213, 225, 0.12);
}

body.dark-mode .sps-power-track,
body.cosmic-mode .sps-power-track {
    background: #1e293b;
}

body.dark-mode .sps-dom-power-wrap,
body.cosmic-mode .sps-dom-power-wrap {
    background: rgba(255, 255, 255, 0.02);
    border-color: rgba(203, 213, 225, 0.1);
}

body.dark-mode .sps-trade-row,
body.cosmic-mode .sps-trade-row {
    border-color: rgba(203, 213, 225, 0.06);
}

body.dark-mode .sps-trade-row:hover,
body.cosmic-mode .sps-trade-row:hover {
    background: rgba(255, 255, 255, 0.04);
}

body.dark-mode .sps-trade-row .tr-time,
body.cosmic-mode .sps-trade-row .tr-time {
    color: #94a3b8;
}

body.dark-mode .sps-trade-row .tr-price,
body.cosmic-mode .sps-trade-row .tr-price {
    color: #f8fafc;
}

body.dark-mode .sps-trade-row .tr-vol,
body.cosmic-mode .sps-trade-row .tr-vol {
    color: #cbd5e1;
}



/* ==========================================================================
   CUMULATIVE DEPTH (BIỂU ĐỒ TÍCH LŨY) STYLES
   ========================================================================== */
.sps-dom-cum-chart-box {
    padding: 6px 8px 4px;
    background: rgba(15, 23, 42, 0.02);
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex-shrink: 0;
}

.sps-cum-chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 10px;
    font-weight: 700;
}

.sps-cum-chart-header .bid-title {
    color: #10b981;
}

.sps-cum-chart-header .ask-title {
    color: #ef4444;
}

.sps-cum-chart-svg {
    width: 100%;
    height: 105px;
    display: block;
    overflow: visible;
}

.sps-dom-row.sps-cum-row {
    display: grid;
    grid-template-columns: 1fr auto;
}

.sps-cum-row .sps-cum-vol-wrap {
    display: flex;
    align-items: baseline;
    gap: 5px;
    z-index: 1;
}

.sps-cum-row .sps-cum-total {
    font-weight: 700;
    font-size: 11px;
}

.sps-cum-row.ask .sps-cum-total {
    color: #ef4444;
}

.sps-cum-row.bid .sps-cum-total {
    color: #10b981;
}

.sps-cum-row .sps-cum-single {
    color: #64748b;
    font-size: 9.5px;
    font-weight: 500;
}

body.dark-mode .sps-dom-cum-chart-box,
body.cosmic-mode .sps-dom-cum-chart-box {
    background: rgba(255, 255, 255, 0.02);
    border-color: rgba(203, 213, 225, 0.08);
}

body.dark-mode .sps-cum-row .sps-cum-single,
body.cosmic-mode .sps-cum-row .sps-cum-single {
    color: #94a3b8;
}

/* ==========================================================================
   FULLSCREEN / MODAL DIALOG (PHÓNG TO TOÀN MÀN HÌNH)
   ========================================================================== */
.sps-dom-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(15, 23, 42, 0.78);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.sps-dom-modal-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

.sps-dom-modal-window {
    background: #ffffff;
    width: 100%;
    max-width: 1080px;
    height: 90vh;
    max-height: 820px;
    border-radius: 12px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(15, 23, 42, 0.16);
    transform: scale(0.97);
    transition: transform 0.2s ease;
    box-sizing: border-box;
}

.sps-dom-modal-backdrop.active .sps-dom-modal-window {
    transform: scale(1);
}

.sps-dom-modal-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: rgba(15, 23, 42, 0.03);
    border-bottom: 1px solid rgba(15, 23, 42, 0.1);
    flex-shrink: 0;
}

.sps-modal-title-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sps-modal-title {
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
}

.sps-modal-sym-badge {
    background: var(--str-accent-soft, rgba(37, 99, 235, 0.12)) !important;
    color: var(--str-accent, #2563eb) !important;
    border: 1px solid var(--str-accent, rgba(37, 99, 235, 0.3)) !important;
    font-size: 13px;
    font-weight: 800;
    padding: 3px 10px;
    border-radius: 5px;
    font-family: ui-monospace, SFMono-Regular, monospace;
}

.sps-modal-price-badge {
    font-size: 14px;
    font-weight: 800;
    padding: 3px 10px;
    border-radius: 4px;
    font-family: ui-monospace, SFMono-Regular, monospace;
}
.sps-modal-price-badge.up {
    background: rgba(16, 185, 129, 0.12);
    color: #10b981;
}
.sps-modal-price-badge.down {
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
}

.sps-modal-live-tag {
    font-size: 11px;
    font-weight: 700;
    color: #10b981;
    display: flex;
    align-items: center;
    gap: 4px;
}
.sps-modal-live-tag::before {
    content: '';
    display: inline-block;
    width: 7px;
    height: 7px;
    background: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 6px #10b981;
}

.sps-dom-modal-close {
    background: transparent;
    border: 1px solid rgba(148, 163, 184, 0.3);
    color: #64748b;
    border-radius: 6px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.15s;
}

.sps-dom-modal-close:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border-color: #ef4444;
}

.sps-dom-modal-body {
    display: grid;
    grid-template-columns: 480px minmax(0, 1fr);
    gap: 12px;
    padding: 12px 16px;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.sps-modal-col-dom {
    display: flex;
    flex-direction: column;
    background: #f8fafc;
    border: 1px solid rgba(15, 23, 42, 0.1);
    border-radius: 8px;
    overflow: hidden;
    min-height: 0;
}

.sps-modal-col-side {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
    overflow: hidden;
}

.sps-modal-chart-card {
    display: flex;
    flex-direction: column;
    background: #f8fafc;
    border: 1px solid rgba(15, 23, 42, 0.1);
    border-radius: 8px;
    padding: 10px;
    height: 48%;
    min-height: 200px;
    box-sizing: border-box;
    overflow: hidden;
}

.sps-modal-trades-card {
    display: flex;
    flex-direction: column;
    background: #f8fafc;
    border: 1px solid rgba(15, 23, 42, 0.1);
    border-radius: 8px;
    padding: 0;
    height: 52%;
    min-height: 200px;
    box-sizing: border-box;
    overflow: hidden;
}

.sps-modal-card-title {
    font-size: 12.5px;
    font-weight: 700;
    color: #475569;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    flex-shrink: 0;
}

#sps-modal-chart-spread {
    font-size: 12.5px !important;
    font-weight: 800 !important;
    color: var(--str-accent, #38bdf8) !important;
}

#sps-modal-chart-container {
    flex: 1;
    min-height: 0;
    width: 100%;
    display: flex;
    align-items: stretch;
}

#sps-modal-chart-container .sps-cum-chart-svg {
    width: 100%;
    height: 100% !important;
    min-height: 200px;
    max-height: 100%;
    display: block;
}

.sps-dom-modal-foot {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 8px 16px;
    background: rgba(15, 23, 42, 0.02);
    border-top: 1px solid rgba(15, 23, 42, 0.08);
    font-size: 12px;
    color: #64748b;
    flex-shrink: 0;
}

.sps-modal-btn-close {
    background: rgba(15, 23, 42, 0.06);
    border: 1px solid rgba(15, 23, 42, 0.15);
    color: #0f172a;
    padding: 6px 16px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
}

.sps-modal-btn-close:hover {
    background: rgba(15, 23, 42, 0.12);
}

/* Fullscreen modal DOM table styles */
.sps-modal-dom-head {
    display: grid;
    grid-template-columns: 42px 1fr 65px 65px 50px;
    align-items: center;
    padding: 6px 10px;
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
    background: rgba(15, 23, 42, 0.03);
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    flex-shrink: 0;
}
.sps-modal-dom-head span:nth-child(n+3) {
    text-align: right;
}

.sps-modal-dom-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.sps-modal-dom-row {
    position: relative;
    display: grid;
    grid-template-columns: 42px 1fr 65px 65px 50px;
    align-items: center;
    padding: 3px 10px;
    font-size: 12px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-variant-numeric: tabular-nums;
    border-bottom: 1px solid rgba(15, 23, 42, 0.04);
    height: 24px;
    box-sizing: border-box;
    cursor: pointer;
    transition: background-color 0.1s ease;
}

.sps-modal-dom-row:hover {
    background: rgba(59, 130, 246, 0.1) !important;
}

.sps-modal-dom-row .pos-tag {
    font-size: 10px;
    color: #94a3b8;
    z-index: 1;
}

.sps-modal-dom-row.ask .px-val {
    color: #ef4444;
    font-weight: 700;
    z-index: 1;
}

.sps-modal-dom-row.bid .px-val {
    color: #10b981;
    font-weight: 700;
    z-index: 1;
}

.sps-modal-dom-row .vol-val {
    text-align: right;
    color: #0f172a;
    font-weight: 700;
    z-index: 1;
}

.sps-modal-dom-row .cum-val {
    text-align: right;
    color: #64748b;
    font-weight: 600;
    z-index: 1;
}

.sps-modal-dom-row .pct-val {
    text-align: right;
    color: #94a3b8;
    font-size: 10.5px;
    z-index: 1;
}

.sps-modal-dom-row .depth-bar {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    z-index: 0;
    pointer-events: none;
    transition: width 0.2s ease;
}

.sps-modal-dom-row.ask .depth-bar {
    background: rgba(239, 68, 68, 0.15);
}

.sps-modal-dom-row.bid .depth-bar {
    background: rgba(16, 185, 129, 0.15);
}

/* Modal dark & cosmic modes */
body.dark-mode .sps-dom-modal-window,
body.cosmic-mode .sps-dom-modal-window {
    background: #0f172a;
    border-color: rgba(203, 213, 225, 0.2);
    color: #e2e8f0;
}

body.dark-mode .sps-dom-modal-head,
body.cosmic-mode .sps-dom-modal-head,
body.dark-mode .sps-dom-modal-foot,
body.cosmic-mode .sps-dom-modal-foot {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(203, 213, 225, 0.1);
}

body.dark-mode .sps-modal-title,
body.cosmic-mode .sps-modal-title {
    color: #f8fafc;
}

body.dark-mode .sps-modal-col-dom,
body.cosmic-mode .sps-modal-col-dom,
body.dark-mode .sps-modal-chart-card,
body.cosmic-mode .sps-modal-chart-card,
body.dark-mode .sps-modal-trades-card,
body.cosmic-mode .sps-modal-trades-card {
    background: #0b0e14;
    border-color: rgba(203, 213, 225, 0.12);
}

body.dark-mode .sps-modal-card-title,
body.cosmic-mode .sps-modal-card-title {
    color: #94a3b8;
}

body.dark-mode .sps-modal-dom-head,
body.cosmic-mode .sps-modal-dom-head {
    background: rgba(255, 255, 255, 0.02);
    border-color: rgba(203, 213, 225, 0.08);
    color: #94a3b8;
}

body.dark-mode .sps-modal-dom-row,
body.cosmic-mode .sps-modal-dom-row {
    border-color: rgba(203, 213, 225, 0.05);
}

body.dark-mode .sps-modal-dom-row .vol-val,
body.cosmic-mode .sps-modal-dom-row .vol-val {
    color: #e2e8f0;
}

body.dark-mode .sps-modal-dom-row .cum-val,
body.cosmic-mode .sps-modal-dom-row .cum-val {
    color: #94a3b8;
}

body.dark-mode .sps-modal-btn-close,
body.cosmic-mode .sps-modal-btn-close {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    color: #e2e8f0;
}
body.dark-mode .sps-modal-btn-close:hover,
body.cosmic-mode .sps-modal-btn-close:hover {
    background: rgba(255, 255, 255, 0.15);
}

