:root {
    --bg-color: #0d1117;
    --panel-bg: rgba(22, 27, 34, 0.7);
    --border-color: rgba(48, 54, 61, 0.5);
    --text-main: #c9d1d9;
    --text-muted: #8b949e;

    --buy-color: #089981;
    /* TradingView Green */
    --sell-color: #f23645;
    /* TradingView Red */
    --hover-bg: rgba(255, 255, 255, 0.05);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    overflow: hidden;
    /* Prevent body scroll, layout is app-like */
    height: 100vh;
}

.dashboard-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* ── Chart Modal Overlay ─────────────────────────────────────────────────── */
.chart-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 950;
    align-items: center;
    justify-content: center;
}
.chart-modal.open {
    display: flex;
}
.chart-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.78);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.chart-modal-inner {
    position: relative;
    width: 92vw;
    height: 88vh;
    max-width: 1600px;
    background: #000;
    border: 1px solid rgba(48, 54, 61, 0.7);
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 80px rgba(0,0,0,0.7);
}
.chart-modal-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 12px;
    background: rgba(13, 17, 23, 0.92);
    border-bottom: 1px solid rgba(48, 54, 61, 0.6);
    flex-shrink: 0;
    gap: 10px;
    height: 40px;
}
.chart-close-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    background: rgba(242, 54, 69, 0.12);
    color: #f23645;
    border: 1px solid rgba(242, 54, 69, 0.35);
    border-radius: 5px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    white-space: nowrap;
}
.chart-close-btn:hover { background: rgba(242, 54, 69, 0.28); }

.btn-open-chart {
    display: flex;
    align-items: center;
    gap: 5px;
    background: rgba(56, 189, 248, 0.10);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.35);
    border-radius: 5px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
}
.btn-open-chart:hover { background: rgba(56, 189, 248, 0.22); }

.tradingview-widget-container {
    flex: 1;
    width: 100%;
    min-height: 0;
}

#tradingview_chart {
    width: 100%;
    height: 100%;
}

/* Legacy overlay-glass — kept for any remaining references but hidden in modal context */
.overlay-glass { display: none; }

.custom-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    margin-top: 6px;
    background: rgba(13, 17, 23, 0.95);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    max-height: 250px;
    overflow-y: auto;
    z-index: 100;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.custom-dropdown.hidden {
    display: none;
}

.dropdown-item {
    padding: 10px 12px;
    font-size: 13px;
    color: var(--text-main);
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item:hover {
    background: var(--hover-bg);
    color: #fff;
}

.dropdown-item .symbol-name {
    font-weight: 600;
    color: var(--buy-color);
}

.header-compact {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-compact .logo {
    font-size: 16px;
    line-height: 1;
}

.symbol-selector {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(0, 0, 0, 0.4);
    padding: 2px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.symbol-selector input {
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: 13px;
    padding: 4px 8px;
    width: 130px;
    outline: none;
    font-family: monospace;
}

.symbol-selector button {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--text-main);
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.2s;
}

.symbol-selector button:hover {
    background: rgba(255, 255, 255, 0.2);
}

.btn-overlay-toggle {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
    margin-left: 8px;
}

.btn-overlay-toggle:hover {
    color: var(--text-main);
}

.btn-overlay-restore {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(13, 17, 23, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    width: 36px;
    height: 36px;
    font-size: 16px;
    color: var(--text-main);
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.btn-overlay-restore.hidden,
.overlay-glass.hidden {
    display: none !important;
}

.btn-overlay-restore:hover {
    background: var(--hover-bg);
}

/* Toggle Panel Button */
.btn-toggle-panel {
    flex-shrink: 0;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-toggle-panel:hover {
    background: var(--hover-bg);
}

.header h1 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 4px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-muted);
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #e3b341;
    /* Connecting: yellow */
    transition: background-color 0.3s ease;
}

.dot.connected {
    background-color: var(--buy-color);
    /* Connected: Green */
    box-shadow: 0 0 8px var(--buy-color);
}

.dot.disconnected {
    background-color: var(--sell-color);
    /* Disconnected: Red */
    box-shadow: 0 0 8px var(--sell-color);
}

/* Signals Sidebar Panel */
.signals-panel {
    width: 360px;
    min-width: 360px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-left: 1px solid var(--border-color);
    background: var(--panel-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 20;
    transition: margin-right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.signals-panel.hidden {
    margin-right: -360px;
    /* Slide off screen */
}

.panel-header {
    padding: 0;
    display: flex;
    flex-direction: column;
    border-bottom: 1px solid var(--border-color);
}

/* ── Top filter bar ──────────────────────────────────────────────────────── */
.panel-filter-row {
    position: relative;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
    padding: 7px 12px;
    background: rgba(0,0,0,0.25);
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.panel-filter-clear-group {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
}

/* ── Scan controls row ───────────────────────────────────────────────────── */
.panel-header-row1 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 12px;
}

.panel-header h2 {
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
}

.panel-header-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.panel-header-clear-group {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-left: auto;
}

.hide-old-container {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.hide-old-container input {
    cursor: pointer;
    accent-color: var(--buy-color);
}

.signal-filter-dropdown {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 6px 8px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    outline: none;
    transition: all 0.2s ease;
}

.signal-filter-dropdown:hover {
    background: rgba(255, 255, 255, 0.1);
}

.signal-filter-dropdown option {
    background: #161b22;
    color: #c9d1d9;
}

.btn-clear {
    background: rgba(242,54,69,0.10);
    border: 1px solid rgba(242,54,69,0.35);
    color: #f23645;
    padding: 5px 11px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-clear:hover {
    background: rgba(242,54,69,0.22);
    border-color: #f23645;
    color: #fff;
}

.btn-clear-cat {
    background: rgba(255,165,0,0.10);
    border-color: rgba(255,165,0,0.40);
    color: #ffa500;
}

.btn-clear-cat:hover {
    background: rgba(255,165,0,0.22);
    border-color: #ffa500;
    color: #fff;
}

.scan-interval-dropdown {
    background: var(--card-bg);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 6px 8px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    outline: none;
}

.scan-interval-dropdown:focus, .volume-status-dropdown:focus {
    border-color: var(--accent-color);
}

.volume-status-dropdown {
    background: var(--card-bg);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 6px 8px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    outline: none;
}

.btn-scan {
    background: var(--buy-color);
    color: #fff;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-scan:hover {
    filter: brightness(1.2);
}

.btn-scan:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
    opacity: 0.7;
}

/* Backtest button (Chapter 12) */
.btn-backtest {
    background: rgba(168, 85, 247, 0.14);
    border: 1px solid rgba(168, 85, 247, 0.45);
    color: #a855f7;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
}
.btn-backtest:hover { filter: brightness(1.25); }
.btn-backtest.loading { opacity: 0.6; cursor: not-allowed; }

/* Sentinel status bar (Chapter 14) */
.sentinel-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 4px;
    transition: background 0.3s;
}
.sentinel-bar.hidden { display: none; }
.sentinel-bar.sentinel-ok {
    background: rgba(8, 153, 129, 0.12);
    border: 1px solid rgba(8, 153, 129, 0.35);
    color: #089981;
}
.sentinel-bar.sentinel-warn {
    background: rgba(255, 165, 0, 0.12);
    border: 1px solid rgba(255, 165, 0, 0.4);
    color: #ffa500;
}
.sentinel-bar.sentinel-paused {
    background: rgba(242, 54, 69, 0.14);
    border: 1px solid rgba(242, 54, 69, 0.45);
    color: #f23645;
    animation: flashPulse 2s infinite;
}
.sentinel-resume-btn {
    margin-left: auto;
    background: rgba(242, 54, 69, 0.18);
    border: 1px solid rgba(242, 54, 69, 0.5);
    color: #f23645;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    cursor: pointer;
}
.sentinel-resume-btn:hover { filter: brightness(1.2); }

.btn-download-pdf {
    background: rgba(56, 139, 253, 0.12);
    border: 1px solid rgba(56, 139, 253, 0.4);
    color: #63b3ed;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-download-pdf:hover {
    background: rgba(56, 139, 253, 0.25);
    border-color: #63b3ed;
    color: #fff;
}

.btn-scan.loading::after {
    content: "";
    width: 12px;
    height: 12px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.scan-column {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: center;
}

/* ── Advanced Filter Dropdown ──────────────────────────────────────────── */
.adv-filter-wrapper {
    position: static;
}

.adv-filter-btn {
    background: rgba(0,0,0,0.4);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    outline: none;
    transition: all 0.2s ease;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 5px;
}

.adv-filter-btn:hover, .adv-filter-btn.active {
    background: rgba(255,255,255,0.1);
    border-color: var(--accent-color);
    color: #fff;
}

.adv-filter-count {
    background: var(--accent-color);
    color: #fff;
    border-radius: 10px;
    padding: 1px 6px;
    font-size: 10px;
    font-weight: 700;
    min-width: 16px;
    text-align: center;
}

.adv-filter-panel {
    position: absolute;
    top: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 200;
    background: rgba(13, 17, 23, 0.97);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    min-width: 360px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}

.adv-filter-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.adv-filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.adv-filter-group-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--accent-color);
    margin-bottom: 2px;
    white-space: nowrap;
}

.adv-filter-check {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    transition: color 0.15s;
}

.adv-filter-check:hover {
    color: var(--text-main);
}

.adv-filter-check input[type="checkbox"] {
    cursor: pointer;
    accent-color: var(--accent-color);
    width: 12px;
    height: 12px;
    flex-shrink: 0;
}

.adv-filter-check input[type="checkbox"]:checked + * {
    color: var(--text-main);
}

.adv-filter-footer {
    margin-top: 10px;
    border-top: 1px solid var(--border-color);
    padding-top: 8px;
    display: flex;
    justify-content: flex-end;
}

.adv-filter-clear-btn {
    background: transparent;
    border: 1px solid rgba(242,54,69,0.35);
    color: #f23645;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.adv-filter-clear-btn:hover {
    background: rgba(242,54,69,0.15);
    border-color: #f23645;
}

.btn-clear-old {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    white-space: nowrap;
}

.btn-clear-old:hover {
    background: var(--hover-bg);
    color: var(--text-main);
    border-color: var(--text-muted);
}

/* ── Top 5 Bets Section ──────────────────────────────────────────────────── */
.top5-section {
    border-bottom: 1px solid var(--border-color);
}

.top5-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
    border-left: 3px solid transparent;
}

.top5-header:hover {
    background: var(--hover-bg);
}

/* Safe panel — blue accent */
.safe-header {
    border-left-color: #63b3ed;
}
.safe-header:hover {
    background: rgba(99, 179, 237, 0.06);
}
.safe-title {
    color: #63b3ed;
}

/* Risky panel — amber accent */
.risky-header {
    border-left-color: #f6ad55;
}
.risky-header:hover {
    background: rgba(246, 173, 85, 0.06);
}
.risky-title {
    color: #f6ad55;
}

.top5-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: 0.03em;
}

.top5-subtitle {
    font-size: 10px;
    color: var(--text-muted);
    flex: 1;
}

.top5-chevron {
    font-size: 11px;
    color: var(--text-muted);
    transition: transform 0.2s;
}

.top5-chevron.collapsed {
    transform: rotate(-90deg);
}

.top5-body {
    padding: 0 10px 10px;
    overflow: hidden;
    max-height: 520px;
    transition: max-height 0.3s ease, padding 0.3s ease;
}

.top5-body.top5-collapsed {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
}

/* Scrollable inner list — keeps the collapse animation on the outer wrapper */
.top5-cards {
    display: flex;
    flex-direction: column;
    gap: 5px;
    max-height: 340px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.15) transparent;
    padding-right: 2px;
}

.top5-cards::-webkit-scrollbar {
    width: 4px;
}

.top5-cards::-webkit-scrollbar-track {
    background: transparent;
}

.top5-cards::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.15);
    border-radius: 4px;
}

.top5-cards::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.3);
}

.top5-empty {
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
    padding: 10px 0;
}

.top5-card {
    display: grid;
    grid-template-columns: 22px 1fr auto;
    align-items: start;
    gap: 5px 8px;
    padding: 8px 10px 8px;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border-color);
    border-radius: 7px;
    cursor: pointer;
    transition: all 0.18s ease;
    position: relative;
    overflow: hidden;
}

/* Entry / SL row — spans full card width */
.top5-entry-sl {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 0 5px;
    border-top: 1px solid rgba(255,255,255,0.06);
    flex-wrap: wrap;
}

.top5-trade-label {
    font-size: 9px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.top5-trade-val {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-main);
    margin-right: 8px;
}

.top5-sl-val {
    color: #f23645;
}

/* Mandatory risky warning strip — spans full card width */
.top5-risk-warning {
    grid-column: 1 / -1;
    font-size: 9px;
    font-weight: 700;
    color: #f6ad55;
    background: rgba(246, 173, 85, 0.08);
    border-top: 1px solid rgba(246, 173, 85, 0.2);
    padding: 4px 0 5px;
    letter-spacing: 0.02em;
    text-align: center;
}

.top5-scalp-btn {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 100%;
    padding: 5px 0;
    margin-top: 4px;
    background: rgba(247, 147, 26, 0.12);
    border: 1px solid rgba(247, 147, 26, 0.3);
    border-radius: 5px;
    color: #f7931a;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, opacity 0.15s;
    opacity: 0;
}
.top5-card:hover .top5-scalp-btn {
    opacity: 1;
}
.top5-scalp-btn:hover {
    background: rgba(247, 147, 26, 0.25);
    border-color: rgba(247, 147, 26, 0.6);
}
.top5-scalp-btn:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}
.top5-scalp-btn.top5-scalp-ok {
    background: rgba(72, 187, 120, 0.2);
    border-color: rgba(72, 187, 120, 0.5);
    color: #68d391;
    opacity: 1;
}
.top5-scalp-btn.top5-scalp-err {
    background: rgba(245, 101, 101, 0.2);
    border-color: rgba(245, 101, 101, 0.5);
    color: #fc8181;
    opacity: 1;
}

.top5-card::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    border-radius: 7px 0 0 7px;
}

.top5-card.buy::before  { background: var(--buy-color); }
.top5-card.sell::before { background: var(--sell-color); }

.top5-card:hover {
    background: rgba(255,255,255,0.07);
    border-color: rgba(255,255,255,0.2);
    transform: translateX(2px);
}

.top5-card.selected {
    background: rgba(99,179,237,0.08);
    border-color: rgba(99,179,237,0.4);
}

.top5-rank {
    font-size: 14px;
    text-align: center;
    line-height: 1;
}

.top5-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.top5-asset {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 5px;
}

.top5-dir-badge {
    font-size: 9px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.top5-dir-badge.buy  { background: rgba(38,166,154,0.2); color: var(--buy-color); }
.top5-dir-badge.sell { background: rgba(242,54,69,0.2);  color: var(--sell-color); }

.top5-cls-safe {
    font-size: 8px;
    font-weight: 700;
    padding: 1px 4px;
    border-radius: 3px;
    background: rgba(99, 179, 237, 0.15);
    color: #63b3ed;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    flex-shrink: 0;
}

.top5-cls-risky {
    font-size: 8px;
    font-weight: 700;
    padding: 1px 4px;
    border-radius: 3px;
    background: rgba(246, 173, 85, 0.15);
    color: #f6ad55;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    flex-shrink: 0;
}

.top5-fomo-warn {
    font-size: 8px;
    font-weight: 700;
    padding: 1px 4px;
    border-radius: 3px;
    background: rgba(242, 54, 69, 0.15);
    color: #f23645;
    letter-spacing: 0.03em;
    flex-shrink: 0;
}

.top5-type {
    font-size: 10px;
    color: var(--text-muted);
    white-space: normal;
    line-height: 1.35;
}

.top5-age {
    font-size: 9px;
    color: #5a6a7e;
    font-style: italic;
    margin-left: 3px;
}

/* ── BTC-Relativity badges ─────────────────────────────────────────────────── */
.btc-sync-badge {
    display: inline-block;
    font-size: 8px;
    font-weight: 700;
    padding: 1px 4px;
    border-radius: 3px;
    margin-left: 3px;
    vertical-align: middle;
    letter-spacing: 0.3px;
}
.btc-sync-badge.syncing  { background: rgba(100,149,237,0.18); color: #6495ed; border: 1px solid rgba(100,149,237,0.35); }
.btc-sync-badge.decoupled{ background: rgba(16,185,129,0.18);  color: #10b981; border: 1px solid rgba(16,185,129,0.35); }

.mcap-rank-badge {
    display: inline-block;
    font-size: 8px;
    font-weight: 800;
    color: #f59e0b;
    background: rgba(245,158,11,0.12);
    border: 1px solid rgba(245,158,11,0.3);
    border-radius: 3px;
    padding: 1px 4px;
    margin-right: 3px;
    vertical-align: middle;
}

/* Signal details BTC sync badge */
.sd-btc-sync {
    display: inline-flex;
    align-items: center;
    font-size: 9px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 4px;
    letter-spacing: 0.3px;
    cursor: default;
}
.sd-btc-sync.btc-syncing   { background: rgba(100,149,237,0.15); color: #6495ed; border: 1px solid rgba(100,149,237,0.3); }
.sd-btc-sync.btc-decoupled { background: rgba(16,185,129,0.15);  color: #10b981; border: 1px solid rgba(16,185,129,0.3); }
.sd-btc-sync.btc-correlated{ background: rgba(148,163,184,0.12); color: #94a3b8; border: 1px solid rgba(148,163,184,0.25); }

/* Manipulation pump warning */
.sd-manip-pump {
    display: inline-flex;
    align-items: center;
    font-size: 9px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 4px;
    background: rgba(239,68,68,0.15);
    color: #ef4444;
    border: 1px solid rgba(239,68,68,0.3);
    letter-spacing: 0.3px;
    cursor: default;
}

.top5-metrics {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    flex-shrink: 0;
}

.top5-score {
    font-size: 13px;
    font-weight: 800;
    line-height: 1;
}

.top5-score.score-high   { color: #26a69a; }
.top5-score.score-medium { color: #63b3ed; }
.top5-score.score-low    { color: #f6ad55; }

.top5-rr {
    font-size: 9px;
    color: var(--text-muted);
    white-space: nowrap;
}

/* Signal Selector & Details */
.signals-selector-container {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.signal-master-dropdown {
    width: 100%;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 10px 30px 10px 12px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    outline: none;
    transition: all 0.2s ease;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b949e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
}

.signal-master-dropdown:focus {
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.signal-master-dropdown option {
    background: #161b22;
    color: #c9d1d9;
    padding: 10px;
}

/* Custom Searchable Signal Dropdown */
.signal-custom-dropdown {
    position: relative;
    width: 100%;
}

.signal-custom-trigger {
    width: 100%;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    transition: all 0.2s ease;
    user-select: none;
    box-sizing: border-box;
}

.signal-custom-dropdown.disabled .signal-custom-trigger {
    cursor: not-allowed;
    opacity: 0.5;
}

.signal-custom-dropdown:not(.disabled) .signal-custom-trigger:hover,
.signal-custom-dropdown.open .signal-custom-trigger {
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.signal-custom-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

.signal-custom-arrow {
    flex-shrink: 0;
    color: var(--text-muted);
    font-size: 11px;
    transition: transform 0.2s;
}

.signal-custom-dropdown.open .signal-custom-arrow {
    transform: rotate(180deg);
}

.signal-custom-panel {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #161b22;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: none;
    flex-direction: column;
    max-height: 280px;
    overflow: hidden;
}

.signal-custom-dropdown.open .signal-custom-panel {
    display: flex;
}

.signal-custom-search {
    background: rgba(255, 255, 255, 0.05);
    border: none;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 8px 12px;
    font-size: 12px;
    outline: none;
    flex-shrink: 0;
}

.signal-custom-search::placeholder {
    color: var(--text-muted);
}

.signal-custom-list {
    overflow-y: auto;
    flex: 1;
    scrollbar-width: thin;
}

.signal-custom-item {
    padding: 9px 12px;
    font-size: 12px;
    color: var(--text-main);
    cursor: pointer;
    transition: background 0.1s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.signal-custom-item:hover {
    background: rgba(255, 255, 255, 0.07);
}

.signal-custom-item.selected {
    background: rgba(52, 152, 219, 0.15);
    color: #63b3ed;
}

.signal-custom-item.placeholder {
    color: var(--text-muted);
    font-style: italic;
    cursor: default;
}

.signal-custom-item.placeholder:hover {
    background: transparent;
}

.signal-details-display {
    padding: 14px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: opacity 0.3s ease;
    /* Hide scrollbar visually while keeping scroll functional */
    scrollbar-width: none;
}

.signal-details-display::-webkit-scrollbar {
    display: none;
}

.signal-details-display.disabled {
    opacity: 0.3;
    pointer-events: none;
    filter: grayscale(1);
}

.signal-details-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sd-asset {
    font-size: 20px;
    font-weight: 700;
}

.sd-type {
    font-size: 13px;
    padding: 4px 10px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.1);
    font-weight: 600;
}

.sd-badge-new {
    background: #f23645;
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 4px;
    margin-right: 8px;
    letter-spacing: 0.5px;
    animation: flashBadge 1.5s infinite;
}

@keyframes flashBadge {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.05); }
    100% { opacity: 1; transform: scale(1); }
}

.sd-type.buy {
    background: rgba(8, 153, 129, 0.2);
    color: var(--buy-color);
    border: 1px solid rgba(8, 153, 129, 0.5);
}

.sd-type.sell {
    background: rgba(242, 54, 69, 0.2);
    color: var(--sell-color);
    border: 1px solid rgba(242, 54, 69, 0.5);
}

.sd-badge-new {
    font-size: 10px;
    font-weight: 800;
    color: #fff;
    background: #f23645; /* Red */
    padding: 2px 6px;
    border-radius: 4px;
    margin-right: 8px;
    letter-spacing: 0.5px;
    animation: flashPulse 1s infinite;
    display: inline-block;
    vertical-align: middle;
}

@keyframes flashPulse {
    0% { transform: scale(1); opacity: 1; box-shadow: 0 0 0 0 rgba(242, 54, 69, 0.7); }
    50% { transform: scale(1.1); opacity: 0.8; box-shadow: 0 0 0 6px rgba(242, 54, 69, 0); }
    100% { transform: scale(1); opacity: 1; box-shadow: 0 0 0 0 rgba(242, 54, 69, 0); }
}

.sd-badge-new.hidden {
    display: none;
}

.sd-macro-risk {
    font-size: 10px;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 4px;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.sd-macro-risk.hidden { display: none; }

.sd-macro-risk.macro-high {
    background: rgba(242, 54, 69, 0.18);
    color: #f23645;
    border: 1px solid rgba(242, 54, 69, 0.5);
    animation: flashPulse 2s infinite;
}

.sd-macro-risk.macro-medium {
    background: rgba(255, 165, 0, 0.15);
    color: #ffa500;
    border: 1px solid rgba(255, 165, 0, 0.45);
}

/* EMA trend filter badge (Chapter 5) */
.sd-ema-trend {
    font-size: 10px;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 4px;
    letter-spacing: 0.5px;
    white-space: nowrap;
}
.sd-ema-trend.hidden { display: none; }
.sd-ema-trend.ema-bearish {
    background: rgba(242, 54, 69, 0.13);
    color: #f23645;
    border: 1px solid rgba(242, 54, 69, 0.4);
}
.sd-ema-trend.ema-bullish-warn {
    background: rgba(8, 153, 129, 0.13);
    color: #089981;
    border: 1px solid rgba(8, 153, 129, 0.4);
}
.sd-ema-trend.ema-confirmed {
    background: rgba(8, 153, 129, 0.18);
    color: #089981;
    border: 1px solid rgba(8, 153, 129, 0.5);
}

/* Falling knife warning badge */
.sd-falling-knife {
    font-size: 10px;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 4px;
    letter-spacing: 0.5px;
    background: rgba(128, 0, 255, 0.18);
    color: #a855f7;
    border: 1px solid rgba(168, 85, 247, 0.55);
    animation: knife-pulse 1.8s ease-in-out infinite;
}
.sd-falling-knife.hidden { display: none; }
@keyframes knife-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.55; }
}

/* Token Unlock warning badge */
.sd-token-unlock {
    font-size: 10px;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 4px;
    letter-spacing: 0.04em;
    white-space: nowrap;
    background: rgba(249, 115, 22, 0.18);
    color: #f97316;
    border: 1px solid rgba(249, 115, 22, 0.55);
    cursor: help;
    animation: unlock-pulse 2s ease-in-out infinite;
}
.sd-token-unlock.hidden { display: none; }
@keyframes unlock-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Persistent Fear & Greed pill in header */
.fg-indicator {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 4px;
    white-space: nowrap;
    letter-spacing: 0.03em;
}
.fg-indicator.hidden { display: none; }
.fg-indicator.fg-extreme-greed {
    background: rgba(242, 54, 69, 0.18);
    color: #f23645;
    border: 1px solid rgba(242, 54, 69, 0.5);
    animation: flashPulse 2s infinite;
}
.fg-indicator.fg-greed {
    background: rgba(255, 165, 0, 0.15);
    color: #ffa500;
    border: 1px solid rgba(255, 165, 0, 0.45);
}
.fg-indicator.fg-neutral {
    background: rgba(139, 148, 158, 0.12);
    color: #8b949e;
    border: 1px solid rgba(139, 148, 158, 0.3);
}
.fg-indicator.fg-fear {
    background: rgba(33, 186, 114, 0.12);
    color: #21ba72;
    border: 1px solid rgba(33, 186, 114, 0.35);
}

/* Fear & Greed macro filter badge */
.sd-fear-greed {
    font-size: 10px;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 4px;
    letter-spacing: 0.04em;
    white-space: nowrap;
}
.sd-fear-greed.hidden { display: none; }
.sd-fear-greed.fg-extreme-greed {
    background: rgba(242, 54, 69, 0.18);
    color: #f23645;
    border: 1px solid rgba(242, 54, 69, 0.5);
    animation: flashPulse 2s infinite;
}
.sd-fear-greed.fg-greed {
    background: rgba(255, 165, 0, 0.15);
    color: #ffa500;
    border: 1px solid rgba(255, 165, 0, 0.45);
}

/* Extreme risk % highlight */
.sd-risk-extreme {
    color: #f23645 !important;
    font-weight: 800;
}

.signal-details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.sd-item {
    background: rgba(0, 0, 0, 0.2);
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sd-label {
    font-size: 12px;
    color: var(--text-muted);
}

.sd-value {
    font-size: 15px;
    font-weight: 600;
    font-family: monospace;
}

.signal-details-footer {
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sd-time {
    font-size: 12px;
    color: var(--text-muted);
}

.btn-view-chart {
    background: var(--buy-color);
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-view-chart:hover {
    filter: brightness(1.2);
}

/* Tooltip & Icon Styles (retained from old card logic) */
.info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    color: var(--text-main);
    font-size: 11px;
    font-weight: bold;
    cursor: help;
    margin-left: 6px;
    position: relative;
}

.info-icon:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    top: 100%; /* Show below instead of above */
    left: 50%;
    transform: translateX(-50%);
    margin-top: 8px; /* Add some spacing */
    background: rgba(0, 0, 0, 0.95);
    color: #fff;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: normal;
    white-space: pre-wrap;
    width: 250px;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    border: 1px solid var(--border-color);
    letter-spacing: normal;
    text-align: left;
}

/* ── Leverage Recommendation Badge ─────────────────────────────────────── */
.sd-leverage-item {
    grid-column: 1 / -1; /* Full width row */
}

.leverage-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.5px;
    font-family: monospace;
}

/* 1x–2x: Caution yellow */
.leverage-badge-low {
    background: rgba(227, 179, 65, 0.15);
    color: #e3b341;
    border: 1px solid rgba(227, 179, 65, 0.4);
    box-shadow: 0 0 8px rgba(227, 179, 65, 0.2);
}

/* 3x–5x: Neutral blue */
.leverage-badge-mid {
    background: rgba(52, 152, 219, 0.15);
    color: #58a6ff;
    border: 1px solid rgba(52, 152, 219, 0.4);
    box-shadow: 0 0 8px rgba(52, 152, 219, 0.2);
}

/* 7x–10x: Strong green */
.leverage-badge-high {
    background: rgba(8, 153, 129, 0.15);
    color: var(--buy-color);
    border: 1px solid rgba(8, 153, 129, 0.4);
    box-shadow: 0 0 8px rgba(8, 153, 129, 0.2);
}

.leverage-atr {
    font-size: 11px;
    color: var(--text-muted);
    font-family: monospace;
    margin-left: 6px;
}

/* ── Confluence badge ─────────────────────────────────────────────────────── */
.sd-badge-confluence {
    background: linear-gradient(135deg, #f7a600, #e8c055);
    color: #000;
    font-size: 9px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 3px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    white-space: nowrap;
}
.sd-badge-confluence.hidden { display: none; }

/* ── Full-width grid item (patterns row) ─────────────────────────────────── */
.sd-full-width {
    grid-column: 1 / -1;
}

/* ── Pattern tag chips ───────────────────────────────────────────────────── */
.sd-patterns-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
}

.pattern-tag {
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 3px;
    padding: 2px 7px;
    font-size: 10px;
    color: var(--text-secondary, #c9d1d9);
    white-space: nowrap;
}

/* ── Signal Analysis Panel (inside scrollable area, at bottom) ─────────────── */
.sd-analysis-panel {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 12px;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    background: rgba(0,0,0,0.18);
}

.sd-analysis-panel.disabled {
    opacity: 0.4;
    pointer-events: none;
}

.sd-analysis-top-row {
    display: grid;
    grid-template-columns: 1fr 1.7fr;
    gap: 8px;
}

.sd-analysis-cell {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: rgba(0,0,0,0.25);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 10px;
}

.sd-analysis-conf-cell { gap: 6px; }

.sd-label-sm {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sd-conf-inline {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
}

/* Static header (non-clickable) for Why This Signal Fired */
.sd-logic-static-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    background: rgba(0,0,0,0.2);
    cursor: default;
}

.sd-logic-title-text {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-main);
}

/* ── Panel width increase ──────────────────────────────────────────────────── */
.signals-panel {
    width: 420px;
    min-width: 420px;
}
.signals-panel.hidden {
    margin-right: -420px;
}

/* ── Shared section title ─────────────────────────────────────────────────── */
.sd-section-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.sd-lev-hint {
    font-size: 10px;
    font-weight: 400;
    color: var(--text-muted);
    text-transform: none;
    letter-spacing: 0;
    opacity: 0.8;
}

/* ── Action value colouring ───────────────────────────────────────────────── */
.sd-val-buy  { color: var(--buy-color)  !important; }
.sd-val-sell { color: var(--sell-color) !important; }

/* ── Confidence Meter ─────────────────────────────────────────────────────── */
.sd-confidence-section {
    background: rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sd-confidence-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sd-confidence-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sd-confidence-pct {
    font-size: 15px;
    font-weight: 700;
    font-family: monospace;
    color: var(--text-main);
}

.sd-confidence-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
    letter-spacing: 0.5px;
}
.sd-confidence-badge.badge-high { background: rgba(8,153,129,0.2); color: var(--buy-color); border: 1px solid rgba(8,153,129,0.4); }
.sd-confidence-badge.badge-mid  { background: rgba(52,152,219,0.2); color: #58a6ff;        border: 1px solid rgba(52,152,219,0.4); }
.sd-confidence-badge.badge-low  { background: rgba(227,179,65,0.2); color: #e3b341;        border: 1px solid rgba(227,179,65,0.4); }

.sd-confidence-bar-track {
    width: 100%;
    height: 6px;
    background: rgba(255,255,255,0.08);
    border-radius: 3px;
    overflow: hidden;
}

.sd-confidence-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease, background 0.3s ease;
}
.sd-confidence-bar-fill.confidence-high { background: linear-gradient(90deg, #089981, #0bd9b3); }
.sd-confidence-bar-fill.confidence-mid  { background: linear-gradient(90deg, #3498db, #58a6ff); }
.sd-confidence-bar-fill.confidence-low  { background: linear-gradient(90deg, #e3b341, #f0cc70); }

.sd-confidence-factors {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.conf-factor-chip {
    background: rgba(255,255,255,0.10);
    border: 1px solid rgba(255,255,255,0.22);
    border-radius: 4px;
    padding: 2px 7px;
    font-size: 10px;
    color: var(--text-main);
    font-family: monospace;
    font-weight: 500;
}

/* ── ADX value styles ─────────────────────────────────────────────────────── */
.adx-strong   { color: var(--buy-color); font-weight: 700; font-family: monospace; }
.adx-moderate { color: #58a6ff;          font-weight: 600; font-family: monospace; }
.adx-weak     { color: var(--text-muted);font-weight: 500; font-family: monospace; }
.adx-label    { font-size: 10px; color: var(--text-muted); font-family: inherit; font-style: italic; }

/* ── BTC Correlation & Beta grid value styles ─────────────────────────────── */
.sd-btc-corr-high  { color: #6495ed; font-weight: 700; font-family: monospace; } /* high corr  — blue  */
.sd-btc-corr-mid   { color: #94a3b8; font-weight: 600; font-family: monospace; } /* moderate   — grey  */
.sd-btc-corr-low   { color: #10b981; font-weight: 700; font-family: monospace; } /* decoupled  — green */
.sd-beta-high      { color: #f59e0b; font-weight: 700; font-family: monospace; } /* β > 2 — amber warning */
.sd-beta-mid       { color: #94a3b8; font-weight: 600; font-family: monospace; }
.sd-beta-low       { color: var(--text-muted); font-weight: 500; font-family: monospace; }
.sd-btc-corr-label { font-size: 10px; color: var(--text-muted); font-family: inherit; font-style: italic; }

/* ── Volume Profile Heatmap ───────────────────────────────────────────────── */
.volume-profile-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.volume-profile-wrapper {
    display: flex;
    flex-direction: column-reverse; /* lowest price at bottom, highest at top */
    gap: 1px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    padding: 10px 12px;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    min-height: 80px;
    overflow: hidden;
    position: relative;
}

.vp-bar {
    position: relative;
    height: 5px;
    width: 100%;
    display: flex;
    align-items: center;
    border-radius: 2px;
    overflow: visible;
    flex-shrink: 0;
}

.vp-bar-fill {
    height: 100%;
    border-radius: 2px;
    background: rgba(41, 98, 255, 0.30);
    transition: width 0.35s ease;
    min-width: 2px;
}

/* Point of Control — glowing gold bar */
.vp-bar-poc .vp-bar-fill {
    background: rgba(255, 204, 0, 0.80);
    box-shadow: 0 0 6px rgba(255, 204, 0, 0.50), 0 0 14px rgba(255, 204, 0, 0.20);
}

.vp-poc-label {
    position: absolute;
    right: 0;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: rgba(255, 204, 0, 0.90);
    text-transform: uppercase;
    line-height: 1;
    pointer-events: none;
    white-space: nowrap;
}

/* Current price marker */
.vp-price-marker {
    position: absolute;
    left: calc(var(--vp-fill-w, 0%) + 2px);
    font-size: 7px;
    color: #00e5ff;
    text-shadow: 0 0 6px rgba(0, 229, 255, 0.8);
    pointer-events: none;
    line-height: 1;
    transform: translateY(-50%);
    top: 50%;
}

/* Metrics refresh buttons */
.metrics-refresh-btn {
    font-size: 11px; background: none; border: none; color: #64748b;
    cursor: pointer; padding: 0 3px; line-height: 1; border-radius: 3px;
    vertical-align: middle; transition: color 0.15s, transform 0.15s;
}
.metrics-refresh-btn:hover  { color: #38bdf8; transform: rotate(30deg); }
.metrics-refresh-btn:active { transform: rotate(180deg); }
.metrics-refresh-btn:disabled { opacity: 0.35; cursor: not-allowed; transform: none; }

/* Loading text used by fetchExtraMetrics */
.metrics-loading {
    color: var(--text-muted);
    font-style: italic;
    font-size: 11px;
    animation: metrics-pulse 1s ease-in-out infinite;
}
@keyframes metrics-pulse {
    0%, 100% { opacity: 0.5; }
    50%       { opacity: 1;   }
}

/* "unavailable" fallback */
.vp-unavailable {
    font-size: 11px;
    color: var(--text-muted);
    font-style: italic;
    padding: 6px 0;
    text-align: center;
    width: 100%;
    display: block;
}

/* ── Profit Targets Section ───────────────────────────────────────────────── */
.sd-targets-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sd-targets-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sd-target-row {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 7px;
    padding: 8px 12px;
    transition: background 0.2s;
}

.sd-target-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    width: 30px;
    flex-shrink: 0;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.sd-target-price {
    flex: 1;
    font-size: 13px;
    font-weight: 600;
    font-family: monospace;
    color: var(--text-main);
}

.sd-target-pct {
    font-size: 13px;
    font-weight: 700;
    font-family: monospace;
    min-width: 58px;
    text-align: right;
}

.sd-target-pct.pct-positive { color: var(--buy-color); }
.sd-target-pct.pct-negative { color: var(--sell-color); }

/* ── Time Estimate Row ────────────────────────────────────────────────────── */
.sd-time-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(0,0,0,0.15);
    border: 1px solid var(--border-color);
    border-radius: 7px;
}

.sd-time-label {
    font-size: 11px;
    color: var(--text-muted);
}

.sd-time-val {
    font-size: 13px;
    font-weight: 600;
    font-family: monospace;
    color: var(--text-main);
}

/* ── Leverage Buttons ─────────────────────────────────────────────────────── */
.sd-leverage-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sd-leverage-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.lev-btn {
    position: relative;
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.12);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    font-family: monospace;
    padding: 5px 9px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.lev-btn:hover {
    border-color: rgba(255,255,255,0.3);
    color: var(--text-main);
}

/* Tier colours (unselected) */
.lev-btn.lev-tier-low  { border-color: rgba(227,179,65,0.25); color: rgba(227,179,65,0.7); }
.lev-btn.lev-tier-mid  { border-color: rgba(52,152,219,0.25); color: rgba(88,166,255,0.7); }
.lev-btn.lev-tier-high { border-color: rgba(242,54,69,0.25);  color: rgba(242,54,69,0.7);  }

/* Recommended (not selected): soft glow ring */
.lev-btn.lev-recommended.lev-tier-low  { border-color: rgba(227,179,65,0.6); box-shadow: 0 0 6px rgba(227,179,65,0.2); color: #e3b341; }
.lev-btn.lev-recommended.lev-tier-mid  { border-color: rgba(52,152,219,0.6); box-shadow: 0 0 6px rgba(52,152,219,0.2); color: #58a6ff; }
.lev-btn.lev-recommended.lev-tier-high { border-color: rgba(8,153,129,0.6);  box-shadow: 0 0 6px rgba(8,153,129,0.2); color: var(--buy-color); }

/* Selected: filled solid */
.lev-btn.lev-selected.lev-tier-low  { background: rgba(227,179,65,0.2); border-color: #e3b341; color: #e3b341; box-shadow: 0 0 10px rgba(227,179,65,0.3); }
.lev-btn.lev-selected.lev-tier-mid  { background: rgba(52,152,219,0.2); border-color: #58a6ff; color: #58a6ff; box-shadow: 0 0 10px rgba(52,152,219,0.3); }
.lev-btn.lev-selected.lev-tier-high { background: rgba(8,153,129,0.2);  border-color: var(--buy-color); color: var(--buy-color); box-shadow: 0 0 10px rgba(8,153,129,0.3); }

/* Dot indicator for recommended */
.lev-rec-dot {
    display: inline-block;
    width: 4px;
    height: 4px;
    background: currentColor;
    border-radius: 50%;
    margin-left: 3px;
    vertical-align: middle;
    opacity: 0.8;
}

/* ── Logic Explanation Section ────────────────────────────────────────────── */
.sd-logic-section {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
}

.sd-logic-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0,0,0,0.2);
    border: none;
    color: var(--text-main);
    font-size: 12px;
    font-weight: 600;
    padding: 10px 14px;
    cursor: pointer;
    text-align: left;
    transition: background 0.2s;
}
.sd-logic-toggle:hover { background: rgba(255,255,255,0.05); }

/* Static (non-clickable) version used inside sd-analysis-panel */
.sd-logic-static-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: rgba(0,0,0,0.2);
    cursor: default;
}
.sd-logic-title-text {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-main);
}

.sd-logic-arrow {
    font-size: 10px;
    color: var(--text-muted);
    transition: transform 0.2s;
    flex-shrink: 0;
}

.sd-logic-pattern-chip {
    margin-left: auto;
    font-size: 10px;
    font-weight: 500;
    color: var(--text-muted);
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 4px;
    padding: 2px 7px;
    white-space: nowrap;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sd-logic-body {
    display: none;
    padding: 10px 12px;
    border-top: 1px solid var(--border-color);
    background: rgba(0,0,0,0.1);
    flex-direction: column;
    gap: 8px;
}

.sd-logic-body.open {
    display: flex;
}

.sd-logic-source {
    font-size: 10px;
    font-weight: 600;
    color: #58a6ff;
    letter-spacing: 0.3px;
}

.sd-logic-text {
    font-size: 11px;
    color: var(--text-main);
    line-height: 1.5;
    opacity: 0.9;
}

.sd-logic-rules {
    display: flex;
    flex-direction: column;
    gap: 5px;
    background: rgba(255,255,255,0.03);
    border-radius: 7px;
    padding: 8px 10px;
    border: 1px solid rgba(255,255,255,0.06);
}

.sd-rule-row {
    display: flex;
    gap: 8px;
    font-size: 11px;
    line-height: 1.4;
}

.sd-rule-label {
    font-weight: 700;
    color: var(--text-muted);
    flex-shrink: 0;
    width: 44px;
}

.sd-rule-val {
    color: var(--text-main);
    opacity: 0.85;
}

.sd-patterns-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    align-items: center;
}

/* ── MTF Breakdown Panel ──────────────────────────────────────────────────── */
.sd-mtf-breakdown {
    margin-top: 10px;
    background: rgba(123,47,247,0.08);
    border: 1px solid rgba(123,47,247,0.3);
    border-radius: 8px;
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.mtf-breakdown-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
}
.mtf-tf-label {
    width: 72px;
    font-weight: 600;
    color: #a78bfa;
    flex-shrink: 0;
}
.mtf-tf-value {
    color: #e2e8f0;
}

/* ── AI Analyse Button ────────────────────────────────────────────────────── */
.btn-ai-analyse {
    background: linear-gradient(135deg, rgba(88,166,255,0.15), rgba(139,92,246,0.15));
    border: 1px solid rgba(88,166,255,0.4);
    color: #58a6ff;
    padding: 7px 13px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}
.btn-ai-analyse:hover {
    background: linear-gradient(135deg, rgba(88,166,255,0.25), rgba(139,92,246,0.25));
    border-color: rgba(88,166,255,0.7);
    box-shadow: 0 0 12px rgba(88,166,255,0.2);
}
.btn-ai-analyse:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ── AI Analysis Modal ────────────────────────────────────────────────────── */
.ai-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.ai-modal-overlay.hidden { display: none; }

.ai-modal {
    background: #0d1117;
    border: 1px solid rgba(88,166,255,0.25);
    border-radius: 14px;
    width: 100%;
    max-width: 640px;
    max-height: 88vh;
    overflow-y: auto;
    box-shadow: 0 24px 64px rgba(0,0,0,0.7), 0 0 0 1px rgba(88,166,255,0.1);
    display: flex;
    flex-direction: column;
}

.ai-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 18px 20px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
    gap: 12px;
}
.ai-modal-title-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}
.ai-modal-icon { font-size: 22px; flex-shrink: 0; }
.ai-modal-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ai-modal-subtitle {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}
.ai-modal-close {
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.12);
    color: var(--text-muted);
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s;
}
.ai-modal-close:hover { background: rgba(255,255,255,0.12); color: var(--text-main); }

/* Conviction badge */
.ai-conviction-badge {
    font-size: 9px;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 4px;
    letter-spacing: 0.6px;
    white-space: nowrap;
    flex-shrink: 0;
}
.conv-low       { background: rgba(227,179,65,0.15); color: #e3b341; border: 1px solid rgba(227,179,65,0.3); }
.conv-mid       { background: rgba(52,152,219,0.15); color: #58a6ff; border: 1px solid rgba(52,152,219,0.3); }
.conv-high      { background: rgba(8,153,129,0.15);  color: #089981; border: 1px solid rgba(8,153,129,0.3); }
.conv-very-high { background: rgba(139,92,246,0.2);  color: #a78bfa; border: 1px solid rgba(139,92,246,0.4); }

/* Loading */
.ai-modal-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    gap: 14px;
    color: var(--text-muted);
    font-size: 13px;
}
.ai-modal-loading.hidden { display: none; }
.ai-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(88,166,255,0.15);
    border-top-color: #58a6ff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
.ai-loading-sub { font-size: 11px; color: var(--text-muted); opacity: 0.7; text-align: center; }

/* Error */
.ai-modal-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 40px 24px;
    color: #f23645;
    font-size: 13px;
    text-align: center;
}
.ai-modal-error.hidden { display: none; }
.ai-modal-error span { font-size: 28px; }

/* Results */
.ai-modal-results { display: flex; flex-direction: column; gap: 0; }
.ai-modal-results.hidden { display: none; }

.ai-section {
    padding: 14px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.ai-section-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.7px;
    margin-bottom: 7px;
}
.ai-section-text {
    font-size: 13px;
    color: var(--text-main);
    line-height: 1.6;
    margin: 0;
}

/* Predictions grid */
.ai-predictions-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}
.ai-pred-card {
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 8px;
    padding: 10px 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.ai-pred-horizon { font-size: 10px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.ai-pred-dir     { font-size: 13px; font-weight: 700; font-family: monospace; }
.ai-pred-dir.pred-up   { color: var(--buy-color); }
.ai-pred-dir.pred-down { color: var(--sell-color); }
.ai-pred-dir.pred-side { color: #e3b341; }
.ai-pred-range   { font-size: 11px; color: var(--text-main); font-family: monospace; font-weight: 500; }
.ai-pred-conf    { font-size: 9px; font-weight: 700; letter-spacing: 0.5px; }
.ai-pred-note    { font-size: 10px; color: var(--text-muted); line-height: 1.4; margin-top: 2px; }

/* Key levels */
.ai-levels-row { display: grid; grid-template-columns: 1fr 1fr; }
.ai-levels-col { border-right: 1px solid rgba(255,255,255,0.05); }
.ai-levels-col:last-child { border-right: none; }
.ai-levels-list { display: flex; flex-wrap: wrap; gap: 5px; }
.ai-level-chip {
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 4px;
    padding: 3px 9px;
    font-size: 11px;
    font-family: monospace;
    font-weight: 600;
    color: var(--text-main);
}

/* Recommendation / Risk */
.ai-rec-section  { background: rgba(8,153,129,0.04); }
.ai-risk-section { background: rgba(242,54,69,0.04); border-bottom: none; }
.ai-rec-text     { color: #0bd9b3 !important; }
.ai-risk-text    { color: #f78080 !important; }

.ai-footer-note {
    padding: 10px 20px;
    font-size: 10px;
    color: var(--text-muted);
    opacity: 0.5;
    text-align: center;
    border-top: 1px solid rgba(255,255,255,0.04);
}

/* ── Key Stats Panel ──────────────────────────────────────────────────────── */
.sd-keystats-section {
    padding: 8px 10px 10px;
    border-top: 1px solid rgba(255,255,255,0.06);
}
.sd-keystats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px 8px;
    margin-top: 6px;
}
.ks-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.ks-label {
    font-size: 9px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.ks-value {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ks-sector  { color: rgba(88,166,255,0.9); }
.ks-high    { color: #089981; }
.ks-low     { color: #f23645; }
.ks-strong  { color: #089981; }
.ks-weak    { color: #f23645; }
.ks-large-cap { color: rgba(88,166,255,0.85); }
.ks-micro-cap { color: #f23645; font-size: 10px; }

/* ── AI Pattern Chart ─────────────────────────────────────────────────────── */
.ai-chart-section {
    border-bottom: 1px solid rgba(255,255,255,0.06);
    background: #080c10;
}
.ai-chart-wrapper {
    position: relative;
    width: 100%;
    height: 290px;
    overflow: hidden;
}
.ai-chart-canvas {
    display: block;
    width: 100%;
    height: 290px;
}
.ai-chart-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 12px;
    background: #080c10;
}
.ai-chart-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(88,166,255,0.2);
    border-top-color: rgba(88,166,255,0.8);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════════════════
   Symbol Search Button (in header overlay)
════════════════════════════════════════════════════════════════════ */
.symbol-search-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-main);
    padding: 5px 10px;
    cursor: pointer;
    font-size: 13px;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    transition: background 0.2s, border-color 0.2s;
    letter-spacing: 0.3px;
    min-width: 120px;
}
.symbol-search-btn:hover {
    background: rgba(255,255,255,0.12);
    border-color: rgba(88,166,255,0.5);
}
.symbol-search-btn svg {
    flex-shrink: 0;
    opacity: 0.7;
}
.symbol-search-exchange-badge {
    font-size: 9px;
    font-weight: 700;
    color: var(--text-muted);
    background: rgba(255,255,255,0.08);
    padding: 1px 5px;
    border-radius: 3px;
    letter-spacing: 0.5px;
    margin-left: auto;
}

/* ══════════════════════════════════════════════════════════════════
   Symbol Search Modal
════════════════════════════════════════════════════════════════════ */
.symbol-search-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 9000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 80px;
    animation: ssm-fade-in 0.15s ease;
}
/* When modal is in free-float (dragged) mode, overlay becomes transparent pass-through */
.symbol-search-overlay.ssm-floating {
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    pointer-events: none;  /* clicks fall through to chart etc. */
    padding-top: 0;
    align-items: unset;
    justify-content: unset;
}
.symbol-search-overlay.ssm-floating .symbol-search-modal {
    pointer-events: all;   /* modal itself still catches events */
    position: absolute;
}
.symbol-search-overlay.hidden { display: none !important; }

@keyframes ssm-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.symbol-search-modal {
    background: #1a1f2e;
    border: 1px solid rgba(88,166,255,0.18);
    border-radius: 12px;
    width: 720px;
    max-width: calc(100vw - 40px);
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 80px rgba(0,0,0,0.7), 0 0 0 1px rgba(255,255,255,0.05);
    animation: ssm-slide-in 0.18s cubic-bezier(0.34, 1.26, 0.64, 1);
    overflow: hidden;
}
@keyframes ssm-slide-in {
    from { transform: translateY(-18px) scale(0.97); opacity: 0; }
    to   { transform: translateY(0) scale(1); opacity: 1; }
}

/* Header */
.ssm-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    flex-shrink: 0;
    cursor: grab;
    user-select: none;
}
.ssm-header:active { cursor: grabbing; }
.ssm-drag-grip {
    font-size: 16px;
    color: #4b5563;
    margin-right: 8px;
    line-height: 1;
    flex-shrink: 0;
    cursor: grab;
}
.ssm-title {
    font-size: 15px;
    font-weight: 600;
    color: #c9d1d9;
    letter-spacing: 0.2px;
}
.ssm-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s, background 0.15s;
}
.ssm-close:hover {
    color: var(--text-main);
    background: rgba(255,255,255,0.08);
}

/* Search Bar */
.ssm-search-bar {
    position: relative;
    display: flex;
    align-items: center;
    margin: 12px 16px;
    border: 1px solid rgba(88,166,255,0.3);
    border-radius: 8px;
    background: rgba(0,0,0,0.35);
    flex-shrink: 0;
    transition: border-color 0.2s;
}
.ssm-search-bar:focus-within {
    border-color: rgba(88,166,255,0.7);
    box-shadow: 0 0 0 2px rgba(88,166,255,0.12);
}
.ssm-search-icon {
    position: absolute;
    left: 12px;
    color: var(--text-muted);
    pointer-events: none;
    flex-shrink: 0;
}
.ssm-search-input {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-main);
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    padding: 11px 40px 11px 40px;
    caret-color: #58a6ff;
}
.ssm-search-input::placeholder { color: var(--text-muted); }
.ssm-search-clear {
    position: absolute;
    right: 8px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s, background 0.15s;
}
.ssm-search-clear:hover { color: var(--text-main); background: rgba(255,255,255,0.08); }
.ssm-search-clear.hidden { display: none; }

/* Category Tabs */
.ssm-tabs {
    display: flex;
    gap: 2px;
    padding: 0 16px 12px;
    overflow-x: auto;
    scrollbar-width: none;
    flex-shrink: 0;
}
.ssm-tabs::-webkit-scrollbar { display: none; }
.ssm-tab {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
}
.ssm-tab:hover { background: rgba(255,255,255,0.07); color: var(--text-main); }
.ssm-tab.active {
    background: rgba(88,166,255,0.18);
    color: #58a6ff;
    font-weight: 600;
}

/* Results Container */
.ssm-results-container {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    border-top: 1px solid rgba(255,255,255,0.06);
}
.ssm-results-container::-webkit-scrollbar { width: 6px; }
.ssm-results-container::-webkit-scrollbar-track { background: transparent; }
.ssm-results-container::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 3px; }

.ssm-results-list { display: flex; flex-direction: column; }

/* Result Row */
.ssm-result-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    cursor: pointer;
    transition: background 0.12s;
    border-bottom: 1px solid rgba(255,255,255,0.03);
}
.ssm-result-row:hover { background: rgba(88,166,255,0.07); }
.ssm-result-row:last-child { border-bottom: none; }

/* Symbol Icon Circle */
.ssm-symbol-icon {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: -0.5px;
    flex-shrink: 0;
    text-transform: uppercase;
}
.ssm-icon-crypto  { background: rgba(247,147,26,0.2); color: #f7931a; border: 1px solid rgba(247,147,26,0.35); }
.ssm-icon-stock   { background: rgba(88,166,255,0.18); color: #58a6ff; border: 1px solid rgba(88,166,255,0.35); }
.ssm-icon-forex   { background: rgba(8,153,129,0.2);  color: #089981; border: 1px solid rgba(8,153,129,0.35); }
.ssm-icon-index   { background: rgba(139,92,246,0.2);  color: #9d70ff; border: 1px solid rgba(139,92,246,0.35); }
.ssm-icon-futures { background: rgba(242,54,69,0.18);  color: #f45e6a; border: 1px solid rgba(242,54,69,0.3); }
.ssm-icon-etf     { background: rgba(52,211,153,0.18); color: #34d399; border: 1px solid rgba(52,211,153,0.3); }
.ssm-icon-bond    { background: rgba(227,179,65,0.18); color: #e3b341; border: 1px solid rgba(227,179,65,0.3); }
.ssm-icon-econ    { background: rgba(156,163,175,0.15); color: #9ca3af; border: 1px solid rgba(156,163,175,0.2); }
.ssm-icon-option  { background: rgba(244,114,182,0.18); color: #f472b6; border: 1px solid rgba(244,114,182,0.3); }

.ssm-result-text { flex: 1; min-width: 0; }
.ssm-result-symbol {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    letter-spacing: 0.2px;
}
.ssm-result-desc {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ssm-result-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.ssm-type-badge {
    font-size: 10px;
    color: var(--text-muted);
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    padding: 1px 6px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    font-weight: 500;
}
.ssm-exchange-badge {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    min-width: 52px;
    text-align: right;
    letter-spacing: 0.2px;
}

/* Loading state */
.ssm-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 13px;
}
.ssm-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(88,166,255,0.2);
    border-top-color: #58a6ff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}
.ssm-empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

/* Footer */
.ssm-footer {
    padding: 10px 20px;
    border-top: 1px solid rgba(255,255,255,0.06);
    font-size: 11px;
    color: var(--text-muted);
    opacity: 0.6;
    flex-shrink: 0;
    text-align: center;
}

/* ══ Your Positions Panel ══════════════════════════════════════════════════ */

/* Toggle button — floats above chart near top-left */
.btn-toggle-positions-wrap {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 110;
    display: flex;
    align-items: center;
    gap: 6px;
}

@keyframes arrowBlink {
    0%, 100% { opacity: 1;  transform: translateX(0); }
    50%       { opacity: 0.2; transform: translateX(-5px); }
}

.pos-panel-arrow {
    font-size: 22px;
    color: #39ff14;
    -webkit-text-stroke: 1.5px #000;
    text-shadow: 0 0 6px rgba(57,255,20,0.7);
    animation: arrowBlink 0.55s ease-in-out infinite;
    pointer-events: none;
    user-select: none;
}

.pos-panel-arrow.hidden { display: none; }

.btn-toggle-positions {
    flex-shrink: 0;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    border-radius: 6px;
    padding: 6px 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}
.btn-toggle-positions:hover {
    background: rgba(56,139,253,0.15);
    border-color: #58a6ff;
    color: #58a6ff;
}
.btn-toggle-positions.active {
    background: rgba(56,139,253,0.2);
    border-color: #58a6ff;
    color: #58a6ff;
}

@keyframes introZoomPulse {
    0%   { transform: scale(1);    box-shadow: 0 0 0px rgba(57,255,20,0);         background: rgba(22,27,34,0.85); border-color: var(--border-color); color: var(--text-muted); }
    25%  { transform: scale(1.6);  box-shadow: 0 0 24px 8px rgba(57,255,20,0.9);  background: rgba(57,255,20,0.25); border-color: #39ff14;            color: #39ff14; }
    50%  { transform: scale(0.85); box-shadow: 0 0 10px 3px rgba(57,255,20,0.5);  background: rgba(57,255,20,0.1);  border-color: #39ff14;            color: #39ff14; }
    75%  { transform: scale(1.5);  box-shadow: 0 0 28px 10px rgba(57,255,20,1);   background: rgba(57,255,20,0.3);  border-color: #39ff14;            color: #39ff14; }
    100% { transform: scale(1);    box-shadow: 0 0 0px rgba(57,255,20,0);         background: rgba(22,27,34,0.85); border-color: var(--border-color); color: var(--text-muted); }
}

.btn-toggle-positions.intro-animate {
    animation: introZoomPulse 0.7s ease-in-out 3;
    transition: none;
}

/* Panel container */
.positions-panel {
    width: 480px;
    min-width: 400px;
    height: 100vh;           /* fill full viewport height */
    max-height: 100vh;
    display: flex;
    flex-direction: column;
    background: rgba(13,17,23,0.97);
    border-right: 1px solid var(--border-color);
    overflow: hidden;
    flex-shrink: 0;
    transition: width 0.28s ease, opacity 0.2s ease;
}
.positions-panel.hidden {
    width: 0;
    min-width: 0;
    opacity: 0;
    pointer-events: none;
    border-right: none;
}

/* Panel header */
.pos-panel-header {
    padding: 12px 14px 10px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    background: rgba(22,27,34,0.6);
}
.pos-panel-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.pos-panel-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: 0.03em;
}
.pos-header-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}
.pos-subrow {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 7px;
    gap: 8px;
}
.pos-inr-rate {
    font-size: 10px;
    color: var(--text-muted);
}
.pos-model-select {
    flex: 1;
}

/* Currency toggle switch */
.pos-currency-toggle {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    user-select: none;
}
.pos-currency-label {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 600;
}
.pos-toggle-switch {
    position: relative;
    width: 28px;
    height: 15px;
    flex-shrink: 0;
}
.pos-toggle-switch input { opacity: 0; width: 0; height: 0; }
.pos-toggle-slider {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.12);
    border-radius: 15px;
    cursor: pointer;
    transition: background 0.25s;
}
.pos-toggle-slider::before {
    content: '';
    position: absolute;
    width: 11px;
    height: 11px;
    background: #fff;
    border-radius: 50%;
    left: 2px;
    top: 2px;
    transition: transform 0.25s;
}
.pos-toggle-switch input:checked + .pos-toggle-slider {
    background: rgba(56,139,253,0.5);
}
.pos-toggle-switch input:checked + .pos-toggle-slider::before {
    transform: translateX(13px);
}

/* Add button */
.pos-add-btn {
    background: rgba(8,153,129,0.18);
    border: 1px solid rgba(8,153,129,0.45);
    color: #089981;
    padding: 4px 10px;
    border-radius: 5px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.18s ease;
    white-space: nowrap;
}
.pos-add-btn:hover {
    background: rgba(8,153,129,0.3);
    border-color: #089981;
    color: #fff;
}

/* Cards container — fills remaining height, scrolls, never clips card width */
/* ── Column header above the scrollable list ─────────────────────────────── */
.pos-list-header {
    display: flex;
    align-items: center;
    padding: 4px 8px 4px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    flex-shrink: 0;
    background: rgba(255,255,255,0.02);
    min-width: 0;
}
.pos-list-header > div {
    font-size: 9px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    white-space: nowrap;
    overflow: hidden;
}
.plh-asset   { width: 82px; flex-shrink: 0; }
.plh-prices  { flex: 1; min-width: 0; padding-left: 6px; }
.plh-right   { width: 88px; flex-shrink: 0; text-align: right; padding-right: 6px; }
.plh-actions { width: 44px; flex-shrink: 0; }

/* ── Scrollable list container ───────────────────────────────────────────── */
.pos-cards-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
    min-height: 0;           /* critical: allows flexbox to shrink below content */
    min-width: 0;
    /* Firefox */
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.14) transparent;
}
/* Webkit — ultra-thin dark scrollbar */
.pos-cards-container::-webkit-scrollbar {
    width: 3px;
}
.pos-cards-container::-webkit-scrollbar-track {
    background: transparent;
}
.pos-cards-container::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.12);
    border-radius: 3px;
    transition: background 0.2s ease;
}
.pos-cards-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.28);
}

.pos-empty {
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
    padding: 30px 0;
}

/* ═══════════════════════════════════════════════════════════════════════════
   POSITION ROW  (replaces the old "card" block layout)
   Each row is a dense flex strip — institutional order-book style.
   Columns: [color-bar] [identity 82px] [prices flex] [pnl+verdict 88px] [actions 44px]
   ═══════════════════════════════════════════════════════════════════════════ */

.pos-card {
    display: flex;
    align-items: center;
    position: relative;
    padding: 0 6px 0 14px;   /* 14px left for the direction color-bar */
    min-height: 54px;
    border: none;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    background: transparent;
    transition: background 0.12s ease;
    overflow: hidden;
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    cursor: default;
}
.pos-card * { box-sizing: border-box; }

/* Direction color bar — left edge */
.pos-card::before {
    content: '';
    position: absolute;
    left: 0; top: 8px; bottom: 8px;
    width: 2px;
    border-radius: 2px;
}
.pos-card.long::before  { background: var(--buy-color); }
.pos-card.short::before { background: var(--sell-color); }

/* Row hover — subtle highlight */
.pos-card:hover { background: rgba(255,255,255,0.032); }
.pos-card:hover .prow-actions { opacity: 1; }

/* ── LEFT COLUMN: Identity ──────────────────────────────────────────────── */
.prow-identity {
    width: 82px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-right: 6px;
    min-width: 0;
    overflow: hidden;
}
.prow-symbol {
    font-size: 13px;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: 0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.1;
}
.prow-quote {
    font-size: 9px;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 0;
}
.prow-badges {
    display: flex;
    align-items: center;
    gap: 3px;
    flex-wrap: nowrap;
    overflow: hidden;
}
.prow-lev {
    font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
    font-size: 9px;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0;
    white-space: nowrap;
}
.prow-meta {
    font-size: 9px;
    color: var(--text-muted);
    opacity: 0.7;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 3px;
}

/* Direction & exchange badges — compact in the row */
.pos-dir-badge {
    font-size: 8px;
    font-weight: 800;
    padding: 1px 5px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
    flex-shrink: 0;
}
.pos-dir-badge.long  { background: rgba(8,153,129,0.2);  color: var(--buy-color); }
.pos-dir-badge.short { background: rgba(242,54,69,0.2);  color: var(--sell-color); }

/* ── MIDDLE COLUMN: Prices ──────────────────────────────────────────────── */
.prow-prices {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 0 6px;
}
.prow-price-line {
    display: flex;
    align-items: baseline;
    gap: 5px;
    min-width: 0;
}
.prow-plabel {
    font-size: 8px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    width: 20px;
    flex-shrink: 0;
    opacity: 0.7;
}
.prow-plabel.sl { color: rgba(242,54,69,0.7); }
.prow-plabel.tp { color: rgba(8,153,129,0.7);  }

.prow-pval {
    font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.01em;
}
.prow-pval.prow-live { color: #e2e8f0; font-weight: 700; }
.prow-pval.prow-sl   { color: rgba(242,54,69,0.85); }
.prow-pval.prow-tp   { color: rgba(8,153,129,0.9);  }

/* TP progress bar — micro, 2px */
.prow-bar-bg {
    height: 2px;
    background: rgba(255,255,255,0.07);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 3px;
}
.prow-bar-fill {
    height: 100%;
    border-radius: 2px;
    background: linear-gradient(90deg, #089981, #26a69a);
    transition: width 0.5s ease;
    max-width: 100%;
}
.prow-bar-fill.neg {
    background: linear-gradient(90deg, #f23645, #ff6b6b);
}

/* Alert dots — tiny colored dots replacing chips in the row */
.prow-alerts-inline { display: inline-flex; gap: 2px; align-items: center; }
.prow-alert-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    flex-shrink: 0;
}
.prow-alert-dot.sl-warn { background: #f23645; }
.prow-alert-dot.tp1-hit { background: #089981; }
.prow-alert-dot.move-sl { background: #f6ad55; }

/* ── RIGHT COLUMN: PnL + Verdict ────────────────────────────────────────── */
.prow-right {
    width: 88px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 3px;
    padding-right: 4px;
    min-width: 0;
}
.prow-pnl {
    font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
    font-size: 13px;
    font-weight: 800;
    white-space: nowrap;
    line-height: 1;
}
.prow-pnl.profit { color: var(--buy-color); }
.prow-pnl.loss   { color: var(--sell-color); }
.prow-pnl-abs {
    font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
    font-size: 9px;
    color: var(--text-muted);
    white-space: nowrap;
}
.prow-verdict-wrap {
    display: flex;
    align-items: center;
    gap: 3px;
    min-width: 0;
    max-width: 100%;
    justify-content: flex-end;
}
/* The verdict status pill — truncated, no wrapping */
.prow-verdict-status {
    font-size: 8px !important;
    padding: 2px 6px !important;
    letter-spacing: 0.05em !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 70px;
    display: inline-block;
    text-align: center;
}

/* Compact analyse button in the row */
.prow-analyse-btn {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.12);
    color: var(--text-muted);
    width: 16px;
    height: 16px;
    border-radius: 3px;
    font-size: 9px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    flex-shrink: 0;
    padding: 0;
    line-height: 1;
}
.prow-analyse-btn:hover {
    background: rgba(56,139,253,0.15);
    border-color: rgba(56,139,253,0.4);
    color: #58a6ff;
}

/* ── FAR-RIGHT COLUMN: Actions ──────────────────────────────────────────── */
.prow-actions {
    width: 44px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    opacity: 0;               /* hidden until row hover */
    transition: opacity 0.15s ease;
}
.pos-btn-icon {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    width: 20px;
    height: 20px;
    border-radius: 4px;
    font-size: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    flex-shrink: 0;
}
.pos-btn-icon:hover { background: var(--hover-bg); color: var(--text-main); border-color: rgba(255,255,255,0.3); }
.pos-btn-icon.delete:hover { background: rgba(242,54,69,0.15); color: #f23645; border-color: rgba(242,54,69,0.4); }
/* Always show actions on touch devices */
@media (hover: none) { .prow-actions { opacity: 1; } }

/* ── Verdict badge colours (reused from old card) ───────────────────────── */
.pos-verdict-badge {
    font-size: 9px;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    line-height: 1.4;
    display: inline-block;
}
.pos-verdict-badge.hold         { background: rgba(56,139,253,0.18); color: #58a6ff; border: 1px solid rgba(56,139,253,0.4); }
.pos-verdict-badge.exit         { background: rgba(242,54,69,0.18);  color: #f23645; border: 1px solid rgba(242,54,69,0.4); }
.pos-verdict-badge.partial-exit { background: rgba(246,173,85,0.15); color: #f6ad55; border: 1px solid rgba(246,173,85,0.4); }
.pos-verdict-badge.move-sl      { background: rgba(168,85,247,0.15); color: #a855f7; border: 1px solid rgba(168,85,247,0.4); }
.pos-verdict-badge.add          { background: rgba(8,153,129,0.18);  color: #089981; border: 1px solid rgba(8,153,129,0.4); }
.pos-verdict-badge.loading      { background: rgba(255,255,255,0.06); color: var(--text-muted); border: 1px solid var(--border-color); }

.pos-model-verdict-btn { cursor: pointer; }
.pos-model-verdict-btn:hover { filter: brightness(1.25); }

/* ── Compact exchange badge ─────────────────────────────────────────────── */
.pos-exchange-badge {
    font-size: 7px;
    font-weight: 700;
    padding: 1px 4px;
    border-radius: 3px;
    background: rgba(246,173,85,0.12);
    color: #f6ad55;
    border: 1px solid rgba(246,173,85,0.25);
    letter-spacing: 0.04em;
    white-space: nowrap;
    vertical-align: middle;
    flex-shrink: 0;
}

/* Smart alerts (full chips kept for tooltip/popup context — hidden in row) */
.pos-alerts { display: none; }

/* Elapsed / notes (not shown in row — in popup only) */
.pos-elapsed { display: none; }

/* BE badge (kept for popup usage) */

/* AI Verdict section */
.pos-verdict-wrap {
    border-top: 1px solid var(--border-color);
    padding-top: 8px;
}
.pos-verdict-header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 5px;
    min-width: 0;
}
.pos-verdict-badge {
    font-size: 11px;
    font-weight: 800;
    padding: 3px 10px;
    border-radius: 5px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.pos-verdict-badge.hold         { background: rgba(56,139,253,0.18); color: #58a6ff; border: 1px solid rgba(56,139,253,0.4); }
.pos-verdict-badge.exit         { background: rgba(242,54,69,0.18);  color: #f23645; border: 1px solid rgba(242,54,69,0.4); }
.pos-verdict-badge.partial-exit { background: rgba(246,173,85,0.15); color: #f6ad55; border: 1px solid rgba(246,173,85,0.4); }
.pos-verdict-badge.move-sl      { background: rgba(168,85,247,0.15); color: #a855f7; border: 1px solid rgba(168,85,247,0.4); }
.pos-verdict-badge.add          { background: rgba(8,153,129,0.18);  color: #089981; border: 1px solid rgba(8,153,129,0.4); }
.pos-verdict-badge.loading      { background: rgba(255,255,255,0.06); color: var(--text-muted); border: 1px solid var(--border-color); }

.pos-verdict-conf {
    font-size: 9px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.pos-verdict-conf.high     { color: #089981; }
.pos-verdict-conf.moderate { color: #f6ad55; }
.pos-verdict-conf.low      { color: var(--text-muted); }

.pos-verdict-text {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.55;
    margin-bottom: 5px;
}
.pos-action-items {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.pos-action-item {
    font-size: 10px;
    color: var(--text-main);
    padding-left: 10px;
    position: relative;
}
.pos-action-item::before {
    content: '→';
    position: absolute;
    left: 0;
    color: #58a6ff;
}
.pos-risk-note {
    font-size: 10px;
    color: #f6ad55;
    margin-top: 5px;
    padding-left: 10px;
    position: relative;
}
.pos-risk-note::before {
    content: '⚠';
    position: absolute;
    left: 0;
}

/* Multi-model verdict chips */
.pos-verdict-models-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
    margin-bottom: 7px;
    min-width: 0;
}
.pos-model-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    min-width: 0;
    overflow: hidden;
}
.pos-model-chip-label {
    font-size: 9px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
}
.pos-model-chip .pos-verdict-badge {
    font-size: 9px;
    padding: 2px 4px;
    width: 100%;
    text-align: center;
    box-sizing: border-box;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pos-model-verdict-btn {
    cursor: pointer;
    transition: filter 0.15s ease, transform 0.12s ease;
}
.pos-model-verdict-btn:hover {
    filter: brightness(1.3);
    transform: scale(1.06);
}
.pos-final-verdict-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
    row-gap: 5px;
    border-top: 1px solid var(--border-color);
    padding-top: 7px;
    margin-top: 2px;
    min-width: 0;
}
.pos-final-label {
    font-size: 9px;
    color: var(--text-muted);
    font-weight: 700;
    letter-spacing: 0.04em;
    flex-shrink: 0;
    white-space: nowrap;
}
.pos-final-badge {
    font-size: 11px !important;
    padding: 4px 10px !important;
    letter-spacing: 0.06em !important;
    white-space: nowrap;
}

.pos-analyse-btn {
    background: transparent;
    border: 1px solid rgba(56,139,253,0.4);
    color: #58a6ff;
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 9px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s ease;
    white-space: nowrap;
    flex-shrink: 0;
}
.pos-analyse-btn:hover { background: rgba(56,139,253,0.15); }
.pos-analyse-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.pos-analyse-single-btn {
    background: transparent;
    border: 1px solid rgba(246,173,85,0.45);
    color: #f6ad55;
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 9px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s ease;
    white-space: nowrap;
    flex-shrink: 0;
}
.pos-analyse-single-btn:hover { background: rgba(246,173,85,0.15); }
.pos-analyse-single-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.pos-elapsed {
    font-size: 9px;
    color: var(--text-muted);
    margin-top: 2px;
    text-align: right;
}

/* Exchange badge on card */
.pos-exchange-badge {
    font-size: 8px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 3px;
    margin-left: 4px;
    background: rgba(246,173,85,0.15);
    color: #f6ad55;
    border: 1px solid rgba(246,173,85,0.3);
    letter-spacing: 0.05em;
    vertical-align: middle;
}

/* BE Active badge on card */
.pos-be-badge {
    font-size: 9px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 3px;
    background: rgba(57,255,20,0.15);
    color: #39ff14;
    border: 1px solid rgba(57,255,20,0.4);
    margin-left: auto;
    letter-spacing: 0.04em;
}

/* TP status chips on card */
.pos-tp-status-row {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin: 4px 0 2px;
}
.tp-status-chip {
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 5px;
    letter-spacing: 0.04em;
    cursor: default;
}
.tp-status-chip small { font-weight: 400; opacity: 0.8; margin-left: 2px; }
.tp-status-chip.pending {
    background: rgba(246,173,85,0.12);
    color: #f6ad55;
    border: 1px solid rgba(246,173,85,0.35);
}
.tp-status-chip.done {
    background: rgba(8,153,129,0.15);
    color: #089981;
    border: 1px solid rgba(8,153,129,0.4);
    text-decoration: line-through;
    opacity: 0.75;
}

/* TP toast */
.tp-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: rgba(13,17,23,0.97);
    border: 1px solid #f6ad55;
    border-radius: 10px;
    color: #f6ad55;
    font-size: 13px;
    font-weight: 700;
    padding: 12px 20px;
    z-index: 9999;
    box-shadow: 0 0 24px rgba(246,173,85,0.4);
    transform: translateY(20px);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    max-width: 340px;
}
.tp-toast.tp-toast-visible { transform: translateY(0); opacity: 1; }

/* Slim form group for % inputs */
.pos-form-group--slim { max-width: 110px; }

/* BE notification toast */
.be-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: rgba(13,17,23,0.97);
    border: 1px solid #39ff14;
    border-radius: 10px;
    color: #39ff14;
    font-size: 13px;
    font-weight: 700;
    padding: 12px 20px;
    z-index: 9999;
    box-shadow: 0 0 24px rgba(57,255,20,0.5);
    transform: translateY(20px);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    max-width: 340px;
}
.be-toast.be-toast-visible {
    transform: translateY(0);
    opacity: 1;
}

/* Sync result toast */
.sync-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: rgba(13,17,23,0.97);
    border: 1px solid #63b3ed;
    border-radius: 10px;
    color: #63b3ed;
    font-size: 13px;
    font-weight: 700;
    padding: 12px 20px;
    z-index: 9999;
    box-shadow: 0 0 24px rgba(99,179,237,0.4);
    transform: translateY(20px);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    max-width: 340px;
}
.sync-toast.sync-toast-visible { transform: translateY(0); opacity: 1; }

/* Sync button */
.pos-sync-btn {
    background: transparent;
    border: 1px solid #63b3ed;
    color: #63b3ed;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}
.pos-sync-btn:hover { background: rgba(99,179,237,0.15); }
.pos-sync-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Fetch from Exchange (modal) ───────────────────────────────────────────── */
.pos-fetch-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 6px;
}
.pos-fetch-exchange-select {
    flex: 0 0 auto;
    background: #161b22;
    border: 1px solid #30363d;
    color: var(--text-main);
    border-radius: 6px;
    padding: 5px 8px;
    font-size: 12px;
}
.pos-fetch-btn {
    flex: 1 1 auto;
    background: rgba(99,179,237,0.12);
    border: 1px solid #63b3ed;
    color: #63b3ed;
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.pos-fetch-btn:hover  { background: rgba(99,179,237,0.22); }
.pos-fetch-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.pos-fetch-picker-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 4px;
}
.pos-fetch-picker-row.hidden { display: none; }
.pos-fetch-picker {
    flex: 1 1 auto;
    background: #161b22;
    border: 1px solid #30363d;
    color: var(--text-main);
    border-radius: 6px;
    padding: 5px 8px;
    font-size: 11px;
    min-width: 0;
}
.pos-fetch-fill-btn {
    flex: 0 0 auto;
    background: rgba(52,211,153,0.12);
    border: 1px solid #34d399;
    color: #34d399;
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
}
.pos-fetch-fill-btn:hover { background: rgba(52,211,153,0.22); }

.pos-fetch-status {
    font-size: 11px;
    min-height: 14px;
    margin-bottom: 2px;
    padding: 0 2px;
}
.pos-fetch-divider {
    border-top: 1px solid #30363d;
    margin: 8px 0;
}

/* ── Bot Mode Toggle ───────────────────────────────────────────────────────── */
.bot-mode-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 8px 0 6px;
}
.bot-mode-btn {
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid #30363d;
    background: transparent;
    color: #6b7280;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.bot-mode-btn--active {
    border-color: #8b5cf6;
    color: #c4b5fd;
    background: rgba(139,92,246,0.15);
}
.bot-mode-btn--autopilot.bot-mode-btn--active {
    border-color: #34d399;
    color: #34d399;
    background: rgba(52,211,153,0.12);
}
.bot-mode-desc {
    font-size: 10px;
    color: #6b7280;
    flex: 1;
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.bot-autopilot-opts {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 6px 8px;
    background: rgba(52,211,153,0.05);
    border: 1px solid rgba(52,211,153,0.15);
    border-radius: 6px;
    margin-bottom: 6px;
}
.bot-autopilot-opts.hidden { display: none; }
.bot-cfg-input {
    width: 48px;
    background: #161b22;
    border: 1px solid #30363d;
    color: var(--text-main);
    border-radius: 4px;
    padding: 2px 4px;
    font-size: 11px;
    text-align: center;
}

/* ── Engine Selector Panel ──────────────────────────────────────────────────── */
/* ── Shared collapse button ─────────────────────────────────────────────── */
.panel-collapse-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 11px;
    cursor: pointer;
    padding: 0 2px;
    margin-left: auto;
    line-height: 1;
    transition: transform 0.22s ease, color 0.15s ease;
    flex-shrink: 0;
}
.panel-collapse-btn:hover { color: var(--text-main); }
/* Rotated when collapsed */
.panel-collapse-btn[aria-expanded="false"] { transform: rotate(-90deg); }

/* ── Collapsible body wrapper ────────────────────────────────────────────── */
/* Wrap the panel body (everything after the title) in .panel-body.
   CSS alone can't animate height:auto → 0, so we use max-height + overflow. */
.panel-body {
    overflow: hidden;
    max-height: 600px;         /* large enough to fit any content */
    transition: max-height 0.3s ease, opacity 0.25s ease, padding 0.25s ease;
    opacity: 1;
}
.panel-body.collapsed {
    max-height: 0;
    opacity: 0;
    pointer-events: none;
}

.engine-panel {
    background: rgba(10,14,20,0.85);
    border: 1px solid rgba(56,189,248,0.30);
    border-radius: 10px;
    margin: 0 10px 10px;
    padding: 10px 14px;
    font-size: 12px;
    /* Remove fixed padding-bottom so it collapses cleanly */
    padding-bottom: 0;
}
/* Restore padding inside the body so title doesn't lose its gap */
.engine-panel .panel-body { padding-bottom: 10px; }

.engine-panel-title {
    display: flex;
    align-items: center;
    font-weight: 700;
    color: #7dd3fc;
    font-size: 12px;
    margin-bottom: 0;
    padding-bottom: 8px;
    cursor: pointer;
    user-select: none;
}
/* ── Engine wallet row ────────────────────────────────────────────── */
.engine-wallet-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    margin-right: 6px;
}
.engine-exchange-select {
    background: #0f172a;
    color: #94a3b8;
    border: 1px solid #334155;
    border-radius: 5px;
    padding: 2px 5px;
    font-size: 11px;
    cursor: pointer;
    outline: none;
}
.engine-exchange-select:focus { border-color: #475569; }
.engine-wallet-balance {
    font-size: 12px;
    font-weight: 700;
    color: #38bdf8;
    white-space: nowrap;
    min-width: 72px;
    text-align: right;
}
.engine-wallet-balance.loading { color: #64748b; }
.engine-wallet-balance.error   { color: #f59e0b; }
.engine-wallet-refresh {
    background: transparent;
    border: none;
    color: #475569;
    font-size: 14px;
    cursor: pointer;
    padding: 0 2px;
    line-height: 1;
    transition: color 0.15s, transform 0.3s;
}
.engine-wallet-refresh:hover { color: #7dd3fc; }
.engine-wallet-refresh.spinning { animation: wallet-spin 0.7s linear infinite; }
@keyframes wallet-spin { to { transform: rotate(360deg); } }

/* ── Trade Stats Bar ───────────────────────────────────────────────────── */
.trade-stats-bar {
    display: flex;
    align-items: center;
    gap: 0;
    background: rgba(15,23,42,0.6);
    border: 1px solid #1e293b;
    border-radius: 8px;
    padding: 7px 10px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}
.trade-stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    min-width: 52px;
}
.trade-stat-label {
    font-size: 9px;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}
.trade-stat-value {
    font-size: 12px;
    font-weight: 700;
    color: #94a3b8;
    margin-top: 2px;
    white-space: nowrap;
}
.trade-stat-value.profit { color: #22c55e; }
.trade-stat-value.loss   { color: #ef4444; }
.trade-stat-value.pos    { color: #22c55e; }
.trade-stat-value.neg    { color: #ef4444; }
.trade-stat-divider {
    width: 1px;
    height: 28px;
    background: #1e293b;
    margin: 0 4px;
    flex-shrink: 0;
}
.btn-reset-stats {
    padding: 3px 8px;
    font-size: 10px;
    font-weight: 700;
    border-radius: 5px;
    border: 1px solid rgba(239,68,68,0.5);
    background: rgba(239,68,68,0.1);
    color: #fca5a5;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s;
}
.btn-reset-stats:hover {
    background: rgba(239,68,68,0.25);
    border-color: #ef4444;
    color: #fff;
}
.btn-reset-stats:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ── Engine Accordion ─────────────────────────────────────────────────────── */
.engine-accordion {
    border: 1px solid #1e293b;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 10px;
}

/* Outer item wrapper */
.eng-item {
    border-bottom: 1px solid #1e293b;
}
.eng-item:last-child { border-bottom: none; }

/* Clickable header row */
.eng-header {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 8px 10px;
    background: #0f172a;
    border: none;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s;
}
.eng-header:hover { background: #1e293b; }
.eng-header.eng-open { background: rgba(30,41,59,0.85); }

.eng-icon  { font-size: 14px; flex-shrink: 0; }
.eng-label { font-size: 12px; font-weight: 700; color: #cbd5e1; flex: 1; }
.eng-desc  { font-size: 10px; color: #64748b; padding: 4px 0 2px; }

/* Chevron: rotates when open */
.eng-chevron {
    font-size: 11px; color: #475569; flex-shrink: 0;
    transition: transform 0.22s ease;
}
.eng-header.eng-open .eng-chevron { transform: rotate(-180deg); }

/* Always-on / Manual badges */
.eng-badge {
    font-size: 9px; font-weight: 700; padding: 2px 6px;
    border-radius: 10px; letter-spacing: 0.3px; flex-shrink: 0;
    text-transform: uppercase;
}
.eng-badge-always {
    background: rgba(20,184,166,0.15);
    color: #2dd4bf;
    border: 1px solid rgba(20,184,166,0.35);
    animation: eng-always-pulse 2.4s ease-in-out infinite;
}
@keyframes eng-always-pulse {
    0%,100% { box-shadow: none; }
    50%      { box-shadow: 0 0 5px rgba(20,184,166,0.4); }
}
.eng-badge-manual {
    background: rgba(99,179,237,0.12);
    color: #7dd3fc;
    border: 1px solid rgba(99,179,237,0.3);
}
.eng-badge-micro {
    background: rgba(251,146,60,0.15);
    color: #fb923c;
    border: 1px solid rgba(251,146,60,0.35);
    animation: eng-always-pulse 2.4s ease-in-out infinite;
}

/* Sliding body */
.eng-body {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.28s ease, opacity 0.22s ease;
    opacity: 0;
}
.eng-body.eng-body-open {
    max-height: 600px;
    opacity: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Inner padding for content */
.eng-body-inner {
    padding: 8px 10px 12px;
    background: rgba(15,23,42,0.6);
    border-top: 1px solid #1e293b;
}




/* Neutral override button */
.neutral-override-btn {
    padding: 3px 10px;
    border-radius: 5px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    border: 1px solid #64748b;
    background: transparent;
    color: #94a3b8;
    transition: all 0.2s;
    white-space: nowrap;
}
.neutral-override-btn:hover { background: rgba(100,116,139,0.2); color: #cbd5e1; }
.neutral-override-btn.override-active {
    border-color: #f59e0b;
    background: rgba(245,158,11,0.15);
    color: #fbbf24;
}
.neutral-override-btn.override-active:hover { background: rgba(245,158,11,0.25); }

/* ── Trade Approval Cards (NEUTRAL signal prompt) ─────────────────────────── */
.trade-approval-stack {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column-reverse;
    gap: 10px;
    z-index: 9000;
    pointer-events: none;
}

/* ── Engine Badges for Real-Time Signals Grid ──────────────────────────────── */
.top5-engine-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    font-size: 10px;
    font-weight: 800;
    padding: 2px 5px;
    border-radius: 4px;
    color: #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.4);
    z-index: 5;
    letter-spacing: 0.5px;
}
.top5-engine-badge.eng3 { background: #fca5a5; color: #7f1d1d; border: 1px solid #ef4444; }
.top5-engine-badge.eng4 { background: #eab308; color: #422006; border: 1px solid #ca8a04; }
.top5-engine-badge.eng5 { background: #34d399; color: #064e3b; border: 1px solid #10b981; }
.top5-engine-badge.eng6 { background: #60a5fa; color: #1e3a8a; border: 1px solid #3b82f6; }
.approval-card {
    pointer-events: all;
    background: #1e2130;
    border: 1px solid #f59e0b;
    border-radius: 10px;
    padding: 12px 14px;
    min-width: 280px;
    max-width: 320px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.5), 0 0 12px rgba(245,158,11,0.2);
    animation: approval-slide-in 0.25s ease;
}
@keyframes approval-slide-in {
    from { opacity: 0; transform: translateX(40px); }
    to   { opacity: 1; transform: translateX(0); }
}
.approval-card.dismissing {
    animation: approval-slide-out 0.2s ease forwards;
}
@keyframes approval-slide-out {
    to { opacity: 0; transform: translateX(50px); }
}
.approval-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}
.approval-card-title {
    font-size: 11px;
    font-weight: 700;
    color: #f59e0b;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}
.approval-card-timer {
    font-size: 11px;
    color: #64748b;
    font-weight: 600;
}
.approval-card-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 12px;
    margin-bottom: 10px;
}
.approval-kv { font-size: 12px; color: #94a3b8; }
.approval-kv span { color: #e2e8f0; font-weight: 700; }
.approval-card-btns {
    display: flex;
    gap: 8px;
}
.approval-btn {
    flex: 1;
    padding: 6px 0;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    border: none;
    transition: opacity 0.15s;
}
.approval-btn:hover { opacity: 0.85; }
.approval-btn-yes { background: #089981; color: #fff; }
.approval-btn-no  { background: #1e293b; color: #94a3b8; border: 1px solid #334155; }

/* ── Regime Approval Banner ────────────────────────────────────────────────── */
.regime-approval-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9100;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: regime-banner-drop 0.3s ease;
}
@keyframes regime-banner-drop {
    from { transform: translateY(-100%); opacity: 0; }
    to   { transform: translateY(0);     opacity: 1; }
}
.regime-approval-banner.bearish-banner { background: rgba(239,68,68,0.92); }
.regime-approval-banner.bullish-banner { background: rgba(8,153,129,0.92); }
.regime-approval-inner {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    justify-content: center;
}
.regime-approval-text {
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.3px;
}
.regime-approval-btns { display: flex; gap: 8px; }
.regime-btn {
    padding: 5px 16px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    border: none;
    transition: opacity 0.15s;
}
.regime-btn:hover { opacity: 0.85; }
.regime-btn-yes { background: #fff; color: #0f172a; }
.regime-btn-no  { background: rgba(0,0,0,0.25); color: #fff; border: 1px solid rgba(255,255,255,0.3); }

.engine-toggle-btn.engine-active-auto {
    background: rgba(139,92,246,0.18);
    color: #c4b5fd;
    box-shadow: inset 0 -2px 0 #8b5cf6;
    animation: auto-engine-pulse 2.4s ease-in-out infinite;
}
@keyframes auto-engine-pulse {
    0%, 100% { box-shadow: inset 0 -2px 0 #8b5cf6; }
    50%       { box-shadow: inset 0 -2px 0 #8b5cf6, 0 0 8px rgba(139,92,246,0.5); }
}
.engine-scalp-cfg.hidden { display: none; }

/* Engine 3: Parabolic Short */
.engine-para-cfg { margin-top: 8px; }
.para-info-banner {
    background: rgba(239,83,80,0.1);
    border: 1px solid rgba(239,83,80,0.25);
    border-radius: 6px;
    padding: 7px 10px;
    margin-bottom: 8px;
}
.para-info-title { font-size: 11px; font-weight: 700; color: #fca5a5; display: block; }
.para-info-sub   { font-size: 9px; color: #94a3b8; display: block; margin-top: 2px; }
.para-stats-row  { display: flex; gap: 10px; font-size: 10px; color: #64748b; margin-top: 6px; }
.para-cfg-btn-row {
    display: flex; gap: 6px; margin-top: 8px;
}
.para-cfg-btn-row button { flex: 1; }

.para-default-btn {
    padding: 6px; border-radius: 5px;
    background: rgba(160,174,192,0.10); color: #a0aec0;
    border: 1px solid rgba(160,174,192,0.25); font-size: 11px;
    font-weight: 700; cursor: pointer;
}
.para-default-btn:hover { background: rgba(160,174,192,0.22); }

.para-load-btn {
    padding: 6px; border-radius: 5px;
    background: rgba(99,179,237,0.12); color: #90cdf4;
    border: 1px solid rgba(99,179,237,0.3); font-size: 11px;
    font-weight: 700; cursor: pointer;
}
.para-load-btn:hover { background: rgba(99,179,237,0.25); }

.para-save-btn {
    padding: 6px; border-radius: 5px;
    background: rgba(239,83,80,0.15); color: #fca5a5;
    border: 1px solid rgba(239,83,80,0.3); font-size: 11px;
    font-weight: 700; cursor: pointer;
}
.para-save-btn:hover { background: rgba(239,83,80,0.28); }

/* Auto-scan controls */
.auto-scan-group {
    display: flex; align-items: center; gap: 6px;
}
.scan-interval-dropdown {
    background: #1e2130; color: #94a3b8;
    border: 1px solid #334155; border-radius: 5px;
    padding: 4px 6px; font-size: 11px; cursor: pointer;
    outline: none;
}
.scan-interval-dropdown:focus { border-color: #60a5fa; }
.btn-auto-scan {
    padding: 5px 12px; border-radius: 5px; font-size: 11px; font-weight: 700;
    background: rgba(99,102,241,0.15); color: #a5b4fc;
    border: 1px solid rgba(99,102,241,0.35); cursor: pointer;
    white-space: nowrap; transition: background 0.15s, color 0.15s;
}
.btn-auto-scan:hover { background: rgba(99,102,241,0.28); }
.btn-auto-scan.auto-scan-active {
    background: rgba(99,102,241,0.35); color: #e0e7ff;
    border-color: #6366f1; box-shadow: 0 0 6px rgba(99,102,241,0.4);
}

/* ── Live Exchange Position Strip ───────────────────────────────────────── */
#live-pos-strip {
    margin: 6px 0 4px;
    background: rgba(15,23,42,0.6);
    border: 1px solid rgba(71,85,105,0.35);
    border-radius: 7px;
    overflow: hidden;
}
.lps-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 4px 8px;
    background: rgba(30,41,59,0.7);
    border-bottom: 1px solid rgba(71,85,105,0.3);
}
.lps-title {
    font-size: 10px; font-weight: 700; color: #38bdf8; letter-spacing: 0.5px;
    display: flex; align-items: center; gap: 5px;
}
.lps-title::before { content:''; display:inline-block; width:6px; height:6px; border-radius:50%; background:#38bdf8; animation: lps-pulse 1.8s ease-in-out infinite; }
@keyframes lps-pulse { 0%,100%{opacity:1;} 50%{opacity:0.3;} }
.lps-refresh-btn {
    font-size: 12px; background: none; border: none; color: #64748b;
    cursor: pointer; padding: 0 2px; line-height: 1; border-radius: 3px;
    transition: color 0.15s;
}
.lps-refresh-btn:hover { color: #38bdf8; }
.lps-row {
    display: flex; align-items: center; gap: 7px;
    padding: 5px 8px;
    border-bottom: 1px solid rgba(71,85,105,0.18);
    font-size: 11px;
}
.lps-row:last-child { border-bottom: none; }
.lps-row.long  { border-left: 2px solid #26a69a; }
.lps-row.short { border-left: 2px solid #ef5350; }
.lps-dir {
    font-size: 9px; font-weight: 700; padding: 1px 5px; border-radius: 3px; flex-shrink: 0;
}
.lps-dir.long  { background: rgba(38,166,154,0.18); color: #26a69a; border: 1px solid rgba(38,166,154,0.3); }
.lps-dir.short { background: rgba(239,83,80,0.18);  color: #ef5350; border: 1px solid rgba(239,83,80,0.3); }
.lps-sym { font-size: 12px; font-weight: 700; color: #e2e8f0; min-width: 60px; }
.lps-sym-link { cursor: pointer; border-bottom: 1px dashed rgba(88,166,255,0.4); transition: color 0.15s, border-color 0.15s; }
.lps-sym-link:hover { color: #58a6ff; border-bottom-color: #58a6ff; }
.lps-meta { font-size: 9px; color: #64748b; flex-shrink: 0; }
.lps-sep { color: #334155; font-size: 10px; }
.lps-ent-lbl { font-size: 9px; color: #64748b; }
.lps-ent-val { font-size: 11px; color: #94a3b8; }
.lps-live-val { font-size: 11px; color: #e2e8f0; font-weight: 600; }
.lps-pnl {
    font-size: 11px; font-weight: 700; margin-left: auto; flex-shrink: 0;
}
.lps-pnl.profit { color: #26a69a; }
.lps-pnl.loss   { color: #ef5350; }
.lps-pnl.flat   { color: #64748b; }
.lps-pnl-amt {
    font-size: 10px; font-weight: 600; flex-shrink: 0; margin-left: 2px;
}
.lps-pnl-amt.profit { color: #26a69a; }
.lps-pnl-amt.loss   { color: #ef5350; }
.lps-sl-lbl { font-size: 9px; color: #64748b; }
.lps-sl-val { font-size: 10px; color: #f87171; font-weight: 600; }
.lps-tp-lbl { font-size: 9px; color: #64748b; }
.lps-tp-val { font-size: 10px; color: #26a69a; font-weight: 600; }
.lps-remove {
    font-size: 10px; background: none; border: none; color: #475569;
    cursor: pointer; padding: 1px 4px; border-radius: 3px; flex-shrink: 0;
    transition: color 0.15s, background 0.15s;
}
.lps-remove:hover { background: rgba(239,83,80,0.15); color: #f87171; }

/* ── LPS: single scrollable-line layout ─────────────────────────── */
.lps-row { flex-direction: column; align-items: stretch; gap: 0; padding: 0 0 0 0; }

/* The single info line — scrolls horizontally when content is wider than panel */
.lps-row-info {
    display: flex; align-items: center; gap: 6px;
    flex-wrap: nowrap; white-space: nowrap;
    overflow-x: auto; overflow-y: hidden;
    padding: 5px 8px 4px;
    scrollbar-width: thin;
    scrollbar-color: rgba(88,166,255,0.18) transparent;
    min-height: 26px;
}
.lps-row-info::-webkit-scrollbar { height: 3px; }
.lps-row-info::-webkit-scrollbar-track { background: transparent; }
.lps-row-info::-webkit-scrollbar-thumb { background: rgba(88,166,255,0.25); border-radius: 2px; }
.lps-row-info::-webkit-scrollbar-thumb:hover { background: rgba(88,166,255,0.5); }

.lps-age    { font-size: 9px; color: #64748b; flex-shrink: 0; white-space: nowrap; }
.lps-margin { font-size: 9px; color: #94a3b8; flex-shrink: 0; white-space: nowrap; }
.lps-liq    { font-size: 9px; color: #64748b; flex-shrink: 0; white-space: nowrap; border: 1px solid transparent; border-radius: 3px; padding: 0 3px; }
.lps-liq.warn   { color: #f59e0b; border-color: rgba(245,158,11,0.3); }
.lps-liq.danger { color: #ef4444; border-color: rgba(239,68,68,0.4); animation: lps-liq-blink 1s ease-in-out infinite; }
@keyframes lps-liq-blink { 0%,100%{opacity:1;} 50%{opacity:0.5;} }

.lps-actions { margin-left: auto; display: flex; gap: 4px; flex-shrink: 0; }
.lps-btn { font-size: 9px; font-weight: 700; padding: 1px 5px; border-radius: 3px; border: 1px solid; cursor: pointer; line-height: 14px; transition: background 0.12s, color 0.12s; }
.lps-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.lps-btn-be    { background: rgba(139,92,246,0.12); color: #a78bfa; border-color: rgba(139,92,246,0.35); }
.lps-btn-be:hover:not(:disabled)    { background: rgba(139,92,246,0.25); }
.lps-btn-close { background: rgba(239,68,68,0.12);  color: #f87171; border-color: rgba(239,68,68,0.35); }
.lps-btn-close:hover:not(:disabled) { background: rgba(239,68,68,0.25); }
.lps-btn.lps-btn-ok  { background: rgba(38,166,154,0.25); color: #26a69a; border-color: #26a69a; }
.lps-btn.lps-btn-err { background: rgba(239,68,68,0.25);  color: #ef5350; border-color: #ef5350; }
.lps-btn-diagnose { background: rgba(99,102,241,0.12); color: #818cf8; border-color: rgba(99,102,241,0.35); font-size: 11px; padding: 1px 4px; }
.lps-btn-diagnose:hover:not(:disabled) { background: rgba(99,102,241,0.28); }

/* Progress bar */
.lps-pbar-wrap  { margin-top: 3px; padding: 0 2px 1px; }
.lps-pbar-track { position: relative; height: 4px; background: rgba(71,85,105,0.3); border-radius: 2px; overflow: visible; }
.lps-pbar-fill  { position: absolute; top: 0; height: 100%; border-radius: 2px; transition: left 0.4s, width 0.4s; }
.lps-pbar-fill.profit { background: rgba(38,166,154,0.55); }
.lps-pbar-fill.loss   { background: rgba(239,83,80,0.45); }
.lps-pbar-marker.sl { position: absolute; top: -2px; width: 2px; height: 8px; background: #ef5350; border-radius: 1px; transform: translateX(-50%); }
.lps-pbar-marker.tp { position: absolute; top: -2px; width: 2px; height: 8px; background: #26a69a; border-radius: 1px; transform: translateX(-50%); }
.lps-pbar-dot { position: absolute; top: 50%; width: 7px; height: 7px; border-radius: 50%; background: #e2e8f0; border: 1px solid #0d1117; transform: translate(-50%,-50%); transition: left 0.4s; z-index: 2; }

/* PnL pulse animation */
@keyframes lps-pnl-pulse { 0%{transform:scale(1)} 25%{transform:scale(1.18)} 50%{transform:scale(1)} 75%{transform:scale(1.10)} 100%{transform:scale(1)} }
.lps-pnl.lps-pnl-pulse { animation: lps-pnl-pulse 0.5s ease-out; }

/* Para Short trade cards — red-tinted (SHORT direction) */
.ast-row.short { border-left: 2px solid #ef4444; }
.para-dir-badge {
    font-size: 9px; font-weight: 700; padding: 1px 4px; border-radius: 3px;
    background: rgba(239,83,80,0.2); color: #f87171; border: 1px solid rgba(239,83,80,0.35);
}
.para-rise-badge {
    font-size: 9px; font-weight: 700; padding: 1px 4px; border-radius: 3px;
    background: rgba(251,191,36,0.15); color: #fbbf24; border: 1px solid rgba(251,191,36,0.3);
}
.engine-status-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: #64748b;
    margin-bottom: 4px;
}
.engine-status-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: #38bdf8;
    flex-shrink: 0;
}
.engine-status-dot.scalp { background: #fbbf24; animation: pulse-scalp 1.5s infinite; }
@keyframes pulse-scalp {
    0%,100% { opacity: 1; }
    50%      { opacity: 0.4; }
}
.engine-status-text { color: #94a3b8; }

/* Scalp config grid */
.engine-scalp-cfg { margin-top: 8px; }
.engine-scalp-cfg.hidden { display: none; }
.engine-cfg-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-bottom: 8px;
}
.engine-cfg-label {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 10px;
    color: #64748b;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.engine-cfg-input, .engine-cfg-select {
    margin-top: 2px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(251,191,36,0.25);
    border-radius: 5px;
    color: #e2e8f0;
    font-size: 11px;
    padding: 4px 6px;
    width: 100%;
    box-sizing: border-box;
}
.engine-cfg-input:focus, .engine-cfg-select:focus {
    outline: none;
    border-color: #fbbf24;
}
.engine-scalp-stats {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 10px;
    color: #64748b;
    padding-top: 6px;
    border-top: 1px solid rgba(255,255,255,0.06);
    flex-wrap: wrap;
}
.engine-scalp-stats span { color: #94a3b8; }
.scalp-retry-btn {
    margin-left: auto;
    background: rgba(247,147,26,0.15);
    border: 1px solid rgba(247,147,26,0.4);
    color: #f7931a;
    padding: 3px 10px;
    border-radius: 5px;
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.18s ease;
    white-space: nowrap;
}
.scalp-retry-btn:hover { background: rgba(247,147,26,0.28); border-color: #f7931a; color: #fff; }
.scalp-retry-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Active Scalp Trades Panel ─────────────────────────────────────────────── */
#active-scalp-trades {
    margin: 8px 0 4px;
    border: 1px solid rgba(247,147,26,0.25);
    border-radius: 7px;
    overflow: hidden;
    font-family: 'JetBrains Mono','Fira Code','Courier New',monospace;
}
.ast-header {
    display: grid;
    grid-template-columns: 82px 1fr 1fr 80px;
    gap: 0 6px;
    padding: 5px 10px;
    background: rgba(247,147,26,0.1);
    border-bottom: 1px solid rgba(247,147,26,0.2);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: rgba(247,147,26,0.7);
    text-transform: uppercase;
}
.ast-row {
    display: grid;
    grid-template-columns: 82px 1fr 1fr 80px;
    gap: 0 6px;
    padding: 7px 10px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    position: relative;
    transition: background 0.15s;
}
.ast-row:last-child { border-bottom: none; }
.ast-row::before {
    content: '';
    position: absolute;
    left: 0; top: 4px; bottom: 4px;
    width: 2px;
    border-radius: 2px;
}
.ast-row.long::before  { background: #26a69a; }
.ast-row.short::before { background: #ef5350; }
.ast-row:hover { background: rgba(255,255,255,0.04); }
.ast-col { display: flex; flex-direction: column; justify-content: center; gap: 2px; }
.ast-col-sym { gap: 3px; }
.ast-sym { font-size: 12px; font-weight: 700; color: #e2e8f0; line-height: 1; }
.ast-badges { display: flex; align-items: center; gap: 3px; }
.ast-dir { font-size: 9px; font-weight: 700; padding: 1px 4px; border-radius: 3px; }
.ast-dir.long  { background: rgba(38,166,154,0.2); color: #26a69a; border: 1px solid rgba(38,166,154,0.3); }
.ast-dir.short { background: rgba(239,83,80,0.2);  color: #ef5350; border: 1px solid rgba(239,83,80,0.3); }
.ast-lev  { font-size: 9px; color: #94a3b8; }
.ast-exch { font-size: 9px; color: #64748b; }
/* Fundamental tier badges (PSI-derived: T1=blue-chip → T5=blocked) */
.ast-fund { font-size: 9px; font-weight: 700; padding: 1px 4px; border-radius: 3px; }
.ast-fund-t1 { background: rgba(56,189,248,0.2); color: #38bdf8; border: 1px solid rgba(56,189,248,0.35); }
.ast-fund-t2 { background: rgba(52,211,153,0.2); color: #34d399; border: 1px solid rgba(52,211,153,0.35); }
.ast-fund-t3 { background: rgba(251,191,36,0.2); color: #fbbf24; border: 1px solid rgba(251,191,36,0.35); }
.ast-fund-t4 { background: rgba(148,163,184,0.15); color: #94a3b8; border: 1px solid rgba(148,163,184,0.25); }
.ast-fund-t5 { background: rgba(239,83,80,0.15); color: #f87171; border: 1px solid rgba(239,83,80,0.3); }
.ast-vecm { font-size: 9px; font-weight: 700; padding: 1px 4px; border-radius: 3px; background: rgba(167,139,250,0.15); color: #a78bfa; border: 1px solid rgba(167,139,250,0.3); cursor: help; }
.ast-btc4d { font-size: 9px; font-weight: 700; padding: 1px 4px; border-radius: 3px; cursor: help; }
.ast-btc4d-bull { background: rgba(52,211,153,0.15); color: #34d399; border: 1px solid rgba(52,211,153,0.3); }
.ast-btc4d-bear { background: rgba(239,83,80,0.12); color: #f87171; border: 1px solid rgba(239,83,80,0.28); }
.ast-btc4d-neutral { background: rgba(148,163,184,0.1); color: #94a3b8; border: 1px solid rgba(148,163,184,0.22); }
.ast-elapsed { font-size: 9px; color: #64748b; }
.ast-price-row { display: flex; align-items: baseline; gap: 4px; }
.ast-plabel { font-size: 9px; color: #64748b; min-width: 18px; }
.ast-plabel.tp { color: #26a69a; }
.ast-plabel.sl { color: #ef5350; }
.ast-pval { font-size: 11px; color: #cbd5e1; }
.ast-live { color: #e2e8f0; }
.ast-tp   { color: #26a69a; }
.ast-sl   { color: #ef5350; }
.ast-col-pnl { align-items: flex-end; }
.ast-pnl-pct {
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
}
.ast-pnl-usd { font-size: 10px; }
.ast-ttp-pill {
    display: inline-block;
    background: linear-gradient(135deg, #1e3a5f 0%, #0d4f8a 100%);
    color: #60c8ff;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    padding: 2px 7px;
    border-radius: 10px;
    border: 1px solid #2563a8;
    white-space: nowrap;
}
.ast-profit { color: #26a69a; }
.ast-loss   { color: #ef5350; }
.ast-refresh-btn {
    margin-left: 4px;
    background: none;
    border: 1px solid rgba(247,147,26,0.35);
    border-radius: 4px;
    color: rgba(247,147,26,0.7);
    font-size: 10px;
    padding: 1px 5px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    line-height: 1.4;
}
.ast-refresh-btn:hover { background: rgba(247,147,26,0.18); color: #f7931a; }
.ast-refresh-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.ast-row-refresh {
    display: inline-flex;
    align-items: center;
    margin-left: 5px;
    background: none;
    border: 1px solid rgba(66,153,225,0.4);
    border-radius: 3px;
    color: rgba(66,153,225,0.8);
    font-size: 10px;
    padding: 0px 4px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    line-height: 1.6;
    flex-shrink: 0;
}
.ast-row-refresh:hover { background: rgba(66,153,225,0.2); color: #63b3ed; }
.ast-row-refresh:disabled { opacity: 0.35; cursor: not-allowed; }

/* ── Bot Manager Panel ─────────────────────────────────────────────────────── */
.bot-panel {
    background: rgba(10,14,20,0.85);
    border: 1px solid rgba(139,92,246,0.35);
    border-radius: 10px;
    margin: 0 10px 10px;
    padding: 10px 14px 0;
    font-size: 12px;
}
.bot-panel .panel-body { padding-bottom: 10px; }
.bot-panel-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 8px;
    cursor: pointer;
    user-select: none;
}
.bot-panel-title {
    font-weight: 700;
    color: #c4b5fd;
    font-size: 12px;
    flex: 1;
}
/* Bot toggle switch */
.bot-toggle-wrap {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
    cursor: pointer;
}
.bot-toggle-wrap input { display: none; }
.bot-toggle-slider {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.12);
    border-radius: 20px;
    transition: background 0.25s;
}
.bot-toggle-slider::before {
    content: '';
    position: absolute;
    width: 14px; height: 14px;
    left: 3px; top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.25s;
}
.bot-toggle-wrap input:checked + .bot-toggle-slider {
    background: #8b5cf6;
}
.bot-toggle-wrap input:checked + .bot-toggle-slider::before {
    transform: translateX(16px);
}
.bot-status-label {
    font-size: 11px;
    font-weight: 700;
    color: #6b7280;
    min-width: 30px;
}
.bot-status-label.active { color: #8b5cf6; }
.bot-log-toggle-btn {
    background: transparent;
    border: 1px solid rgba(139,92,246,0.4);
    color: #a78bfa;
    border-radius: 5px;
    padding: 2px 8px;
    font-size: 11px;
    cursor: pointer;
}
.bot-log-toggle-btn:hover { background: rgba(139,92,246,0.12); }
/* Config row */
.bot-config-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
    flex-wrap: wrap;
}
.bot-cfg-label {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #9ca3af;
    font-size: 11px;
}
.bot-cfg-select {
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.12);
    color: #e2e8f0;
    border-radius: 5px;
    padding: 2px 4px;
    font-size: 11px;
}
.bot-cfg-check input { accent-color: #8b5cf6; }
/* Next run row */
.bot-next-run-row {
    margin-top: 6px;
    display: flex;
    gap: 10px;
    font-size: 10px;
    color: #6b7280;
}
/* Log panel */
.bot-log-panel {
    margin-top: 8px;
    border-top: 1px solid rgba(255,255,255,0.06);
    padding-top: 6px;
    max-height: 180px;
    overflow-y: auto;
}
.bot-log-panel.hidden { display: none; }
.bot-log-entries { display: flex; flex-direction: column; gap: 4px; }
.bot-log-empty { color: #4b5563; font-size: 11px; padding: 4px 0; }
.bot-log-entry {
    background: rgba(255,255,255,0.04);
    border-radius: 6px;
    padding: 5px 8px;
    font-size: 11px;
}
.bot-log-entry .ble-time { color: #4b5563; font-size: 10px; }
.bot-log-entry .ble-sym  { font-weight: 700; color: #c4b5fd; }
.bot-log-entry .ble-action-hold    { color: #6b7280; }
.bot-log-entry .ble-action-close   { color: #34d399; }
.bot-log-entry .ble-action-dryrun  { color: #f6ad55; }
.bot-log-entry .ble-action-fail    { color: #f87171; }
.bot-log-entry .ble-chips { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 3px; }
.bot-log-chip {
    font-size: 9px;
    font-weight: 600;
    padding: 1px 5px;
    border-radius: 4px;
    background: rgba(255,255,255,0.06);
    color: #9ca3af;
}
.bot-log-chip.exit { background: rgba(239,68,68,0.18); color: #f87171; }
.bot-log-chip.hold { background: rgba(107,114,128,0.18); color: #9ca3af; }
/* WhatsApp row inside bot panel */
.bot-wa-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding-top: 7px;
    border-top: 1px solid rgba(255,255,255,0.06);
    font-size: 11px;
}
.bot-wa-status { flex: 1; color: #9ca3af; }
.bot-wa-status.ok   { color: #34d399; }
.bot-wa-status.fail { color: #6b7280; }
.bot-wa-test-btn {
    background: transparent;
    border: 1px solid #25d366;
    color: #25d366;
    border-radius: 5px;
    padding: 2px 8px;
    font-size: 11px;
    cursor: pointer;
    transition: background 0.2s;
}
.bot-wa-test-btn:hover { background: rgba(37,211,102,0.12); }
.bot-wa-test-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.bot-wa-setup-link {
    color: #6b7280;
    font-size: 10px;
    text-decoration: none;
}
.bot-wa-setup-link:hover { color: #9ca3af; }

/* Abort alert toast — red, prominent, stays 10s */
.abort-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: rgba(13,17,23,0.98);
    border: 1px solid #f23645;
    border-radius: 10px;
    color: #f23645;
    font-size: 13px;
    font-weight: 700;
    padding: 14px 20px;
    z-index: 10000;
    box-shadow: 0 0 32px rgba(242,54,69,0.55);
    transform: translateY(20px);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    max-width: 380px;
    white-space: pre-line;
}
.abort-toast.abort-toast-visible { transform: translateY(0); opacity: 1; }
/* Per-card abort badge */
.pos-abort-badge {
    font-size: 9px;
    font-weight: 700;
    background: rgba(242,54,69,0.18);
    color: #f23645;
    border: 1px solid rgba(242,54,69,0.5);
    border-radius: 5px;
    padding: 1px 6px;
    margin-left: 4px;
    white-space: nowrap;
}

/* Bot action toast */
.bot-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: rgba(13,17,23,0.97);
    border: 1px solid #8b5cf6;
    border-radius: 10px;
    color: #c4b5fd;
    font-size: 13px;
    font-weight: 700;
    padding: 12px 20px;
    z-index: 9999;
    box-shadow: 0 0 24px rgba(139,92,246,0.4);
    transform: translateY(20px);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    max-width: 360px;
}
.bot-toast.bot-toast-visible { transform: translateY(0); opacity: 1; }
/* Per-card bot badge */
.pos-bot-badge {
    font-size: 10px;
    font-weight: 700;
    background: rgba(139,92,246,0.18);
    color: #a78bfa;
    border: 1px solid rgba(139,92,246,0.4);
    border-radius: 5px;
    padding: 1px 6px;
    margin-left: 4px;
}

/* Correlation warning modal */
.corr-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65);
    z-index: 5000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}
.corr-modal-overlay.hidden { display: none; }
.corr-modal {
    background: rgba(22,27,34,0.98);
    border: 1px solid rgba(242,54,69,0.5);
    border-radius: 14px;
    padding: 24px;
    max-width: 440px;
    width: 90%;
    box-shadow: 0 0 40px rgba(242,54,69,0.2);
}
.corr-modal-header {
    font-size: 15px;
    font-weight: 800;
    color: #f23645;
    margin-bottom: 14px;
    letter-spacing: 0.02em;
}
.corr-modal-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 18px;
}
.corr-warning-item {
    font-size: 12px;
    color: var(--text-main);
    line-height: 1.6;
    background: rgba(242,54,69,0.07);
    border: 1px solid rgba(242,54,69,0.2);
    border-radius: 7px;
    padding: 10px 12px;
}
.corr-pct {
    color: #f23645;
    font-weight: 800;
}
.corr-modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}
.corr-btn-cancel {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 7px 18px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s;
}
.corr-btn-cancel:hover { border-color: #f23645; color: #f23645; }
.corr-btn-continue {
    background: rgba(242,54,69,0.15);
    border: 1px solid rgba(242,54,69,0.5);
    color: #f23645;
    padding: 7px 18px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.18s;
}
.corr-btn-continue:hover { background: rgba(242,54,69,0.25); }

/* Add / Edit position modal */
.pos-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
}
.pos-modal-overlay.hidden { display: none; }
.pos-modal {
    background: rgba(22,27,34,0.99);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    width: 460px;
    max-width: 95vw;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 16px 48px rgba(0,0,0,0.6);
}
.pos-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px 12px;
    border-bottom: 1px solid var(--border-color);
}
.pos-modal-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-main);
}
.pos-modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
    line-height: 1;
    padding: 2px 6px;
    border-radius: 4px;
    transition: color 0.15s;
}
.pos-modal-close:hover { color: #f23645; }

/* Form inside modal */
.pos-form {
    padding: 16px 18px 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.pos-form-row {
    display: flex;
    gap: 12px;
}
.pos-form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 0;
}
.pos-form-group label {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.pos-form-group input,
.pos-form-group select {
    background: rgba(0,0,0,0.35);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 7px 10px;
    border-radius: 6px;
    font-size: 12px;
    outline: none;
    transition: border-color 0.18s;
    width: 100%;
}
.pos-form-group input:focus,
.pos-form-group select:focus {
    border-color: #58a6ff;
    box-shadow: 0 0 0 2px rgba(56,139,253,0.15);
}
.pos-form-group select option {
    background: #161b22;
}
.pos-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 4px;
}
.pos-btn-cancel {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 7px 16px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
}
.pos-btn-cancel:hover { background: var(--hover-bg); color: var(--text-main); }
.pos-btn-save {
    background: rgba(8,153,129,0.2);
    border: 1px solid rgba(8,153,129,0.5);
    color: #089981;
    padding: 7px 20px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
}
.pos-btn-save:hover { background: rgba(8,153,129,0.35); color: #fff; }

/* ══ AI Verdict Popup ══════════════════════════════════════════════════════ */
.verdict-popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.verdict-popup-overlay.hidden { display: none; }

.verdict-popup {
    background: rgba(13,17,23,0.99);
    border: 1px solid rgba(56,139,253,0.3);
    border-radius: 14px;
    width: 720px;
    max-width: 96vw;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 64px rgba(0,0,0,0.7), 0 0 0 1px rgba(56,139,253,0.1);
    overflow: hidden;
}

.verdict-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 14px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    background: rgba(22,27,34,0.8);
}
.verdict-popup-title-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.vp-symbol {
    font-size: 15px;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: 0.04em;
}
.vp-dir-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.vp-dir-badge.long  { background: rgba(8,153,129,0.2);  color: var(--buy-color); }
.vp-dir-badge.short { background: rgba(242,54,69,0.2); color: var(--sell-color); }
.vp-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}
.verdict-popup-close {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    width: 28px;
    height: 28px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    flex-shrink: 0;
}
.verdict-popup-close:hover { background: rgba(242,54,69,0.15); color: #f23645; border-color: rgba(242,54,69,0.4); }

.verdict-popup-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}
.verdict-popup-body::-webkit-scrollbar { width: 4px; }
.verdict-popup-body::-webkit-scrollbar-track { background: transparent; }
.verdict-popup-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }

/* Verdict row */
.vp-verdict-row {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}
.vp-verdict-main {
    display: flex;
    align-items: center;
    gap: 10px;
}
.vp-metrics-strip {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}
.vp-metric-pill {
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border-color);
    border-radius: 7px;
    padding: 7px 10px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.vp-metric-label {
    font-size: 9px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.vp-metric-val {
    font-size: 13px;
    font-weight: 800;
    color: var(--text-main);
}
.vp-metric-val.profit { color: var(--buy-color); }
.vp-metric-val.loss   { color: var(--sell-color); }
.vp-metric-val.risk-low  { color: #089981; }
.vp-metric-val.risk-med  { color: #f6ad55; }
.vp-metric-val.risk-high { color: #f23645; }
.vp-verdict-badge {
    font-size: 13px;
    font-weight: 800;
    padding: 5px 14px;
    border-radius: 7px;
    text-transform: uppercase;
    letter-spacing: 0.07em;
}
.vp-verdict-badge.hold         { background: rgba(56,139,253,0.18);  color: #58a6ff;  border: 1px solid rgba(56,139,253,0.4); }
.vp-verdict-badge.exit         { background: rgba(242,54,69,0.18);   color: #f23645;  border: 1px solid rgba(242,54,69,0.4); }
.vp-verdict-badge.partial-exit { background: rgba(246,173,85,0.15);  color: #f6ad55;  border: 1px solid rgba(246,173,85,0.4); }
.vp-verdict-badge.move-sl      { background: rgba(168,85,247,0.15);  color: #a855f7;  border: 1px solid rgba(168,85,247,0.4); }
.vp-verdict-badge.add          { background: rgba(8,153,129,0.18);   color: #089981;  border: 1px solid rgba(8,153,129,0.4); }

.vp-confidence {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 3px 8px;
    border-radius: 4px;
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--border-color);
}
.vp-confidence.high     { color: #089981; border-color: rgba(8,153,129,0.35); }
.vp-confidence.moderate { color: #f6ad55; border-color: rgba(246,173,85,0.35); }
.vp-confidence.low      { color: var(--text-muted); }

.vp-price-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-left: auto;
}
.vp-price-group:first-of-type { margin-left: 12px; }
.vp-price-label {
    font-size: 9px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.vp-live-price {
    font-size: 14px;
    font-weight: 800;
    color: var(--text-main);
}
.vp-pnl {
    font-size: 14px;
    font-weight: 800;
}
.vp-pnl.profit { color: var(--buy-color); }
.vp-pnl.loss   { color: var(--sell-color); }

/* Alerts */
.vp-alerts {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* Section header with TF buttons */
.vp-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.vp-chart-tf-btns {
    display: flex;
    gap: 4px;
}
.vp-tf-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 2px 10px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
}
.vp-tf-btn:hover, .vp-tf-btn.active {
    background: rgba(56,139,253,0.15);
    border-color: #58a6ff;
    color: #58a6ff;
}

/* Chart container */
.vp-chart {
    height: 260px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    background: #0d1117;
}
.vp-chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 6px;
    font-size: 10px;
}
.vp-legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--text-muted);
}
.vp-legend-dot {
    width: 10px;
    height: 3px;
    border-radius: 2px;
    flex-shrink: 0;
}

/* Two-column layout */
.vp-two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* Text blocks */
.vp-text-block {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.65;
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--border-color);
    border-radius: 7px;
    padding: 10px 12px;
}
.vp-text-block.highlight {
    background: rgba(8,153,129,0.05);
    border-color: rgba(8,153,129,0.2);
    color: var(--text-main);
}

/* Scenario analysis */
.vp-scenarios {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.vp-scenario {
    border-radius: 8px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.vp-scenario.bull {
    background: rgba(8,153,129,0.06);
    border: 1px solid rgba(8,153,129,0.2);
}
.vp-scenario.bear {
    background: rgba(242,54,69,0.06);
    border: 1px solid rgba(242,54,69,0.2);
}
.vp-scenario-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}
.vp-scenario-text {
    font-size: 12px;
    color: var(--text-main);
    line-height: 1.6;
}

/* Sections */
.vp-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.vp-section-label {
    font-size: 10px;
    font-weight: 700;
    color: #58a6ff;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.vp-explanation {
    font-size: 13px;
    color: var(--text-main);
    line-height: 1.7;
    background: rgba(56,139,253,0.05);
    border: 1px solid rgba(56,139,253,0.15);
    border-radius: 8px;
    padding: 12px 14px;
}
.vp-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.vp-action-item {
    font-size: 12px;
    color: var(--text-main);
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 7px 10px;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border-color);
    border-radius: 6px;
}
.vp-action-item::before {
    content: '→';
    color: #58a6ff;
    flex-shrink: 0;
    font-weight: 700;
}
.vp-risk-note {
    font-size: 12px;
    color: #f6ad55;
    background: rgba(246,173,85,0.07);
    border: 1px solid rgba(246,173,85,0.25);
    border-radius: 8px;
    padding: 10px 14px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}
.vp-risk-note::before { content: '⚠'; flex-shrink: 0; }

/* Levels grid */
.vp-levels-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}
.vp-level-item {
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border-color);
    border-radius: 7px;
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.vp-level-label {
    font-size: 9px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.vp-level-val {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-main);
}
.vp-level-val.sl  { color: #f23645; }
.vp-level-val.tp  { color: #089981; }
.vp-level-val.entry { color: #58a6ff; }

/* Footer */
.verdict-popup-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
    background: rgba(22,27,34,0.6);
}
.vp-footer-note {
    font-size: 10px;
    color: var(--text-muted);
    opacity: 0.6;
}
.vp-close-btn {
    background: rgba(56,139,253,0.15);
    border: 1px solid rgba(56,139,253,0.4);
    color: #58a6ff;
    padding: 6px 20px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
}
.vp-close-btn:hover { background: rgba(56,139,253,0.28); color: #fff; }

/* ── Senior Analyst popup additions ─────────────────────────────────── */
.vp-live-status {
    width: 100%;
    padding: 12px 18px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.03em;
    border-radius: 8px;
    margin-bottom: 14px;
    text-align: center;
}
.vp-live-status.coiling   { background: rgba(8,153,129,0.18);  color: #089981; border: 1px solid rgba(8,153,129,0.35); }
.vp-live-status.tension   { background: rgba(246,173,85,0.15); color: #f6ad55; border: 1px solid rgba(246,173,85,0.35); }
.vp-live-status.breakdown { background: rgba(242,54,69,0.18);  color: #f23645; border: 1px solid rgba(242,54,69,0.35); }
.vp-live-status.breakout  { background: rgba(56,139,253,0.18); color: #58a6ff; border: 1px solid rgba(56,139,253,0.35); }

.vp-numbered-section {
    border-left: 2px solid rgba(56,139,253,0.25);
    padding-left: 14px;
}
.vp-math-reality {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}
.vp-math-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    padding: 6px 10px;
    background: rgba(255,255,255,0.03);
    border-radius: 6px;
}
.vp-math-label {
    font-size: 11px;
    color: var(--text-muted);
    flex-shrink: 0;
}
.vp-math-val {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-main);
    text-align: right;
}
.vp-math-val.warn { color: #f6ad55; }
.vp-math-val.go   { color: #089981; }

.vp-action-section { margin-top: 4px; }
.vp-action-type-badge {
    display: inline-block;
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 10px;
}
.vp-action-type-badge.action-hold       { background: rgba(56,139,253,0.18);  color: #58a6ff;  border: 1px solid rgba(56,139,253,0.4); }
.vp-action-type-badge.action-free-roll  { background: rgba(8,153,129,0.18);   color: #089981;  border: 1px solid rgba(8,153,129,0.4); }
.vp-action-type-badge.action-cut-ties   { background: rgba(242,54,69,0.18);   color: #f23645;  border: 1px solid rgba(242,54,69,0.4); }
.vp-action-type-badge.action-breakout   { background: rgba(168,85,247,0.15);  color: #a855f7;  border: 1px solid rgba(168,85,247,0.4); }

.vp-action-required {
    font-size: 13px;
    font-style: italic;
    color: var(--text-main);
    line-height: 1.6;
    padding: 10px 14px;
    background: rgba(255,255,255,0.04);
    border-radius: 7px;
    border-left: 3px solid rgba(56,139,253,0.4);
}


/* Active Trades section */
.active-trades-section {
  margin-top: 12px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  backdrop-filter: blur(6px);
}
.ats-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  font-size: 13px;
  color: var(--text-strong);
}
.ats-header-right {
  display: flex;
  align-items: center;
  gap: 6px;
}
.ats-count {
  background: var(--accent-blue);
  color: #fff;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
}
.ats-refresh-btn {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  border-radius: 4px;
  padding: 1px 5px;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  transition: color 0.2s;
}
.ats-refresh-btn:hover {
  color: var(--text-primary);
}
#active-trades-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}
.ats-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 6px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-color);
  white-space: nowrap;
  overflow: hidden;
  min-width: 0;
  font-size: 12px;
  color: var(--text-muted);
}
.ats-symbol {
  font-weight: 800;
  color: var(--text-strong);
  min-width: 55px;
  font-size: 1em;
}
.ats-pill {
  padding: 1px 5px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 0.9em;
  white-space: nowrap;
  flex-shrink: 0;
}
.ats-pill.buy { background: rgba(34,197,94,0.15); color: #22c55e; }
.ats-pill.sell { background: rgba(239,68,68,0.15); color: #ef4444; }
.ats-field {
  flex-shrink: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ats-label {
  color: var(--text-faint);
  font-weight: 600;
  margin-right: 4px;
}
.ats-pnl {
  font-weight: 800;
  flex-shrink: 0;
}
.ats-pnl.positive { color: #22c55e; }
.ats-pnl.negative { color: #ef4444; }
.ats-empty {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
  padding: 4px 0;
  text-align: center;
}
.ats-close-btn {
  margin-left: auto;
  flex-shrink: 0;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(239,68,68,0.15);
  border: 1px solid rgba(239,68,68,0.35);
  color: #ef4444;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  line-height: 1;
  transition: all 0.15s;
}
.ats-close-btn:hover:not(:disabled) {
  background: rgba(239,68,68,0.3);
  border-color: #ef4444;
}
.ats-close-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.ats-row-closed {
  opacity: 0.5;
}

/* ── Manual Buy Modal ───────────────────────────────────────────────── */
.buy-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex; align-items: center; justify-content: center;
}
.buy-modal-overlay.hidden { display: none; }
.buy-modal {
  background: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  width: 320px;
  max-width: 95vw;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  overflow: hidden;
}
.buy-modal-header {
  position: relative;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border-color);
  background: rgba(255,255,255,0.03);
}
.buy-modal-title-row {
  display: flex; align-items: center; gap: 8px; margin-bottom: 4px;
}
.buy-modal-symbol {
  font-weight: 800; font-size: 16px; color: var(--text-strong);
}
.buy-modal-dir-badge {
  padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 700;
}
.buy-modal-dir-badge.buy  { background: rgba(34,197,94,0.18);  color: #22c55e; }
.buy-modal-dir-badge.sell { background: rgba(239,68,68,0.18);  color: #ef4444; }
.buy-modal-conf {
  margin-left: auto; font-size: 12px; font-weight: 700; color: var(--accent-blue);
}
.buy-modal-reason {
  font-size: 11px; color: var(--text-muted); font-style: italic;
}
.buy-modal-close {
  position: absolute; top: 10px; right: 12px;
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 16px; line-height: 1;
}
.buy-modal-close:hover { color: var(--text-primary); }

.buy-modal-body {
  padding: 14px 16px;
  display: flex; flex-direction: column; gap: 10px;
}
.buy-field-label {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 11px; font-weight: 600; color: var(--text-muted);
}
.buy-field-input {
  background: rgba(255,255,255,0.06); border: 1px solid var(--border-color);
  border-radius: 6px; padding: 6px 8px;
  font-size: 13px; color: var(--text-primary);
  outline: none; width: 100%;
  box-sizing: border-box;
}
.buy-field-input:focus { border-color: var(--accent-blue); }

.buy-order-type-toggle {
  display: flex; gap: 0;
  border: 1px solid var(--border-color); border-radius: 6px; overflow: hidden;
}
.buy-type-btn {
  flex: 1; padding: 5px 0; border: none; background: none;
  font-size: 12px; font-weight: 600; color: var(--text-muted); cursor: pointer;
  transition: all 0.15s;
}
.buy-type-btn.active {
  background: var(--accent-blue); color: #fff;
}
.buy-leverage-row {
  display: flex; align-items: center; gap: 6px;
}
.buy-leverage-input { width: 80px !important; }
.buy-leverage-x { font-size: 14px; font-weight: 700; color: var(--text-muted); }

.buy-modal-footer {
  padding: 10px 16px 14px;
  border-top: 1px solid var(--border-color);
  display: flex; flex-direction: column; gap: 8px;
}
.buy-modal-status { font-size: 11px; text-align: center; min-height: 16px; }
.buy-modal-status.success { color: #22c55e; }
.buy-modal-status.error   { color: #ef4444; }
.buy-modal-actions { display: flex; gap: 8px; }
.buy-btn-cancel {
  flex: 1; padding: 8px 0; border-radius: 8px;
  background: rgba(255,255,255,0.06); border: 1px solid var(--border-color);
  color: var(--text-muted); cursor: pointer; font-size: 12px; font-weight: 600;
  transition: all 0.15s;
}
.buy-btn-cancel:hover {
  background: rgba(255,255,255,0.1);
}
.buy-btn-submit {
  flex: 2; padding: 8px 0; border-radius: 8px;
  background: linear-gradient(135deg, #089981, #0ea674);
  border: none; color: #fff; cursor: pointer;
  font-size: 13px; font-weight: 700;
  transition: opacity 0.2s;
}
.buy-btn-submit:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Trade Futures Modal (CoinDCX-style) ─────────────────────────────────── */
.buy-modal-overlay { z-index: 2100; }
.futures-trade-modal {
  background: #131722;
  border: 1px solid rgba(48,54,61,0.8);
  border-radius: 12px;
  width: 360px;
  max-width: 96vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 60px rgba(0,0,0,0.7);
  display: flex;
  flex-direction: column;
}
.ftm-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 10px;
  border-bottom: 1px solid rgba(48,54,61,0.5);
}
.ftm-title-row { display: flex; align-items: center; gap: 10px; }
.ftm-section-title {
  font-size: 15px; font-weight: 800; color: #c9d1d9;
}
.ftm-symbol {
  font-size: 13px; font-weight: 600; color: #58a6ff;
  background: rgba(56,139,253,0.12); border-radius: 4px; padding: 2px 7px;
}
.ftm-close-btn {
  background: none; border: none; color: #6b7280; font-size: 16px;
  cursor: pointer; transition: color 0.15s; line-height: 1;
}
.ftm-close-btn:hover { color: #c9d1d9; }

/* Long / Short tabs */
.ftm-dir-tabs {
  display: grid; grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid rgba(48,54,61,0.5);
}
.ftm-dir-tab {
  padding: 10px; font-size: 14px; font-weight: 700;
  border: none; background: rgba(255,255,255,0.03); cursor: pointer;
  color: #6b7280; transition: all 0.15s;
}
.ftm-long-tab.active  { background: rgba(8,153,129,0.15); color: #089981; border-bottom: 2px solid #089981; }
.ftm-short-tab.active { background: rgba(242,54,69,0.15);  color: #f23645; border-bottom: 2px solid #f23645; }

.ftm-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }

/* Exchange row */
.ftm-row { display: flex; align-items: center; gap: 8px; }
.ftm-exchange-row { justify-content: space-between; }
.ftm-label { font-size: 11px; color: #6b7280; font-weight: 600; white-space: nowrap; }
.ftm-select {
  flex: 1; background: rgba(255,255,255,0.05); border: 1px solid rgba(48,54,61,0.8);
  border-radius: 6px; padding: 6px 8px; color: #c9d1d9; font-size: 12px;
  cursor: pointer; outline: none;
}
.ftm-select:focus { border-color: #089981; }

/* Order type buttons */
.ftm-order-type-row {
  display: flex; gap: 0;
  background: rgba(255,255,255,0.04); border-radius: 6px; overflow: hidden;
  border: 1px solid rgba(48,54,61,0.6);
}
.ftm-ot-btn {
  flex: 1; padding: 6px 4px; border: none; background: none;
  font-size: 11px; font-weight: 600; color: #6b7280; cursor: pointer;
  transition: all 0.15s;
}
.ftm-ot-btn.active { background: rgba(255,255,255,0.08); color: #c9d1d9; }
.ftm-ot-btn:hover:not(.active) { color: #a8b3cf; }

/* Input fields */
.ftm-field-row { display: flex; flex-direction: column; gap: 4px; }
.ftm-input-wrap {
  position: relative; display: flex; align-items: center;
}
.ftm-input {
  width: 100%; background: rgba(255,255,255,0.05); border: 1px solid rgba(48,54,61,0.8);
  border-radius: 6px; padding: 8px 48px 8px 10px; color: #c9d1d9; font-size: 13px;
  outline: none; box-sizing: border-box;
}
.ftm-input:focus { border-color: #089981; }
.ftm-input-suffix {
  position: absolute; right: 36px; font-size: 11px; color: #6b7280;
  pointer-events: none;
}
.ftm-input-steppers {
  position: absolute; right: 0; display: flex; flex-direction: column;
  height: 100%;
}
.ftm-stepper {
  flex: 1; width: 28px; border: none;
  background: rgba(255,255,255,0.05); color: #6b7280; cursor: pointer;
  font-size: 13px; display: flex; align-items: center; justify-content: center;
  transition: background 0.12s;
}
.ftm-stepper:first-child { border-radius: 0 6px 0 0; }
.ftm-stepper:last-child  { border-radius: 0 0 6px 0; }
.ftm-stepper:hover { background: rgba(255,255,255,0.1); color: #c9d1d9; }

/* Leverage */
.ftm-leverage-wrap { display: flex; align-items: center; gap: 6px; flex: 1; }
.ftm-leverage-input {
  width: 62px; background: rgba(255,255,255,0.05); border: 1px solid rgba(48,54,61,0.8);
  border-radius: 6px; padding: 6px 8px; color: #c9d1d9; font-size: 13px;
  text-align: center; outline: none;
}
.ftm-leverage-input:focus { border-color: #089981; }
.ftm-lev-presets { display: flex; gap: 4px; flex-wrap: wrap; }
.ftm-lev-preset {
  padding: 4px 8px; border-radius: 5px; font-size: 11px; font-weight: 700;
  background: rgba(255,255,255,0.05); border: 1px solid rgba(48,54,61,0.6);
  color: #6b7280; cursor: pointer; transition: all 0.15s;
}
.ftm-lev-preset:hover, .ftm-lev-preset.active {
  background: rgba(8,153,129,0.15); border-color: rgba(8,153,129,0.4); color: #089981;
}

/* Qty hint */
.ftm-qty-hint { font-size: 10px; color: #6b7280; margin-top: 2px; }

/* Slider */
.ftm-slider-row { display: flex; flex-direction: column; gap: 4px; }
.ftm-slider {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 4px; border-radius: 2px;
  background: linear-gradient(to right, #089981 0%, #089981 0%, rgba(255,255,255,0.12) 0%);
  outline: none; cursor: pointer;
}
.ftm-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 16px; height: 16px; border-radius: 50%;
  background: #089981; cursor: pointer;
  border: 2px solid #131722;
  box-shadow: 0 0 0 2px rgba(8,153,129,0.4);
  transition: box-shadow 0.15s;
}
.ftm-slider::-webkit-slider-thumb:hover {
  box-shadow: 0 0 0 4px rgba(8,153,129,0.3);
}
.ftm-slider-labels {
  display: flex; justify-content: space-between;
  font-size: 9px; color: #6b7280; padding: 0 2px;
}

/* Info row */
.ftm-info-row {
  display: flex; gap: 4px; flex-wrap: wrap;
  padding: 8px 10px; background: rgba(255,255,255,0.03);
  border-radius: 7px; border: 1px solid rgba(48,54,61,0.4);
}
.ftm-info-item {
  flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 80px;
}
.ftm-info-label { font-size: 9px; color: #6b7280; text-transform: uppercase; letter-spacing: 0.05em; }
.ftm-info-val { font-size: 12px; font-weight: 600; color: #c9d1d9; }
.ftm-add-balance-btn {
  background: none; border: none; color: #089981; font-size: 13px;
  cursor: pointer; padding: 0; line-height: 1; margin-top: 2px;
}
.ftm-add-balance-btn:hover { color: #0ea674; }

/* TP/SL section */
.ftm-tpsl-section {
  border: 1px solid rgba(48,54,61,0.4); border-radius: 7px; overflow: hidden;
}
.ftm-tpsl-toggle {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px; background: rgba(255,255,255,0.03);
  border: none; cursor: pointer; color: #6b7280; font-size: 12px; font-weight: 600;
  transition: background 0.15s;
}
.ftm-tpsl-toggle:hover { background: rgba(255,255,255,0.05); color: #c9d1d9; }
.ftm-tpsl-arrow { font-size: 10px; transition: transform 0.2s; }
.ftm-tpsl-arrow.open { transform: rotate(180deg); }
.ftm-tpsl-body { padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }

/* Status */
.ftm-status {
  font-size: 11px; text-align: center; min-height: 16px; padding: 2px 0;
}
.ftm-status.success { color: #089981; }
.ftm-status.error   { color: #f23645; }

/* Action button */
.ftm-action-btn {
  width: 100%; padding: 12px; border-radius: 8px; border: none;
  font-size: 14px; font-weight: 800; cursor: pointer; transition: all 0.15s;
  letter-spacing: 0.02em;
}
.ftm-action-long  { background: #089981; color: #fff; }
.ftm-action-long:hover  { background: #0ea674; }
.ftm-action-short { background: #f23645; color: #fff; }
.ftm-action-short:hover { background: #e82b3e; }
.ftm-action-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.ftm-cancel-link {
  width: 100%; padding: 8px; background: none; border: none;
  color: #6b7280; font-size: 12px; cursor: pointer; transition: color 0.15s;
  text-align: center;
}
.ftm-cancel-link:hover { color: #c9d1d9; }

/* Scalp button in signal details footer */
.btn-scalp-signal {
  background: rgba(247,147,26,0.15); border: 1px solid rgba(247,147,26,0.35);
  color: #f7931a; font-size: 12px; font-weight: 700; cursor: pointer;
  padding: 6px 12px; border-radius: 8px; transition: all 0.15s;
}
.btn-scalp-signal:hover {
  background: rgba(247,147,26,0.3); border-color: #f7931a;
}
.btn-scalp-signal:disabled {
  opacity: 0.5; cursor: not-allowed;
}
.btn-scalp-signal.sd-scalp-ok {
  background: rgba(34,197,94,0.3); border-color: #22c55e; color: #22c55e;
}
.btn-scalp-signal.sd-scalp-err {
  background: rgba(239,68,68,0.3); border-color: #ef4444; color: #ef4444;
}

/* Buy button in signal details footer */
.btn-buy-signal {
  background: rgba(8,153,129,0.15); border: 1px solid rgba(8,153,129,0.35);
  color: #089981; font-size: 12px; font-weight: 700; cursor: pointer;
  padding: 6px 12px; border-radius: 8px; transition: all 0.15s;
}
.btn-buy-signal:hover {
  background: rgba(8,153,129,0.3); border-color: #089981;
}
.btn-buy-signal:disabled {
  opacity: 0.5; cursor: not-allowed;
}

/* ── System Health Monitor ───────────────────────────────────────────────── */
.health-monitor-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  padding: 4px 8px;
  margin-left: 8px;
  transition: all 0.2s;
  border-radius: 6px;
}
.health-monitor-btn:hover {
  background: rgba(255,255,255,0.08);
}

.health-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.health-modal-overlay.hidden {
  display: none;
}

.health-modal {
  background: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  width: 420px;
  max-width: 95vw;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.health-modal-header {
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border-color);
  background: rgba(255,255,255,0.03);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.health-modal-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-strong, #c9d1d9);
}
.health-modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1;
}
.health-modal-close:hover {
  color: var(--text-primary, #c9d1d9);
}

.health-modal-body {
  padding: 14px 0;
  flex: 1;
  overflow-y: auto;
}

.health-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.health-table thead {
  position: sticky;
  top: 0;
  background: rgba(255,255,255,0.04);
  border-bottom: 1px solid var(--border-color);
}
.health-table th {
  padding: 10px 16px;
  text-align: left;
  font-weight: 600;
  color: var(--text-muted);
  border-right: 1px solid var(--border-color);
}
.health-table th:last-child {
  border-right: none;
}
.health-table tbody tr {
  border-bottom: 1px solid var(--border-color);
}
.health-table tbody tr:last-child {
  border-bottom: none;
}
.health-table td {
  padding: 10px 16px;
  color: var(--text-primary, #c9d1d9);
  border-right: 1px solid var(--border-color);
}
.health-table td:last-child {
  border-right: none;
}

.health-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 600;
}
.health-status-connected {
  background: rgba(34,197,94,0.18);
  color: #22c55e;
}
.health-status-error {
  background: rgba(239,68,68,0.18);
  color: #ef4444;
}

.health-latency {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.health-latency-fast {
  color: #22c55e;
}
.health-latency-medium {
  color: #f59e0b;
}
.health-latency-slow {
  color: #ef4444;
}

.health-auth-badge {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-align: center;
}
.health-auth-valid {
  background: rgba(34,197,94,0.18);
  color: #22c55e;
}
.health-auth-invalid {
  background: rgba(239,68,68,0.18);
  color: #ef4444;
}

.health-modal-footer {
  padding: 10px 16px 14px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.health-modal-timestamp {
  font-size: 11px;
  color: var(--text-muted);
}
.health-modal-refresh {
  padding: 6px 10px;
  border-radius: 6px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  transition: all 0.15s;
}
.health-modal-refresh:hover {
  background: rgba(255,255,255,0.1);
  color: var(--text-primary, #c9d1d9);
}
.health-modal-refresh:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ── Institutional-Grade Live Positions Dashboard ──────────────────────────── */
.active-trades-section {
  margin-top: 16px;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background: var(--panel-bg);
  overflow: hidden;
}

.ats-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  background: rgba(255,255,255,0.03);
}

.ats-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-strong, #c9d1d9);
}

.ats-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ats-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  background: var(--accent-blue);
  color: #fff;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
}

.ats-refresh-btn {
  padding: 5px 8px;
  border-radius: 6px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  transition: all 0.15s;
}

.ats-refresh-btn:hover {
  background: rgba(255,255,255,0.1);
  color: var(--text-primary, #c9d1d9);
}

.ats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px;
  padding: 12px;
  max-height: 600px;
  overflow-y: auto;
}

.ats-card {
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12px;
  transition: all 0.2s;
}

.ats-card:hover {
  background: rgba(255,255,255,0.04);
  border-color: var(--border-color, rgba(48,54,61,0.8));
}

.ats-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ats-card-symbol {
  font-weight: 700;
  font-size: 13px;
  color: var(--text-strong, #c9d1d9);
}

.ats-card-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}

.ats-badge-long {
  background: rgba(34,197,94,0.2);
  color: #22c55e;
}

.ats-badge-short {
  background: rgba(239,68,68,0.2);
  color: #ef4444;
}

.ats-card-age {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  background: rgba(100,116,139,0.3);
  border-radius: 4px;
  color: var(--text-muted);
  font-size: 10px;
}

.ats-card-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}

.ats-card-label {
  color: var(--text-muted);
  font-weight: 500;
}

.ats-card-value {
  color: var(--text-primary, #c9d1d9);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* Price journey progress bar */
.ats-price-journey {
  margin: 6px 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ats-price-journey-label {
  font-size: 10px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
}

.ats-price-journey-bar {
  height: 18px;
  background: linear-gradient(90deg, rgba(239,68,68,0.2), rgba(59,130,246,0.2), rgba(34,197,94,0.2));
  border: 1px solid var(--border-color);
  border-radius: 3px;
  position: relative;
  overflow: hidden;
}

.ats-price-journey-marker {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
}

.ats-price-journey-sl {
  background: #ef4444;
  left: 0%;
}

.ats-price-journey-tp1 {
  background: #22c55e;
}

.ats-price-journey-tp2 {
  background: #3b82f6;
  opacity: 0.7;
}

.ats-price-journey-tp3 {
  background: #8b5cf6;
  opacity: 0.5;
}

.ats-price-journey-current {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 3px;
  background: #f59e0b;
  box-shadow: 0 0 4px rgba(245,158,11,0.6);
}

/* Risk & Margin display */
.ats-risk-margin {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 6px;
  background: rgba(0,0,0,0.2);
  border-radius: 4px;
  font-size: 11px;
}

.ats-risk-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ats-risk-label {
  color: var(--text-muted);
  font-weight: 500;
}

.ats-risk-value {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.ats-risk-danger {
  color: #ef4444;
}

.ats-risk-warning {
  color: #f59e0b;
}

.ats-risk-safe {
  color: #22c55e;
}

/* P&L with pulse animation */
.ats-card-pnl {
  padding: 6px;
  border-radius: 4px;
  text-align: center;
  font-weight: 700;
  background: rgba(0,0,0,0.2);
  transition: all 0.3s ease;
}

.ats-pnl-positive {
  background: rgba(34,197,94,0.15);
  color: #22c55e;
}

.ats-pnl-negative {
  background: rgba(239,68,68,0.15);
  color: #ef4444;
}

.ats-pnl-pulse {
  animation: pnl-pulse 0.6s ease-out;
}

@keyframes pnl-pulse {
  0% {
    transform: scale(1);
    background: rgba(34,197,94,0.3);
  }
  50% {
    transform: scale(1.02);
    background: rgba(34,197,94,0.5);
  }
  100% {
    transform: scale(1);
    background: rgba(34,197,94,0.15);
  }
}

/* Action buttons */
.ats-card-actions {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

.ats-btn {
  flex: 1;
  padding: 5px 8px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  background: rgba(255,255,255,0.04);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  transition: all 0.15s;
  white-space: nowrap;
}

.ats-btn:hover:not(:disabled) {
  background: rgba(255,255,255,0.08);
  color: var(--text-primary, #c9d1d9);
  border-color: var(--accent-blue);
}

.ats-btn-be {
  background: rgba(139,92,246,0.15);
  color: #8b5cf6;
  border-color: #8b5cf6;
}

.ats-btn-be:hover:not(:disabled) {
  background: rgba(139,92,246,0.25);
}

.ats-btn-close {
  background: rgba(239,68,68,0.15);
  color: #ef4444;
  border-color: #ef4444;
}

.ats-btn-close:hover:not(:disabled) {
  background: rgba(239,68,68,0.25);
}

.ats-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ats-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   UI/UX OVERHAUL: Global Sentinel, Controls, Live Positions, Quick Chart
   ═════════════════════════════════════════════════════════════════════════*/

/* ── Body layout adjustment ───────────────────────────────────────────────── */
body {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.dashboard-container {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

/* ── Global Sentinel Top Bar (heartbeat monitor) ──────────────────────────── */
.global-sentinel-topbar {
  height: 36px;
  background: rgba(9, 11, 17, 0.95);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid rgba(48,54,61,0.4);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 14px;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.4px;
  color: var(--text-main);
}

.gst-heartbeat-svg {
  position: absolute;
  left: 0;
  top: 0;
  width: 200px;
  height: 100%;
  opacity: 0.15;
  pointer-events: none;
}

.sentinel-ok {
  color: #4ade80 !important;
  border-bottom: 2px solid rgba(74,222,128,0.3);
}

.sentinel-warn {
  color: #e3b341 !important;
  border-bottom: 2px solid rgba(227,179,65,0.3);
}

.sentinel-paused {
  color: #f23645 !important;
  border-bottom: 2px solid rgba(242,54,69,0.5);
  animation: sentinel-flash 1s ease-in-out infinite;
}

@keyframes sentinel-flash {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ── Global Controls Bar ──────────────────────────────────────────────────── */
.global-controls-bar {
  height: 48px;
  background: rgba(13,17,23,0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(48,54,61,0.5);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  flex-shrink: 0;
  overflow-x: auto;
}

.gc-brand {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-right: 16px;
  white-space: nowrap;
  flex-shrink: 0;
}

.gc-logo {
  font-size: 16px;
  line-height: 1;
}

.gc-title {
  font-weight: 700;
  font-size: 13px;
  color: var(--text-main);
}

.gc-version {
  font-size: 9px;
  color: var(--text-muted);
  margin-left: 4px;
}

.gc-ws-status {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  border-right: 1px solid var(--border-color);
  flex-shrink: 0;
  white-space: nowrap;
}

.gc-ws-status .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4ade80;
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

#global-controls-bar select,
#global-controls-bar button {
  font-size: 11px;
  padding: 4px 8px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}

#global-controls-bar select:hover,
#global-controls-bar button:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.2);
}

/* ── Top-bar Exchange Balance Widget ─────────────────────────────────────── */
.topbar-balance-widget {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-left: 6px;
  padding: 3px 8px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
}
.topbar-exchange-select {
  background: rgba(13,17,23,0.85);
  color: #94a3b8;
  border: 1px solid rgba(71,85,105,0.5);
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  cursor: pointer;
  outline: none;
  height: 24px;
}
.topbar-exchange-select:focus { border-color: #475569; }
.topbar-balance-display {
  font-size: 13px;
  font-weight: 700;
  color: #38bdf8;
  min-width: 80px;
  text-align: right;
  white-space: nowrap;
  letter-spacing: 0.02em;
}
.topbar-balance-display.loading { color: #64748b; }
.topbar-balance-display.error   { color: #f59e0b; }
.topbar-balance-refresh {
  background: transparent;
  border: none;
  color: #475569;
  font-size: 13px;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
  transition: color 0.15s, transform 0.3s;
}
.topbar-balance-refresh:hover { color: #7dd3fc; }
.topbar-balance-refresh.spinning { animation: wallet-spin 0.7s linear infinite; }

/* ── Center Main Panel (Live Positions + Chart) ───────────────────────────── */
.center-main-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

/* ── Live Positions Main Panel (takes full center height — chart is now a modal) ── */
.live-positions-main {
  flex: 1;
  height: auto;
  max-height: none;
  min-height: 180px;
  flex-shrink: 1;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: rgba(13, 17, 23, 0.88);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.lpm-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(48,54,61,0.4);
  flex-shrink: 0;
  gap: 12px;
}

.lpm-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.lpm-dot-live {
  color: #4ade80;
  font-size: 12px;
  animation: lpm-pulse 2s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes lpm-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.lpm-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
}

.lpm-count {
  font-size: 10px;
  color: var(--text-muted);
  padding: 2px 6px;
  background: rgba(255,255,255,0.05);
  border-radius: 3px;
}

.lpm-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.lps-refresh-btn {
  font-size: 10px;
  padding: 4px 8px;
  background: rgba(255,255,255,0.07);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.15s;
}

.lps-refresh-btn:hover {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.15);
}

.lpm-col-headers {
  display: grid;
  grid-template-columns: 110px 55px 100px 100px 1fr 90px 100px;
  gap: 8px;
  padding: 4px 14px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  border-bottom: 1px solid rgba(48,54,61,0.3);
  flex-shrink: 0;
  background: rgba(0,0,0,0.2);
}
/* CoinDCX-style 11-column header override */
.lpm-col-headers-dcx {
  grid-template-columns: 130px 68px 80px 80px 90px 62px 90px 90px 90px 90px 110px;
  gap: 4px;
  overflow-x: auto;
  min-width: max-content;
  padding: 6px 10px;
  border-top: 1px solid rgba(48,54,61,0.3);
}
.lpm-col { white-space: nowrap; font-size: 9px; }
.lpm-col-name  { min-width: 130px; }
.lpm-col-lev   { min-width: 68px; }
.lpm-col-margin { min-width: 80px; }
.lpm-col-size  { min-width: 80px; }
.lpm-col-pnl   { min-width: 90px; }
.lpm-col-roe   { min-width: 62px; }
.lpm-col-entry { min-width: 90px; }
.lpm-col-mark  { min-width: 90px; }
.lpm-col-liq   { min-width: 90px; }
.lpm-col-tpsl  { min-width: 90px; }
.lpm-col-close { min-width: 110px; }

/* CoinDCX-style Tab Row */
.lpm-tab-row {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 10px;
  border-bottom: 1px solid rgba(48,54,61,0.4);
  background: rgba(0,0,0,0.15);
  flex-shrink: 0;
  overflow-x: auto;
}
.lpm-tab {
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 4px;
}
.lpm-tab.active {
  color: var(--text-strong, #c9d1d9);
  border-bottom-color: #089981;
}
.lpm-tab:hover:not(.active) { color: var(--text-primary, #c9d1d9); }
.lpm-tab-badge {
  background: rgba(239,68,68,0.2);
  color: #ef4444;
  border-radius: 4px;
  padding: 0 5px;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  text-align: center;
}
.lpm-hide-toggle {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  padding: 6px 8px;
}
.lpm-hide-toggle input { cursor: pointer; }
.lpm-close-all-btn {
  padding: 4px 10px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(239,68,68,0.12);
  border: 1px solid rgba(239,68,68,0.3);
  color: #ef4444;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  margin-left: 6px;
}
.lpm-close-all-btn:hover { background: rgba(239,68,68,0.22); }

/* CoinDCX-style position row */
.lps-dcx-row {
  display: grid;
  grid-template-columns: 130px 68px 80px 80px 90px 62px 90px 90px 90px 90px 110px;
  gap: 4px;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(48,54,61,0.25);
  font-size: 12px;
  align-items: center;
  overflow-x: auto;
  min-width: max-content;
  transition: background 0.12s;
}
.lps-dcx-row:hover { background: rgba(255,255,255,0.025); }
.lps-dcx-name {
  display: flex; flex-direction: column; gap: 2px;
}
.lps-dcx-symbol {
  font-weight: 700; font-size: 13px; color: var(--text-strong, #c9d1d9);
}
.lps-dcx-side-long  { font-size: 10px; color: #089981; font-weight: 700; }
.lps-dcx-side-short { font-size: 10px; color: #f23645; font-weight: 700; }
.exchange-badge-kucoin  {
  display: inline-block; padding: 1px 5px; border-radius: 4px; font-size: 9px; font-weight: 700;
  background: rgba(0,188,135,0.15); color: #00bc87; border: 1px solid rgba(0,188,135,0.3);
}
.exchange-badge-coindcx {
  display: inline-block; padding: 1px 5px; border-radius: 4px; font-size: 9px; font-weight: 700;
  background: rgba(41,98,255,0.15); color: #2962ff; border: 1px solid rgba(41,98,255,0.3);
}
.lps-dcx-lev {
  font-size: 11px; color: var(--text-muted);
  display: flex; align-items: center; gap: 3px;
}
.lps-dcx-val { font-size: 12px; color: var(--text-primary, #c9d1d9); }
.lps-dcx-pnl-neg { font-size: 12px; font-weight: 700; color: #f23645; }
.lps-dcx-pnl-pos { font-size: 12px; font-weight: 700; color: #089981; }
.lps-dcx-roe-neg  { font-size: 11px; color: #f23645; }
.lps-dcx-roe-pos  { font-size: 11px; color: #089981; }
.lps-dcx-tpsl { font-size: 11px; color: var(--text-muted); }
.lps-dcx-tpsl-tp { color: #089981; font-weight: 600; }
.lps-dcx-tpsl-sl { color: #f23645; font-weight: 600; }
.lps-dcx-actions {
  display: flex; gap: 4px; align-items: center;
}
.lps-dcx-reduce-btn {
  padding: 3px 7px; border-radius: 4px; font-size: 10px; font-weight: 700;
  background: rgba(8,153,129,0.15); border: 1px solid rgba(8,153,129,0.3);
  color: #089981; cursor: pointer; transition: all 0.15s; white-space: nowrap;
}
.lps-dcx-reduce-btn:hover { background: rgba(8,153,129,0.25); }
.lps-dcx-close-btn {
  padding: 3px 7px; border-radius: 4px; font-size: 10px; font-weight: 700;
  background: rgba(239,68,68,0.12); border: 1px solid rgba(239,68,68,0.3);
  color: #ef4444; cursor: pointer; transition: all 0.15s; white-space: nowrap;
}
.lps-dcx-close-btn:hover { background: rgba(239,68,68,0.22); }

#live-pos-rows {
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
  min-height: 0;
  scroll-behavior: smooth;
}

/* Styled scrollbar for live positions */
#live-pos-rows::-webkit-scrollbar {
  width: 5px;
}
#live-pos-rows::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 3px;
}
#live-pos-rows::-webkit-scrollbar-thumb {
  background: rgba(88, 166, 255, 0.25);
  border-radius: 3px;
}
#live-pos-rows::-webkit-scrollbar-thumb:hover {
  background: rgba(88, 166, 255, 0.5);
}

.lpm-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Single scrollable-line row (override older rules) */
.lps-row {
  display: flex !important;
  flex-direction: column;
  gap: 0;
  padding: 0 !important;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: background 0.15s;
  background: transparent !important;
}
.lps-row:hover { background: rgba(255,255,255,0.025) !important; }

/* Enhanced TP progress bar */
.lps-pbar-wrap {
  height: 8px;
  border-radius: 4px;
  background: rgba(255,255,255,0.07);
  position: relative;
  overflow: visible;
}

.lps-pbar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
}

.lps-pbar-fill.long {
  background: linear-gradient(90deg, #089981, #00d4a8);
  box-shadow: 0 0 8px rgba(8,153,129,0.4);
}

.lps-pbar-fill.short {
  background: linear-gradient(90deg, #f23645, #ff6b7a);
  box-shadow: 0 0 8px rgba(242,54,69,0.4);
}

/* ── Glasmorphism Panels Enhanced ─────────────────────────────────────────── */
.glass-panel {
  background: rgba(13, 17, 23, 0.82) !important;
  backdrop-filter: blur(24px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(24px) saturate(180%) !important;
  border: 1px solid rgba(255, 255, 255, 0.06) !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255,255,255,0.04) !important;
}

/* ── Shadow P&L Ghost Glow ────────────────────────────────────────────────── */
.shadow-pnl-item {
  position: relative;
}

.shadow-ghost-icon {
  font-size: 12px;
  opacity: 0.7;
  margin-right: 4px;
}

.shadow-pnl-value {
  position: relative;
  transition: text-shadow 0.3s ease;
}

.shadow-pnl-value.pos {
  text-shadow: 0 0 12px rgba(74, 222, 128, 0.6);
  animation: ghost-glow-green 3s ease-in-out infinite;
}

.shadow-pnl-value.neg {
  text-shadow: 0 0 12px rgba(242, 54, 69, 0.6);
  animation: ghost-glow-red 3s ease-in-out infinite;
}

@keyframes ghost-glow-green {
  0%, 100% {
    text-shadow: 0 0 8px rgba(74,222,128,0.3);
  }
  50% {
    text-shadow: 0 0 20px rgba(74,222,128,0.7), 0 0 4px #4ade80;
  }
}

@keyframes ghost-glow-red {
  0%, 100% {
    text-shadow: 0 0 8px rgba(242,54,69,0.3);
  }
  50% {
    text-shadow: 0 0 20px rgba(242,54,69,0.7), 0 0 4px #f23645;
  }
}

/* ── Console Formatting ───────────────────────────────────────────────────── */
.console-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
  gap: 8px;
}

.console-title {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.btn-clear-console {
  font-size: 9px;
  padding: 3px 8px;
  background: rgba(255,255,255,0.07);
  border: 1px solid var(--border-color);
  border-radius: 3px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-clear-console:hover {
  background: rgba(255,255,255,0.12);
  color: var(--text-main);
}

.debug-console-panel {
  background: rgba(0,0,0,0.45);
  font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
  font-size: 10px;
  color: #8b949e;
  height: 80px;
  overflow-y: auto;
  padding: 6px 10px;
  flex-shrink: 0;
  line-height: 1.4;
}

.console-line-error {
  color: #f23645 !important;
  font-weight: 700;
}

.console-line-signal {
  color: #00ff87 !important;
}

.console-line-warn {
  color: #e3b341 !important;
}

.console-line-info {
  color: #58a6ff !important;
}

/* ── Quick Chart Side Drawer ──────────────────────────────────────────────── */
.qc-drawer {
  position: fixed;
  top: 84px;
  right: 360px;
  width: 420px;
  height: calc(100vh - 84px);
  background: rgba(9, 11, 17, 0.97);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-left: 1px solid rgba(48,54,61,0.6);
  z-index: 250;
  display: flex;
  flex-direction: column;
  transform: translateX(calc(100% + 360px));
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: -8px 0 32px rgba(0,0,0,0.5);
}

.qc-drawer.open {
  transform: translateX(0);
}

.qc-drawer.hidden {
  display: none;
}

.qc-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(48,54,61,0.5);
  flex-shrink: 0;
  gap: 12px;
}

.qc-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.qc-symbol {
  font-size: 15px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  color: #c9d1d9;
  white-space: nowrap;
}

.qc-tf-badge {
  font-size: 10px;
  padding: 2px 6px;
  background: rgba(88,166,255,0.15);
  border: 1px solid rgba(88,166,255,0.3);
  border-radius: 4px;
  color: #58a6ff;
  white-space: nowrap;
  flex-shrink: 0;
}

.qc-close-btn {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: var(--text-muted);
  padding: 4px 8px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.15s;
  flex-shrink: 0;
  line-height: 1;
}

.qc-close-btn:hover {
  background: rgba(242,54,69,0.15);
  color: #f23645;
  border-color: rgba(242,54,69,0.3);
}

.qc-chart-container {
  flex: 1;
  min-height: 0;
  position: relative;
}

.qc-no-data {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  gap: 8px;
  font-size: 13px;
  padding: 20px;
}

.qc-no-data.show {
  display: flex;
}

.qc-no-data-hint {
  font-size: 11px;
  color: var(--text-muted);
  opacity: 0.7;
}

/* ── Quick Chart Button on Signal Cards ───────────────────────────────────── */
.btn-quick-chart {
  font-size: 10px;
  padding: 3px 7px;
  background: rgba(88,166,255,0.1);
  border: 1px solid rgba(88,166,255,0.25);
  border-radius: 4px;
  color: #58a6ff;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-quick-chart:hover {
  background: rgba(88,166,255,0.2);
  border-color: rgba(88,166,255,0.4);
  color: #79c0ff;
}
}

/* Near-TP pulse: row glows green when within 5% of take profit */
@keyframes lps-tp-pulse {
  0%, 100% { box-shadow: none; background: transparent; }
  50% { box-shadow: 0 0 0 1px rgba(38,166,154,0.4) inset; background: rgba(38,166,154,0.06); }
}
.lps-near-tp { animation: lps-tp-pulse 2s ease-in-out infinite; }

/* ── Trade History Ledger ─────────────────────────────────────────── */
.trade-history-section {
    flex-shrink: 0;
    border-top: 1px solid rgba(48,54,61,0.5);
    background: rgba(9,11,17,0.45);
}
.th-header {
    display: flex; align-items: center; gap: 8px;
    padding: 4px 10px;
    border-bottom: 1px solid rgba(48,54,61,0.4);
}
.th-title {
    font-size: 9px; font-weight: 700; color: #475569;
    text-transform: uppercase; letter-spacing: 0.6px;
}
.th-count { font-size: 9px; color: #334155; }
.th-table-wrap { overflow-y: auto; max-height: 130px; overflow-x: auto; }
.th-table {
    width: 100%; border-collapse: collapse; font-size: 10px; min-width: 480px;
}
.th-table thead th {
    position: sticky; top: 0;
    background: rgba(13,17,23,0.97);
    color: #475569; font-weight: 600;
    text-transform: uppercase; font-size: 9px; letter-spacing: 0.4px;
    padding: 3px 8px; text-align: left;
    border-bottom: 1px solid rgba(48,54,61,0.4);
}
.th-table tbody td {
    padding: 4px 8px;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    color: #94a3b8; white-space: nowrap;
}
.th-table tbody tr:last-child td { border-bottom: none; }
.th-table tbody tr:hover td { background: rgba(255,255,255,0.02); }
.th-pnl.profit { color: #26a69a; font-weight: 700; }
.th-pnl.loss   { color: #ef5350; font-weight: 700; }
.th-reason.tp  { color: #26a69a; font-size: 9px; font-weight: 700; padding: 1px 5px; background: rgba(38,166,154,0.12); border-radius: 3px; }
.th-reason.sl  { color: #ef5350; font-size: 9px; font-weight: 700; padding: 1px 5px; background: rgba(239,83,80,0.12); border-radius: 3px; }
.th-dir.long  { color: #26a69a; }
.th-dir.short { color: #ef5350; }
.th-empty { color: #475569; text-align: center; padding: 14px; font-style: italic; }

/* ── Engine 4: Capitulation Wick Scanner ──────────────────────────────────── */
.cap-engine-section {
    margin: 10px 0 4px;
    border: 1px solid rgba(244, 63, 94, 0.35);
    border-radius: 7px;
    overflow: hidden;
    background: rgba(244, 63, 94, 0.04);
}
.cap-engine-header {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 6px 10px;
    background: rgba(244, 63, 94, 0.1);
    border-bottom: 1px solid rgba(244, 63, 94, 0.2);
}
.cap-engine-pulse {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #f43f5e;
    flex-shrink: 0;
    animation: cap-pulse 1.8s ease-in-out infinite;
}
@keyframes cap-pulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(244,63,94,0.6); }
    50%       { opacity: 0.7; box-shadow: 0 0 0 5px rgba(244,63,94,0); }
}
.cap-engine-title {
    font-size: 10px;
    font-weight: 700;
    color: #f43f5e;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    flex: 1;
}
.cap-engine-badge {
    font-size: 9px;
    font-weight: 700;
    color: #f43f5e;
    background: rgba(244,63,94,0.15);
    border: 1px solid rgba(244,63,94,0.3);
    border-radius: 4px;
    padding: 1px 6px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.cap-engine-meta {
    font-size: 10px;
    color: #64748b;
    padding: 4px 10px;
    border-bottom: 1px solid rgba(244,63,94,0.1);
    font-family: 'JetBrains Mono','Fira Code','Courier New',monospace;
}
.cap-alert-feed {
    max-height: 160px;
    overflow-y: auto;
}
.cap-feed-empty {
    color: #475569;
    font-size: 10px;
    text-align: center;
    padding: 10px;
    font-style: italic;
}
.cap-feed-row {
    display: grid;
    grid-template-columns: 72px 1fr 1fr 50px;
    gap: 0 6px;
    padding: 5px 10px;
    border-bottom: 1px solid rgba(244,63,94,0.08);
    font-size: 10px;
    font-family: 'JetBrains Mono','Fira Code','Courier New',monospace;
    transition: background 0.15s;
}
.cap-feed-row:last-child { border-bottom: none; }
.cap-feed-row:hover { background: rgba(244,63,94,0.06); }
.cap-feed-sym  { font-weight: 700; color: #f1f5f9; }
.cap-feed-entry { color: #34d399; }
.cap-feed-sl    { color: #ef4444; }
.cap-feed-vol   { color: #f59e0b; font-weight: 700; text-align: right; }
.cap-feed-header {
    display: grid;
    grid-template-columns: 72px 1fr 1fr 50px;
    gap: 0 6px;
    padding: 3px 10px;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: rgba(244,63,94,0.6);
    text-transform: uppercase;
    border-bottom: 1px solid rgba(244,63,94,0.15);
    background: rgba(244,63,94,0.05);
}

/* ── Capitulation Toast (floating alert) ─────────────────────────────────── */
#capitulation-toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 300px;
}
.capitulation-toast {
    background: #1a0a10;
    border: 2px solid #f43f5e;
    border-radius: 10px;
    padding: 0;
    box-shadow: 0 0 24px rgba(244,63,94,0.5), 0 4px 16px rgba(0,0,0,0.6);
    animation: cap-toast-in 0.3s ease-out;
    overflow: hidden;
    position: relative;
}
@keyframes cap-toast-in {
    from { transform: translateX(120%); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}
.cap-toast-header {
    background: #f43f5e;
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 6px 36px 6px 12px;
    animation: cap-flash 1s ease-in-out 3;
}
@keyframes cap-flash {
    0%, 100% { background: #f43f5e; }
    50%       { background: #be123c; }
}
.cap-toast-body { padding: 8px 12px; }
.cap-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2px 0;
    font-size: 11px;
    font-family: 'JetBrains Mono','Fira Code','Courier New',monospace;
    border-bottom: 1px solid rgba(244,63,94,0.1);
}
.cap-row:last-child { border-bottom: none; }
.cap-label { color: #94a3b8; font-size: 10px; }
.cap-value { color: #f1f5f9; font-weight: 700; }
.cap-entry { color: #34d399; }
.cap-stop  { color: #ef4444; }
.cap-vol   { color: #f59e0b; }
.cap-toast-close {
    position: absolute;
    top: 4px; right: 6px;
    background: none;
    border: none;
    color: rgba(255,255,255,0.7);
    font-size: 13px;
    cursor: pointer;
    line-height: 1;
    padding: 2px 4px;
}
.cap-toast-close:hover { color: #fff; }

/* ── Engine 5: Macro Breakout Scanner ────────────────────────────────────── */
.e5-engine-section {
    margin: 10px 0 4px;
    border: 1px solid rgba(52, 211, 153, 0.35);
    border-radius: 7px;
    overflow: hidden;
    background: rgba(52, 211, 153, 0.03);
}
.e5-engine-header {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 6px 10px;
    background: rgba(52, 211, 153, 0.09);
    border-bottom: 1px solid rgba(52, 211, 153, 0.2);
}
.e5-engine-pulse {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #34d399;
    flex-shrink: 0;
    animation: e5-pulse 2.4s ease-in-out infinite;
}
@keyframes e5-pulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(52,211,153,0.6); }
    50%       { opacity: 0.6; box-shadow: 0 0 0 5px rgba(52,211,153,0); }
}
.e5-engine-title {
    font-size: 10px;
    font-weight: 700;
    color: #34d399;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    flex: 1;
}
.e5-scan-btn {
    font-size: 9px;
    font-weight: 700;
    color: #34d399;
    background: rgba(52, 211, 153, 0.12);
    border: 1px solid rgba(52, 211, 153, 0.4);
    border-radius: 5px;
    padding: 3px 9px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: background 0.15s, color 0.15s, box-shadow 0.15s;
    white-space: nowrap;
}
.e5-scan-btn:hover:not(:disabled) {
    background: rgba(52, 211, 153, 0.22);
    box-shadow: 0 0 8px rgba(52, 211, 153, 0.35);
}
.e5-scan-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}
.e5-engine-meta {
    font-size: 10px;
    color: #64748b;
    padding: 4px 10px;
    border-bottom: 1px solid rgba(52, 211, 153, 0.08);
}
.e5-alert-feed {
    max-height: 180px;
    overflow-y: auto;
}
.e5-feed-empty {
    font-size: 10px;
    color: #475569;
    text-align: center;
    padding: 10px;
    font-style: italic;
}
.e5-feed-row {
    display: grid;
    grid-template-columns: 74px 80px 80px 44px 36px 1fr;
    gap: 0 5px;
    padding: 5px 10px;
    border-bottom: 1px solid rgba(52,211,153,0.07);
    font-size: 10px;
    align-items: center;
}
.e5-feed-row:last-child { border-bottom: none; }
.e5-feed-sym   { font-weight: 700; color: #f1f5f9; }
.e5-feed-entry { color: #34d399; }
.e5-feed-sl    { color: #ef4444; }
.e5-feed-lev   { color: #f7931a; font-weight: 700; }
.e5-feed-vol   { color: #a78bfa; font-weight: 700; }
.e5-feed-time  { color: #475569; text-align: right; }

/* Engine 5 toast */
#e5-toast-container {
    position: fixed;
    bottom: 20px;
    left: 20px;        /* left side — cap-toasts are on the right */
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 290px;
}
.e5-toast {
    background: #071a12;
    border: 2px solid #34d399;
    border-radius: 10px;
    padding: 0;
    position: relative;
    overflow: hidden;
    box-shadow: 0 0 22px rgba(52,211,153,0.45), 0 4px 16px rgba(0,0,0,0.6);
    animation: e5-toast-in 0.25s ease-out;
}
@keyframes e5-toast-in {
    from { opacity: 0; transform: translateX(-20px) scale(0.95); }
    to   { opacity: 1; transform: translateX(0)    scale(1);    }
}
.e5-toast-header {
    background: #34d399;
    color: #051c10;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    padding: 5px 28px 5px 10px;
}
.e5-toast-body   { padding: 7px 10px; }
.e5-row          { display: flex; justify-content: space-between; gap: 6px; margin-bottom: 3px; }
.e5-row:last-child { margin-bottom: 0; }
.e5-label        { font-size: 9px; color: #64748b; text-transform: uppercase; letter-spacing: 0.05em; align-self: center; }
.e5-val          { font-size: 10px; font-weight: 700; color: #f1f5f9; }
.e5-sym          { color: #f1f5f9; font-size: 11px; }
.e5-entry        { color: #34d399; }
.e5-stop         { color: #ef4444; }
.e5-tp           { color: #a78bfa; font-size: 9px; }
.e5-lev          { color: #f7931a; }
.e5-vol          { color: #38bdf8; }
.e5-toast-close  {
    position: absolute;
    top: 4px; right: 6px;
    background: none;
    border: none;
    color: rgba(5,28,16,0.7);
    font-size: 12px;
    cursor: pointer;
    line-height: 1;
    padding: 2px 4px;
}
.e5-toast-close:hover { color: #051c10; }

/* ── Live Positions DCX-style layout ─────────────────────────────────────── */
.lps-dcx-row {
  display: grid;
  grid-template-columns: 2.5fr 1fr 1.5fr 1fr 1fr 1.5fr 1.5fr 1.5fr 1fr 1fr 1fr;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(48,54,61,0.5);
  font-size: 13px;
  color: var(--text-main);
  transition: background 0.15s;
}
.lps-dcx-row:hover { background: rgba(255,255,255,0.02); }
.lps-dcx-col { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.lps-exchange-badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  margin-right: 6px;
  vertical-align: middle;
}
.lps-exchange-badge.kucoin { background: rgba(59, 130, 246, 0.15); color: #3b82f6; border: 1px solid rgba(59, 130, 246, 0.3); }
.lps-exchange-badge.coindcx { background: rgba(16, 185, 129, 0.15); color: #10b981; border: 1px solid rgba(16, 185, 129, 0.3); }

.lps-sym-name { font-weight: 700; color: #fff; font-size: 14px; }
.lps-sym-leverage { color: var(--text-muted); font-size: 11px; margin-left: 6px; }

.lps-dir.long { color: #22c55e; font-weight: 600; }
.lps-dir.short { color: #ef4444; font-weight: 600; }

.lps-pnl.positive { color: #22c55e; font-weight: 700; }
.lps-pnl.negative { color: #ef4444; font-weight: 700; }
.lps-roe { font-size: 11px; opacity: 0.8; margin-left: 4px; }

.lps-action-btn {
  background: rgba(255,255,255,0.08); /* fallback */
  border: 1px solid var(--border-color);
  color: #fff;
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s;
}
.lps-action-btn:hover { background: rgba(255,255,255,0.15); }
.lps-action-btn.close-btn:hover { background: rgba(239, 68, 68, 0.2); border-color: #ef4444; color: #ef4444; }

.lpm-coming-soon {
  padding: 40px;
  text-align: center;
  color: var(--text-muted);
  font-style: italic;
  font-size: 14px;
}

/* -- Market Structure Matrix (MSM) --------------------------- */
.msm-section { border-bottom: 1px solid var(--border-color); }
.msm-header { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; cursor: pointer; user-select: none; transition: background 0.15s; border-left: 3px solid #10b981; }
.msm-header:hover { background: rgba(16, 185, 129, 0.06); }
.msm-title { color: #10b981; font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: 0.5px; }
.msm-table th { font-weight: 600; color: var(--text-muted); }
.msm-table td { padding: 6px; border-bottom: 1px solid rgba(255,255,255,0.05); }
.msm-badge { display: inline-block; padding: 2px 6px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.msm-badge-bull { background: rgba(16,185,129,0.15); color: #10b981; border: 1px solid rgba(16,185,129,0.3); }
.msm-badge-bear { background: rgba(242,54,69,0.15); color: #f23645; border: 1px solid rgba(242,54,69,0.3); }
.msm-badge-shift { background: rgba(234,179,8,0.15); color: #eab308; border: 1px solid rgba(234,179,8,0.3); animation: pulse-yellow 2s infinite; }
@keyframes pulse-yellow { 0% { box-shadow: 0 0 0 0 rgba(234,179,8, 0.4); } 70% { box-shadow: 0 0 0 4px rgba(234,179,8, 0); } 100% { box-shadow: 0 0 0 0 rgba(234,179,8, 0); } }
@keyframes pulse-green { 0% { box-shadow: 0 0 0 0 rgba(16,185,129, 0.4); } 70% { box-shadow: 0 0 0 6px rgba(16,185,129, 0); } 100% { box-shadow: 0 0 0 0 rgba(16,185,129, 0); } }
