/**
 * Trading Chart Styles
 * TradingView Pro Dark Theme
 */

/* Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* CSS Variables */
:root {
    /* TradingView Dark Theme Palette */
    --bg-primary: #131722;
    --bg-secondary: #1e222d;
    --bg-tertiary: #2a2e39;
    --bg-card: #1e222d;
    --bg-hover: #363a45;
    --bg-active: #434651;

    --text-primary: #d1d4dc;
    --text-secondary: #787b86;
    --text-muted: #50535e;
    --text-white: #ffffff;

    --accent: #2962ff;
    --accent-hover: #1e53e5;
    --accent-light: rgba(41, 98, 255, 0.15);

    --up: #22ab94;
    --up-bright: #26a69a;
    --up-light: rgba(34, 171, 148, 0.15);
    --down: #f23645;
    --down-bright: #ef5350;
    --down-light: rgba(242, 54, 69, 0.15);

    --border: #2a2e39;
    --border-light: #363a45;

    --radius-xs: 2px;
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-xl: 12px;

    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', Consolas, monospace;

    --header-height: 48px;
    --sidebar-width: 320px;

    --transition-fast: 0.1s ease;
    --transition-normal: 0.2s ease;
}

/* Reset */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

body {
    font-family: var(--font-family);
    font-size: 13px;
    color: var(--text-primary);
    background: var(--bg-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ====================================
   LAYOUT STRUCTURE
   ==================================== */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    background: var(--bg-primary);
}

.app-header {
    height: var(--header-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    z-index: 100;
}

.app-main {
    flex: 1;
    display: flex;
    flex-direction: row;
    min-height: 0;
    width: 100%;
    overflow: hidden;
}

/* Left Sidebar */
.left-sidebar {
    width: 320px;
    flex-shrink: 0;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 50;
    transition: width 0.3s ease;
}

/* Main Content - Chart Area */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    height: 100%;
    position: relative;
    background: var(--bg-primary);
}

.chart-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 0;
}

.chart-container {
    flex: 1;
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 0;
    background: var(--bg-primary);
    overflow: hidden;
}

/* Sidebar (Right) */
.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border);
    overflow: hidden;
}

/* ====================================
   HEADER
   ==================================== */
/* ====================================
   HEADER REDESIGN
   ==================================== */
.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 8px;
    background: #131722;
    border-bottom: 1px solid #2a2e39;
    user-select: none;
}

.header-left {
    display: flex;
    align-items: center;
    height: 100%;
}

.header-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    color: #d1d4dc;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s;
}

.header-action-btn:hover {
    background: #2a2e39;
    color: #f0f3fa;
}

.symbol-badge-minimal {
    padding: 0 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
}

.symbol-name-minimal {
    font-size: 16px;
    font-weight: 700;
    color: #f0f3fa;
    letter-spacing: -0.2px;
}

.header-divider {
    width: 1px;
    height: 20px;
    background: #2a2e39;
    margin: 0 4px;
}

.header-btn {
    border: none;
    background: transparent;
    color: #d1d4dc;
    padding: 0 12px;
    height: 36px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    transition: all 0.2s;
}

.header-btn:hover {
    background: #2a2e39;
    color: #f0f3fa;
}

.header-btn.active {
    color: #2962ff;
}

.header-interval-selector {
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
}

.header-dropdown {
    position: absolute;
    top: 40px;
    left: 0;
    min-width: 140px;
    background: #1e222d;
    border: 1px solid #363a45;
    border-radius: 4px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: none;
    padding: 4px 0;
}

.header-dropdown.active {
    display: block;
}

.header-dropdown-item {
    padding: 10px 16px;
    color: #d1d4dc;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.1s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-dropdown-item:hover {
    background: #2a2e39;
    color: #f0f3fa;
}

.header-dropdown-item.active {
    background: #2962ff;
    color: white;
}

.header-dropdown-item .item-check {
    width: 12px;
    height: 12px;
    opacity: 0;
}

.header-dropdown-item.active .item-check {
    opacity: 1;
}

.header-btn-with-icon {
    border: none;
    background: transparent;
    color: #d1d4dc;
    padding: 0 8px;
    height: 36px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.header-btn-with-icon:hover {
    background: #2a2e39;
    color: #f0f3fa;
}

.header-btn-with-icon svg {
    flex-shrink: 0;
}

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

.price-mini-block {
    display: flex;
    align-items: center;
    gap: 12px;
}

.price-mini-block .current-price {
    font-size: 18px;
    font-weight: 700;
    font-family: var(--font-mono);
}

.price-mini-block .change-block {
    display: flex;
    gap: 4px;
    font-size: 13px;
    font-weight: 500;
}

.header-trade-pill-btn {
    background: #000;
    color: white;
    border: 1px solid #fff;
    padding: 2px 16px 2px 4px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    height: 32px;
}

.header-trade-pill-btn:hover {
    background: #111;
    border-color: #eee;
}

.trade-bybit-icon {
    width: 24px;
    height: 24px;
    background: #1e222d;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.bybit-text {
    font-size: 6px;
    font-weight: 900;
    color: #fff;
    letter-spacing: -0.2px;
}

.bybit-text sup {
    color: #f7931a;
    font-size: 5px;
}

.trade-text {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

/* Guide Modal */
.guide-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: none;
    justify-content: center;
    align-items: center;
}

.guide-modal {
    width: 500px;
    max-width: 90%;
    background: #1e222d;
    border: 1px solid #2a2e39;
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.guide-modal.visible {
    opacity: 1;
    transform: translateY(0);
}

.guide-header {
    padding: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #2a2e39;
}

.guide-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #d1d4dc;
}

.guide-close {
    background: none;
    border: none;
    color: #787b86;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.guide-close:hover {
    color: #d1d4dc;
}

.guide-body {
    padding: 24px;
}

.guide-description {
    margin: 0 0 24px 0;
    font-size: 15px;
    line-height: 1.6;
    color: #b2b5be;
}

.guide-step-item {
    display: flex;
    margin-bottom: 16px;
    align-items: flex-start;
}

.guide-step-number {
    width: 24px;
    height: 24px;
    background: #2962ff;
    color: #fff;
    border-radius: 50%;
    text-align: center;
    line-height: 24px;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
    margin-right: 12px;
    margin-top: 2px;
}

.guide-step-text {
    color: #d1d4dc;
    font-size: 14px;
    line-height: 1.5;
}

.guide-step-text strong {
    color: #fff;
    font-weight: 600;
}

.guide-footer {
    padding: 16px 24px;
    background: #1e222d;
    border-top: 1px solid #2a2e39;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.guide-btn-skip {
    background: none;
    border: none;
    color: #787b86;
    font-size: 14px;
    cursor: pointer;
    font-weight: 500;
}

.guide-btn-skip:hover {
    color: #b2b5be;
}

.guide-btn-continue {
    background: #2962ff;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 8px 24px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.guide-btn-continue:hover {
    background: #1e53e5;
}

/* Settings Modal Styles */
.settings-modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 600px;
    height: 500px;
    background: #1e222d;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    z-index: 2000;
    flex-direction: column;
    color: #d1d4dc;
    border: 1px solid #2a2e39;
    overflow: hidden;
}

.settings-modal-header {
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    border-bottom: 1px solid #2a2e39;
}

.settings-modal-header h2 {
    font-size: 16px;
    font-weight: 600;
}

.close-settings {
    cursor: pointer;
    font-size: 24px;
    opacity: 0.6;
}

.close-settings:hover {
    opacity: 1;
}

.settings-modal-body {
    flex: 1;
    display: flex;
    min-height: 0;
}

.settings-sidebar {
    width: 160px;
    border-right: 1px solid #2a2e39;
    padding: 10px 0;
    display: flex;
    flex-direction: column;
}

.settings-tab-btn {
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 13px;
    color: #787b86;
    transition: all 0.2s;
}

.settings-tab-btn:hover {
    background: #2a2e39;
    color: #d1d4dc;
}

.settings-tab-btn.active {
    background: #2a2e39;
    color: #f0f3fa;
    border-left: 2px solid #2962ff;
}

.settings-content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

.settings-section-title {
    font-size: 11px;
    color: #5d606b;
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.settings-item-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
}

.settings-controls {
    display: flex;
    gap: 8px;
}

.color-picker-input {
    width: 32px;
    height: 24px;
    padding: 0;
    border: 1px solid #363a45;
    background: transparent;
    cursor: pointer;
    border-radius: 4px;
}

.settings-modal-footer {
    height: 60px;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid #2a2e39;
}

.template-selector {
    background: #2a2e39;
    color: #d1d4dc;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
}

.footer-actions {
    display: flex;
    gap: 12px;
}

.btn-settings-cancel {
    background: transparent;
    border: 1px solid #363a45;
    color: #d1d4dc;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}

.btn-settings-apply {
    background: #f0f3fa;
    color: #131722;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}

.settings-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1999;
}

/* Fullscreen Chart mode */
.fullscreen-mode .app-header,
.fullscreen-mode .left-sidebar,
.fullscreen-mode .sidebar {
    display: none !important;
}

.fullscreen-mode .app-main {
    height: 100vh;
}

/* ====================================
   CHART CANVAS
   ==================================== */
.chart-canvas-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.chart-canvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: crosshair;
}

/* ====================================
   TOOLTIP
   ==================================== */
.chart-tooltip {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(30, 34, 45, 0.95);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 12px 14px;
    min-width: 180px;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-fast);
    z-index: 50;
    backdrop-filter: blur(12px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.chart-tooltip.visible {
    opacity: 1;
    visibility: visible;
}

.tooltip-time {
    font-size: 11px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.tooltip-ohlc {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ohlc-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.ohlc-row .value {
    font-size: 12px;
    font-family: var(--font-mono);
    color: var(--text-primary);
    font-weight: 500;
}

.tooltip-indicators {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.indicator-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    margin-bottom: 4px;
}

.indicator-label {
    color: var(--text-muted);
}

.indicator-value {
    font-family: var(--font-mono);
    color: var(--text-secondary);
}

/* ====================================
   INDICATOR PANEL
   ==================================== */
.indicator-panel-container {
    position: absolute;
    top: 0;
    right: 80px;
    width: 280px;
    max-height: calc(100% - 40px);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin: 12px;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition-normal);
    z-index: 60;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.indicator-panel-container.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.indicator-panel {
    padding: 16px;
    max-height: 400px;
    overflow-y: auto;
}

.indicator-section {
    margin-bottom: 16px;
}

.section-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.indicator-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.indicator-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.indicator-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.indicator-btn.active {
    background: var(--accent-light);
    border-color: var(--accent);
    color: var(--accent);
}

.indicator-color {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.active-indicators {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.active-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.active-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
}

.active-item .indicator-name {
    flex: 1;
    font-size: 12px;
    color: var(--text-secondary);
}

.remove-btn {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
    border-radius: 4px;
    transition: all var(--transition-fast);
}

.remove-btn:hover {
    background: var(--down-light);
    color: var(--down);
}

.no-indicators {
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
    padding: 12px;
}

/* ====================================
   CHART CONTROLS
   ==================================== */
.chart-controls-container {
    position: absolute;
    bottom: 40px;
    right: 12px;
    z-index: 40;
}

.chart-controls {
    display: flex;
    gap: 4px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.control-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.control-btn:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.control-btn.active {
    color: var(--accent);
    background: var(--accent-light);
}

.control-btn svg {
    width: 14px;
    height: 14px;
}

.control-divider {
    width: 1px;
    background: var(--border);
    margin: 2px 4px;
}

/* ====================================
   SIDEBAR - WATCHLIST
   ==================================== */
.watchlist-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: var(--bg-secondary);
}

.watchlist {
    display: flex;
    flex-direction: column;
}

.watchlist-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

.watchlist-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.watchlist-title::before {
    content: '';
    width: 3px;
    height: 14px;
    background: var(--accent);
    border-radius: 2px;
}

.watchlist-header-row {
    display: grid;
    grid-template-columns: 2fr 1.5fr 1fr 1fr;
    padding: 8px 16px;
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    background: var(--bg-tertiary);
}

.wl-col {
    font-family: var(--font-mono);
}

.wl-col.symbol {
    font-family: var(--font-family);
}

.wl-col.price,
.wl-col.change,
.wl-col.pct {
    text-align: right;
}

.watchlist-items {
    max-height: 200px;
    /* Reduced to fit ~5 items */
    overflow-y: auto;
}

.wl-item {
    display: grid;
    grid-template-columns: 2fr 1.5fr 1fr 1fr;
    padding: 10px 16px;
    cursor: pointer;
    transition: background var(--transition-fast);
    border-bottom: 1px solid var(--border);
    font-size: 12px;
}

.wl-item:hover {
    background: var(--bg-hover);
}

.wl-item.selected {
    background: var(--accent-light);
    border-left: 2px solid var(--accent);
}

.wl-item .wl-col.symbol {
    display: flex;
    align-items: center;
    gap: 8px;
}

.wl-item .symbol-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    color: #fff;
}

.wl-item .symbol-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 12px;
}

.wl-col.price {
    font-weight: 500;
    font-family: var(--font-mono);
}

.wl-col.up {
    color: var(--up);
}

.wl-col.down {
    color: var(--down);
}

/* ====================================
   SIDEBAR TABS
   ==================================== */
.sidebar-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
}

.sidebar-tab {
    flex: 1;
    padding: 12px 16px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    border-bottom: 2px solid transparent;
    font-family: var(--font-family);
}

.sidebar-tab:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.sidebar-tab.active {
    color: var(--text-primary);
    border-bottom-color: var(--accent);
    background: var(--bg-tertiary);
}

.sidebar-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

/* ====================================
   ORDER BOOK
   ==================================== */
.orderbook-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    background: var(--bg-secondary);
}

.orderbook {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 0;
}

.orderbook-header {
    display: flex;
    justify-content: space-between;
    padding: 10px 16px;
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
}

.ob-header-col {
    font-weight: 500;
}

.ob-header-col.right {
    text-align: right;
}

.orderbook-asks,
.orderbook-bids {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.orderbook-asks {
    justify-content: flex-end;
}

.ob-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    padding: 3px 16px;
    position: relative;
    font-size: 12px;
    font-family: var(--font-mono);
    transition: background var(--transition-fast);
    cursor: pointer;
}

.ob-row:hover {
    background: var(--bg-hover);
}

.ob-depth {
    position: absolute;
    top: 0;
    bottom: 0;
    right: 0;
    opacity: 0.18;
    pointer-events: none;
    transition: width 0.15s ease;
}

.ob-depth.ask {
    background: linear-gradient(90deg, transparent 0%, var(--down) 100%);
}

.ob-depth.bid {
    background: linear-gradient(90deg, transparent 0%, var(--up) 100%);
}

.ob-price {
    font-weight: 500;
    z-index: 1;
}

.ob-row.ask .ob-price {
    color: var(--down);
}

.ob-row.bid .ob-price {
    color: var(--up);
}

.ob-amount {
    text-align: right;
    color: var(--text-secondary);
    z-index: 1;
}

.orderbook-spread-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.spread-left {
    display: flex;
    align-items: center;
    gap: 6px;
}

.spread-price {
    font-size: 16px;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--text-primary);
    transition: color var(--transition-fast);
}

.spread-price.up {
    color: var(--up);
}

.spread-price.down {
    color: var(--down);
}

.spread-arrow {
    font-size: 10px;
    font-weight: 700;
}

.spread-arrow.up {
    color: var(--up);
}

.spread-arrow.down {
    color: var(--down);
}

.spread-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.spread-label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.spread-value {
    font-size: 11px;
    font-family: var(--font-mono);
    color: var(--text-secondary);
}


/* ====================================
   TECHNICAL ANALYSIS
   ==================================== */
.analysis-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: var(--bg-secondary);
}

.ta-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.ta-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-tertiary);
}

.ta-header .title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.ta-header .symbol {
    font-size: 11px;
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

.ta-content {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
}

.ta-section {
    margin-bottom: 16px;
}

.ta-section-title {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}

.ta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 12px;
}

.ta-row.highlight {
    background: var(--bg-tertiary);
    margin: 0 -10px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
}

.ta-label {
    color: var(--text-secondary);
}

.ta-value {
    font-family: var(--font-mono);
    color: var(--text-primary);
    font-weight: 500;
}

.ta-value.bullish {
    color: var(--up);
}

.ta-value.bearish {
    color: var(--down);
}

.ta-value.neutral {
    color: var(--text-secondary);
}

.ta-signal {
    width: 50px;
    text-align: right;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
}

.ta-signal.bullish {
    color: var(--up);
}

.ta-signal.bearish {
    color: var(--down);
}

.ta-signal.neutral {
    color: var(--text-muted);
}

.ta-summary {
    margin-top: 16px;
    padding: 14px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
}

.summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.summary-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.summary-value {
    font-size: 16px;
    font-weight: 700;
}

.summary-value.bullish {
    color: var(--up);
}

.summary-value.bearish {
    color: var(--down);
}

.summary-value.neutral {
    color: var(--text-secondary);
}

/* ====================================
   LOADING
   ==================================== */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    z-index: 200;
    transition: opacity 0.3s ease;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--bg-tertiary);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ====================================
   SCROLLBAR
   ==================================== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--bg-hover);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ====================================
   MOBILE CONTROLS
   ==================================== */
.mobile-controls {
    display: none;
}

/* ====================================
   RESPONSIVE - Tablet
   ==================================== */
@media (max-width: 1200px) {
    :root {
        --sidebar-width: 300px;
    }

    .stats-group {
        display: none;
    }

    .header-right {
        display: none;
    }
}

@media (max-width: 900px) {
    :root {
        --sidebar-width: 280px;
    }

    .header-center {
        margin-left: 8px;
    }

    .interval-btn {
        padding: 6px 8px;
        font-size: 11px;
    }
}

/* ====================================
   RESPONSIVE - Mobile
   ==================================== */
@media (max-width: 768px) {
    :root {
        --header-height: 52px;
        --sidebar-width: 100%;
    }

    .app-main {
        flex-direction: column;
    }

    .main-content {
        flex: 1;
        min-height: 50vh;
    }

    .sidebar {
        width: 100%;
        height: auto;
        max-height: 50vh;
        border-left: none;
        border-top: 1px solid var(--border);
    }

    .watchlist-items {
        max-height: 150px;
    }
}

@media (max-width: 430px) {
    :root {
        --header-height: 56px;
    }

    .header-content {
        padding: 0 10px;
        gap: 8px;
    }

    .header-left {
        gap: 10px;
        flex: 1;
        min-width: 0;
    }

    .symbol-badge {
        padding: 4px 8px 4px 4px;
    }

    .symbol-icon {
        width: 24px;
        height: 24px;
        font-size: 12px;
    }

    .symbol-name {
        font-size: 13px;
    }

    .symbol-exchange,
    .symbol-desc {
        display: none;
    }

    .price-block {
        padding-left: 10px;
    }

    .current-price {
        font-size: 16px;
    }

    .header-center {
        display: none;
    }

    .mobile-controls {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 60px;
        background: var(--bg-secondary);
        border-top: 1px solid var(--border);
        z-index: 100;
        padding: 8px 12px;
        gap: 8px;
        align-items: center;
        justify-content: space-between;
    }

    .mobile-interval-group {
        display: flex;
        gap: 4px;
        overflow-x: auto;
        flex: 1;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .mobile-interval-group::-webkit-scrollbar {
        display: none;
    }

    .mobile-interval-btn {
        flex-shrink: 0;
        border: none;
        background: var(--bg-tertiary);
        color: var(--text-secondary);
        padding: 10px 14px;
        font-size: 12px;
        font-weight: 600;
        cursor: pointer;
        border-radius: var(--radius-md);
        transition: all var(--transition-fast);
        font-family: var(--font-family);
    }

    .mobile-interval-btn.active {
        background: var(--accent);
        color: var(--text-white);
    }

    .mobile-control-btn {
        flex-shrink: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        border: none;
        background: var(--bg-tertiary);
        color: var(--text-secondary);
        border-radius: var(--radius-md);
        cursor: pointer;
    }

    .mobile-control-btn:active,
    .mobile-control-btn.active {
        background: var(--bg-hover);
        color: var(--text-primary);
    }

    .mobile-control-btn svg {
        width: 20px;
        height: 20px;
    }

    .chart-tooltip {
        top: auto;
        bottom: 70px;
        left: 12px;
        right: 12px;
        width: auto;
        min-width: unset;
    }

    .indicator-panel-container {
        pointer-events: none;
        /* Let modal handle its own events */
    }

    /* Ensure chart area doesn't overlap with mobile controls */
    .chart-area {
        padding-bottom: 60px; /* Height of mobile-controls */
    }
}


/* ====================================
   INDICATOR MODAL (Refined TV Style)
   ==================================== */
.modal-overlay#indicator-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(5px);
    z-index: 99999;
    pointer-events: all;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.indicator-modal {
    width: 90%;
    max-width: 850px;
    height: 85vh;
    display: flex;
    flex-direction: column;
    background: #1e222d;
    /* TV Darker background */
    border-radius: var(--radius-lg);
    border: 1px solid #363a45;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    pointer-events: all;
}

.indicator-modal-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.indicator-search-container {
    padding: 20px 24px;
    background: #1e222d;
    border-bottom: 1px solid #363a45;
}

.search-input-wrapper {
    position: relative;
    width: 100%;
}

.search-input-wrapper input {
    width: 100%;
    background: #2a2e39;
    border: 1px solid #363a45;
    border-radius: var(--radius-md);
    padding: 14px 14px 14px 44px;
    color: #d1d4dc;
    font-size: 15px;
    transition: border-color 0.2s;
}

.search-input-wrapper input:focus {
    border-color: var(--accent);
    outline: none;
}

.search-input-wrapper .search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #868993;
}

.indicator-modal-content {
    flex: 1;
    display: flex;
    min-height: 0;
}

.indicator-sidebar {
    width: 240px;
    background: #1e222d;
    border-right: 1px solid #363a45;
    padding: 12px 0;
}

.sidebar-group-label {
    padding: 16px 24px 8px;
    font-size: 11px;
    font-weight: 700;
    color: #868993;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sidebar-item {
    width: 100%;
    padding: 10px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border: none;
    background: transparent;
    color: #b2b5be;
    text-align: left;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.sidebar-item:hover:not(:disabled) {
    background: #2a2e39;
    color: #d1d4dc;
}

.sidebar-item.active {
    background: #2a2e39;
    color: #ffffff;
}

.sidebar-item svg {
    color: #868993;
    width: 18px;
    height: 18px;
}

.sidebar-item.active svg {
    color: #2962ff;
}

.sidebar-divider {
    height: 1px;
    background: #363a45;
    margin: 8px 24px;
}

.indicator-main-list,
.indicator-active-list {
    flex: 1;
    padding: 0;
    overflow-y: auto;
    background: #1e222d;
}

.list-header-row {
    padding: 8px 24px;
    background: #1e222d;
    border-bottom: 1px solid #363a45;
    font-size: 11px;
    font-weight: 700;
    color: #868993;
    text-transform: uppercase;
}

.indicator-group {
    margin-bottom: 24px;
}

.group-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
}

.indicator-list-item {
    display: flex;
    align-items: center;
    padding: 8px 24px;
    cursor: pointer;
    transition: background 0.1s;
}

.indicator-list-item:hover {
    background: #2a2e39;
}

.indicator-list-item.active {
    background: var(--bg-active);
}

.ind-star-col {
    width: 32px;
    display: flex;
    align-items: center;
}

.star-icon {
    color: #868993;
    cursor: pointer;
}

.star-icon:hover,
.star-icon.starred {
    color: #f0b90b;
    /* TV Gold */
    fill: #f0b90b;
}

.ind-info {
    flex: 1;
}

.ind-name {
    font-size: 14px;
    color: #d1d4dc;
}

.ind-full-name {
    font-size: 12px;
    color: var(--text-muted);
}

.ind-add-btn {
    opacity: 0;
    padding: 4px 12px;
    background: #2962ff;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.indicator-list-item:hover .ind-add-btn {
    opacity: 1;
}

.indicator-list-item.active .ind-add-btn {
    opacity: 1;
    background: #ef5350;
}

.active-items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.active-grid-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
}

.active-ind-header {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
}

.active-ind-color {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 8px;
}

.active-ind-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
}

.remove-action {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    padding: 0 4px;
}

.remove-action:hover {
    color: var(--down);
}

.active-ind-params {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.active-ind-params span {
    font-size: 11px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    padding: 2px 8px;
    border-radius: var(--radius-xs);
}

.no-active-msg {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

/* Safe area insets for notched phones */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .mobile-controls {
        padding-bottom: calc(8px + env(safe-area-inset-bottom));
        height: calc(60px + env(safe-area-inset-bottom));
    }

    .indicator-panel-container {
        bottom: calc(60px + env(safe-area-inset-bottom));
    }

    .chart-tooltip {
        bottom: calc(70px + env(safe-area-inset-bottom));
    }
}

/* ====================================
   ACCESSIBILITY
   ==================================== */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ====================================
   SYMBOL DETAIL PANEL
   ==================================== */
.symbol-detail-panel {
    background: var(--bg-secondary);
    border-top: 2px solid var(--border);
    /* Thicker border to clearly separate */
    padding: 0;
    position: relative;
    flex: 2;
    /* Increased priority */
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.detail-content {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 20px;
}

.resize-handle {
    width: 100%;
    height: 4px;
    /* Reduced from 12px */
    background: transparent;
    cursor: row-resize;
    position: absolute;
    top: -2px;
    left: 0;
    z-index: 100;
    transition: background 0.2s;
}

.resize-handle:hover,
.resize-handle.active {
    background: var(--accent);
}

.detail-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

.detail-symbol-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.detail-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.detail-symbol-text {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.detail-symbol-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.detail-extra-btns {
    display: flex;
    gap: 4px;
}

.detail-btn {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.detail-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.detail-contract {
    padding: 6px 16px;
    font-size: 11px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.detail-exchange {
    color: var(--accent);
    font-weight: 500;
}

.detail-type {
    padding: 0 16px 10px;
    font-size: 11px;
    color: var(--text-muted);
}

.detail-price-section {
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.detail-main-price {
    font-size: 26px;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--up);
    display: flex;
    align-items: baseline;
    gap: 6px;
    letter-spacing: -0.5px;
}

.detail-main-price.up {
    color: var(--up);
}

.detail-main-price.down {
    color: var(--down);
}

.detail-currency {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

.detail-change {
    font-size: 13px;
    font-weight: 500;
    font-family: var(--font-mono);
    margin-top: 4px;
}

.detail-change.up {
    color: var(--up);
}

.detail-change.down {
    color: var(--down);
}

.detail-market-status {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    font-size: 11px;
    color: var(--text-secondary);
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--up);
    animation: pulse 2s infinite;
}

.status-dot.up {
    background: var(--up);
}

.status-dot.down {
    background: var(--down);
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.detail-news-banner {
    padding: 10px 16px;
    background: linear-gradient(135deg, rgba(34, 171, 148, 0.1) 0%, rgba(41, 98, 255, 0.1) 100%);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
}

.news-badge {
    background: var(--bg-hover);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 10px;
    flex-shrink: 0;
}

.news-text {
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.detail-stats {
    padding: 12px 16px;
}

.detail-stats-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 10px;
}

.detail-stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 12px;
}

.detail-stat-row .stat-label {
    color: var(--text-secondary);
}

.detail-stat-row .stat-value {
    font-family: var(--font-mono);
    color: var(--text-primary);
    font-weight: 500;
}

/* Watchlist Settings Button */
.watchlist-settings-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.watchlist-settings-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* ====================================
   LEFT SIDEBAR - TRADING PANEL
   ==================================== */
.left-sidebar {
    width: 0;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    border-right: 0;
    transition: width 0.3s ease, border-right 0.3s step-end;
    overflow: hidden;
    position: relative;
    /* Changed from absolute to flow with layout */
    z-index: 90;
}

.left-sidebar.visible {
    width: 300px;
    border-right: 1px solid var(--border);
    transition: width 0.3s ease, border-right 0.3s step-start;
}

/* Indicator Sidebar Panel */
.indicator-sidebar-panel {
    width: 0;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    border-right: 0;
    transition: width 0.3s ease;
    overflow: hidden;
    position: relative;
    z-index: 89;
}

.indicator-sidebar-panel.visible {
    width: 280px;
    border-right: 1px solid var(--border);
}

.indicator-sidebar-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.indicator-sidebar-search {
    padding: 12px;
    border-bottom: 1px solid var(--border);
}

.indicator-sidebar-search input {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 13px;
}

.indicator-sidebar-search input:focus {
    border-color: var(--accent);
    outline: none;
}

.indicator-section-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
}

.ind-tab {
    flex: 1;
    padding: 10px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.ind-tab:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.ind-tab.active {
    color: var(--accent);
    border-bottom: 2px solid var(--accent);
}

.indicator-list-container {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.indicator-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    margin-bottom: 4px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
}

.indicator-list-item:hover {
    background: var(--bg-hover);
}

.indicator-list-item.active {
    background: var(--accent-light);
    border: 1px solid var(--accent);
}

.indicator-list-item .ind-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.indicator-list-item .ind-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.indicator-list-item .ind-type {
    font-size: 11px;
    color: var(--text-muted);
}

.ind-toggle-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ind-toggle-btn.add {
    background: var(--accent);
    color: white;
}

.ind-toggle-btn.remove {
    background: var(--down);
    color: white;
}

.indicator-list-container .empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.indicator-list-container .empty-state p {
    font-size: 14px;
    margin-bottom: 8px;
}

.indicator-list-container .empty-state span {
    font-size: 12px;
}

/* Positions Tab - Apple Style */
.positions-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

.positions-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}

.btn-refresh-text {
    padding: 6px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--accent);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-refresh-text:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.positions-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.positions-empty-state svg {
    margin-bottom: 16px;
    opacity: 0.5;
}

.positions-empty-state p {
    color: var(--text-muted);
    font-size: 14px;
}

.position-card {
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 12px;
}

.position-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.position-symbol {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}

.position-side {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.position-side.long {
    background: var(--up-light);
    color: var(--up);
}

.position-side.short {
    background: var(--down-light);
    color: var(--down);
}

.position-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.position-detail-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

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

.position-detail-value {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.position-pnl {
    font-size: 15px;
    font-weight: 700;
}

.position-pnl.up {
    color: var(--up);
}

.position-pnl.down {
    color: var(--down);
}

.left-sidebar-content-wrapper {
    min-width: 300px;
    /* Prevent content squishing during transition */
    height: 100%;
    display: flex;
    flex-direction: column;
}

.left-sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

.left-sidebar-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.left-sidebar-close {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    font-size: 20px;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.left-sidebar-tabs {
    display: flex;
    gap: 4px;
    flex: 1;
}

.ls-tab {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
}

.ls-tab.active {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.ls-tab:hover {
    color: var(--text-primary);
}

.ls-tab-content {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    /* Each tab manages its own overflow */
}

.leverage-section {
    padding: 0 16px 12px 16px;
    border-bottom: 1px solid var(--border);
}

.data-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.left-sidebar-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.trading-panel {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.trading-not-configured {
    text-align: center;
    padding: 40px 20px;
}

.trading-setup-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.trading-not-configured h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.trading-not-configured p {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.btn-primary {
    width: 100%;
    padding: 12px 24px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-secondary {
    width: 100%;
    padding: 10px 20px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

.trading-balance {
    background: var(--bg-tertiary);
    padding: 12px;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
}

.balance-title {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.balance-value {
    font-size: 18px;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--text-primary);
}

.order-form {
    margin-bottom: 16px;
}

.order-tabs {
    display: flex;
    margin-bottom: 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: 4px;
}

.order-tab {
    flex: 1;
    padding: 10px;
    background: transparent;
    border: none;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.order-tab:hover {
    color: var(--text-primary);
}

.order-tab.active[data-side="Buy"] {
    background: var(--up);
    color: white;
}

.order-tab.active[data-side="Sell"] {
    background: var(--down);
    color: white;
}

.order-type-select {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.order-type-btn {
    flex: 1;
    padding: 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.order-type-btn.active {
    background: var(--accent-light);
    border-color: var(--accent);
    color: var(--accent);
}

.order-input-group {
    margin-bottom: 12px;
}

.order-input-group label {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.order-input-group input {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: var(--font-mono);
    color: var(--text-primary);
    outline: none;
    transition: border-color var(--transition-fast);
}

.order-input-group input:focus {
    border-color: var(--accent);
}

.order-input-group input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.order-pct-btns {
    display: flex;
    gap: 4px;
    margin-top: 8px;
}

.pct-btn {
    flex: 1;
    padding: 6px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    font-size: 11px;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-xs);
}

.pct-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.order-summary {
    display: flex;
    justify-content: space-between;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
    font-size: 12px;
    color: var(--text-secondary);
}

.order-summary span:last-child {
    font-family: var(--font-mono);
    color: var(--text-primary);
    font-weight: 500;
}

.btn-order {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-order.buy {
    background: var(--up);
    color: white;
}

.btn-order.buy:hover {
    filter: brightness(1.1);
}

.btn-order.sell {
    background: var(--down);
    color: white;
}

.btn-order.sell:hover {
    filter: brightness(1.1);
}

/* ====================================
   SLIDER CONTROLS (Leverage & Quantity)
   ==================================== */
.slider-section {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

.slider-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

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

.slider-value-display {
    font-size: 14px;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--accent);
    background: var(--accent-light);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
}

.slider-container,
.qty-slider-container {
    padding: 0 4px;
}

.slider-input {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: linear-gradient(to right, var(--accent), var(--accent));
    background-size: 10% 100%;
    background-repeat: no-repeat;
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

.slider-input::-webkit-slider-runnable-track {
    width: 100%;
    height: 6px;
    background: var(--bg-primary);
    border-radius: 3px;
}

.slider-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--accent);
    border: 2px solid white;
    border-radius: 50%;
    cursor: pointer;
    margin-top: -6px;
    box-shadow: 0 2px 8px rgba(41, 98, 255, 0.4);
    transition: transform 0.15s ease;
}

.slider-input::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.slider-input::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--accent);
    border: 2px solid white;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(41, 98, 255, 0.4);
}

.slider-marks {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    padding: 0 2px;
}

.slider-marks span {
    font-size: 10px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 2px;
    transition: all 0.15s ease;
}

.slider-marks span:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.qty-slider-container {
    margin-top: 10px;
}

.qty-marks {
    margin-top: 4px;
}

/* Balance Row with Refresh */
.balance-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-icon:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    transform: rotate(180deg);
}

/* ====================================
   HISTORY FILTER
   ==================================== */
.history-filter {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
}

.period-btn {
    flex: 1;
    padding: 8px 12px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
}

.period-btn:hover {
    color: var(--text-primary);
    border-color: var(--accent);
}

.period-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.history-pnl-chart {
    padding: 20px 16px;
    background: linear-gradient(135deg, var(--bg-tertiary), rgba(34, 171, 148, 0.05));
    border-bottom: 1px solid var(--border);
}

/* ====================================
   TP/SL SECTION
   ==================================== */
.tpsl-section {
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border);
}

.tpsl-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.tpsl-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    width: 24px;
}

.tpsl-input {
    flex: 1;
    padding: 8px 10px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: var(--font-mono);
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.15s ease;
}

.tpsl-input:focus {
    border-color: var(--accent);
}

.tpsl-input.tp:focus {
    border-color: var(--up);
}

.tpsl-input.sl:focus {
    border-color: var(--down);
}

.tpsl-divider {
    color: var(--text-muted);
    font-size: 16px;
}

.tpsl-actions {
    display: flex;
    gap: 8px;
}

.btn-tpsl {
    flex: 1;
    padding: 10px;
    background: var(--up);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    color: white;
    cursor: pointer;
    transition: filter 0.15s ease;
}

.btn-tpsl:hover {
    filter: brightness(1.1);
}

.btn-alarm {
    padding: 10px 16px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-alarm:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--accent);
}

/* ====================================
   ENHANCED POSITION CARD
   ==================================== */
.position-card {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    overflow: hidden;
    border-left: 3px solid var(--text-muted);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.position-card:hover {
    transform: translateX(4px);
    box-shadow: -4px 0 12px rgba(0, 0, 0, 0.2);
}

.position-card.long {
    border-left-color: var(--up);
}

.position-card.short {
    border-left-color: var(--down);
}

.position-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    background: rgba(0, 0, 0, 0.15);
}

.position-main-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.position-symbol {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.position-leverage {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    background: var(--bg-primary);
    border-radius: var(--radius-xs);
    color: var(--text-secondary);
}

.position-side {
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
}

.position-side.long {
    background: var(--up-light);
    color: var(--up);
}

.position-side.short {
    background: var(--down-light);
    color: var(--down);
}

/* Detail Leverage Badge */
.detail-leverage {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text-secondary);
    margin-left: 8px;
}

.open-orders {
    border-top: 1px solid var(--border);
    padding-top: 16px;
}

.open-orders-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.no-orders {
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
    padding: 20px;
}

/* ====================================
   MODALS IMPROVED
   ==================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 400px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    overflow: hidden;
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 16px;
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
}

.tpsl-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    padding: 10px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
}

.tpsl-info span {
    font-weight: 700;
}

.alert-modal {
    padding: 30px;
    text-align: center;
}

#alert-message {
    margin-bottom: 20px;
    font-size: 14px;
    line-height: 1.5;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    font-size: 24px;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm);
}

.modal-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.modal-content {
    padding: 20px;
    overflow-y: auto;
}

.modal-search {
    padding: 0 20px 16px;
}

.modal-search input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 14px;
    color: var(--text-primary);
    outline: none;
}

.modal-search input:focus {
    border-color: var(--accent);
}

.symbol-list {
    max-height: 400px;
    overflow-y: auto;
    padding: 0 20px 20px;
}

.symbol-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: background 0.2s;
}

.symbol-item:hover {
    background: var(--bg-hover);
}

.symbol-item-info {
    display: flex;
    flex-direction: column;
}

.symbol-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}

.symbol-pair {
    font-size: 11px;
    color: var(--text-muted);
}

.symbol-item-price-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    margin-right: 16px;
}

.symbol-last-price {
    font-size: 14px;
    font-weight: 600;
    font-family: var(--font-mono);
}

.symbol-change-pct {
    font-size: 11px;
    font-weight: 500;
}

.symbol-last-price.up,
.symbol-change-pct.up {
    color: var(--up);
}

.symbol-last-price.down,
.symbol-change-pct.down {
    color: var(--down);
}

.symbol-last-price.neutral,
.symbol-change-pct.neutral {
    color: var(--text-muted);
}

.btn-watchlist {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    font-size: 18px;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm);
}

.btn-watchlist.active {
    color: #f59e0b;
}

.btn-watchlist:hover {
    background: var(--bg-tertiary);
}

.input-group {
    margin-bottom: 16px;
}

.input-group label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.input-group input {
    width: 100%;
    padding: 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 14px;
    color: var(--text-primary);
    outline: none;
}

.input-group input:focus {
    border-color: var(--accent);
}

.api-warning {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: #f59e0b;
    padding: 12px;
    border-radius: var(--radius-md);
    font-size: 12px;
    margin-bottom: 20px;
    line-height: 1.5;
}

.api-error {
    background: var(--down-light);
    color: var(--down);
    padding: 10px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    margin-bottom: 16px;
}

.watchlist-edit-list {
    margin-bottom: 16px;
}

.watchlist-edit-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    font-size: 13px;
    color: var(--text-primary);
}

.btn-remove {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
    border-radius: var(--radius-sm);
}

.btn-remove:hover {
    background: var(--down-light);
    color: var(--down);
}

/* ====================================
   ENHANCED TOOLTIP
   ==================================== */
.tooltip-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.tooltip-symbol {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.tooltip-interval {
    font-size: 11px;
    color: var(--text-muted);
    padding: 2px 6px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-xs);
}

.ohlc-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.ohlc-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
}

.ohlc-item .label {
    color: var(--text-muted);
}

.ohlc-item .value {
    font-family: var(--font-mono);
    color: var(--text-primary);
}

.tooltip-stats {
    margin-bottom: 10px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 3px 0;
    font-size: 11px;
}

.stat-row .label {
    color: var(--text-muted);
}

.stat-row .value {
    font-family: var(--font-mono);
    color: var(--text-primary);
}

.tooltip-indicators-title {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 6px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}

/* ====================================
   PRINT
   ==================================== */
@media print {

    .sidebar,
    .left-sidebar,
    .app-header,
    .mobile-controls,
    .chart-tooltip,
    .indicator-panel-container,
    .modal-overlay {
        display: none !important;
    }

    .chart-container {
        margin: 0;
    }
}

/* ====================================
   POSITIONS & HISTORY CARDS
   ==================================== */
.position-card {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    overflow: hidden;
    border-left: 3px solid var(--text-muted);
}

.position-card.long {
    border-left-color: var(--up);
}

.position-card.short {
    border-left-color: var(--down);
}

.position-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--border);
}

.position-symbol {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.position-side {
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
}

.position-side.long {
    background: var(--up-light);
    color: var(--up);
}

.position-side.short {
    background: var(--down-light);
    color: var(--down);
}

.position-details {
    padding: 12px 14px;
}

.position-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 12px;
}

.position-row .label {
    color: var(--text-muted);
}

.position-row .value {
    font-family: var(--font-mono);
    color: var(--text-primary);
    font-weight: 500;
}

.position-row .value.up {
    color: var(--up);
}

.position-row .value.down {
    color: var(--down);
}

/* History Items */
.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
}

.history-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.history-symbol {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.history-date {
    font-size: 11px;
    color: var(--text-muted);
}

.history-pnl {
    font-size: 14px;
    font-weight: 600;
    font-family: var(--font-mono);
}

.history-pnl.up {
    color: var(--up);
}

.history-pnl.down {
    color: var(--down);
}

/* PnL Summary */
.pnl-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    height: 100%;
}

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

.pnl-value {
    font-size: 20px;
    font-weight: 700;
    font-family: var(--font-mono);
}

.pnl-value.up {
    color: var(--up);
}

.pnl-value.down {
    color: var(--down);
}

/* No data messages */
.no-data-msg {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 13px;
}

.error-msg {
    text-align: center;
    padding: 20px;
    color: var(--down);
    font-size: 12px;
    background: var(--down-light);
    border-radius: var(--radius-sm);
}

/* ====================================
   ENHANCED TRADING PANEL
   ==================================== */
.trading-panel {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.trading-configured {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.trading-balance {
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, rgba(34, 171, 148, 0.08) 100%);
    padding: 14px 16px;
    margin: 0;
    border-bottom: 1px solid var(--border);
}

.margin-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.margin-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
}

.margin-row .label {
    color: var(--text-muted);
}

.margin-row .value {
    font-family: var(--font-mono);
    color: var(--text-primary);
}

.margin-bar {
    height: 4px;
    background: var(--bg-primary);
    border-radius: 2px;
    margin-top: 4px;
    overflow: hidden;
}

.margin-bar-fill {
    height: 100%;
    background: var(--up);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.margin-bar-fill.warning {
    background: #f59e0b;
}

.margin-bar-fill.danger {
    background: var(--down);
}

/* Order form enhancements */
.order-form {
    padding: 16px;
    flex: 1;
}

/* Input field style */
.input-field {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: var(--font-mono);
    color: var(--text-primary);
    outline: none;
    transition: border-color var(--transition-fast);
}

.input-field:focus {
    border-color: var(--accent);
}

/* ====================================
   BYBIT STYLE FUNDING RATE BAR
   ==================================== */
.ticker-funding-rate {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    padding: 4px 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
}

.funding-label {
    color: var(--text-muted);
}

.funding-value {
    font-family: var(--font-mono);
    font-weight: 500;
}

.funding-value.up {
    color: var(--up);
}

.funding-value.down {
    color: var(--down);
}

.funding-countdown {
    color: var(--text-muted);
    font-family: var(--font-mono);
}

/* ====================================
   PRICE ALERTS / ALARMS
   ==================================== */
.alert-panel {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    padding: 16px;
}

.alert-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.alert-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.btn-add-alert {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-size: 16px;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.btn-add-alert:hover {
    background: var(--accent-hover);
}

.alert-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.alert-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--accent);
}

.alert-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-icon {
    font-size: 16px;
}

.alert-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.alert-condition {
    font-size: 12px;
    color: var(--text-primary);
    font-weight: 500;
}

.alert-price {
    font-size: 11px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.alert-actions {
    display: flex;
    gap: 4px;
}

.alert-btn {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 14px;
    cursor: pointer;
    border-radius: var(--radius-xs);
}

.alert-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.alert-btn.delete:hover {
    background: var(--down-light);
    color: var(--down);
}

.no-alerts {
    text-align: center;
    padding: 24px;
    color: var(--text-muted);
    font-size: 12px;
}

/* Alert Modal */
.alert-modal-content {
    padding: 20px;
}

.alert-type-select {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.alert-type-btn {
    flex: 1;
    padding: 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.alert-type-btn.active {
    background: var(--accent-light);
    border-color: var(--accent);
    color: var(--accent);
}

/* ====================================
   ORDER ITEM STYLES
   ==================================== */
.order-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
}

.order-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.order-side {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: var(--radius-xs);
    text-transform: uppercase;
}

.order-side.buy {
    background: var(--up-light);
    color: var(--up);
}

.order-side.sell {
    background: var(--down-light);
    color: var(--down);
}

.order-price,
.order-qty {
    font-size: 12px;
    font-family: var(--font-mono);
    color: var(--text-secondary);
}

.btn-cancel {
    padding: 4px 10px;
    background: transparent;
    border: 1px solid var(--down);
    color: var(--down);
    font-size: 11px;
    cursor: pointer;
    border-radius: var(--radius-xs);
    transition: all var(--transition-fast);
}

.btn-cancel:hover {
    background: var(--down);
    color: white;
}

/* ====================================
   CHART LINE OVERLAYS (TP/SL/Limit like Bybit)
   ==================================== */
.chart-line-overlay {
    position: absolute;
    left: 0;
    right: 70px;
    height: 26px;
    display: flex;
    align-items: center;
    z-index: 30;
    pointer-events: none;
}

.chart-line-overlay::before {
    content: '';
    flex: 1;
    border-top: 2px dashed;
    opacity: 0.6;
}

.line-label {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 600;
    font-family: var(--font-mono);
    border-radius: var(--radius-sm);
    pointer-events: auto;
    cursor: pointer;
}

.line-label .price {
    margin-right: 4px;
}

.line-label .qty {
    font-size: 10px;
    padding: 1px 4px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
}

.line-label .close-btn {
    margin-left: 4px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.line-label .close-btn:hover {
    opacity: 1;
}

/* TP Line (Take Profit) - Red */
.chart-line-overlay.tp::before {
    border-color: var(--down);
}

.chart-line-overlay.tp .line-label {
    background: var(--down);
    color: white;
}

/* SL Line (Stop Loss) - Green */
.chart-line-overlay.sl::before {
    border-color: var(--up);
}

.chart-line-overlay.sl .line-label {
    background: var(--up);
    color: white;
}

/* Limit Order Line - with border */
.chart-line-overlay.limit::before {
    border-color: var(--up);
}

.chart-line-overlay.limit .line-label {
    background: transparent;
    border: 1px solid var(--up);
    color: var(--up);
}

/* Breakeven Line */
.chart-line-overlay.breakeven::before {
    border-color: var(--text-muted);
    border-style: solid;
}

.chart-line-overlay.breakeven .line-label {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

/* P&L Label */
.pnl-label-box {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--up);
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-family: var(--font-mono);
    color: var(--up);
}

.pnl-label-box.negative {
    border-color: var(--down);
    color: var(--down);
}

.pnl-actions {
    display: flex;
    gap: 2px;
    margin-left: 6px;
}

/* ====================================
   DETAILED HISTORY ITEMS
   ==================================== */
.history-item-detailed {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    margin-bottom: 10px;
    border-left: 3px solid var(--border);
}

.history-left {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.history-symbol-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.history-symbol {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.history-leverage {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    background: var(--bg-primary);
    border-radius: var(--radius-xs);
    color: var(--text-secondary);
}

.history-times {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.time-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
}

.time-label {
    color: var(--text-muted);
    width: 28px;
}

.time-value {
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

.history-pnl {
    font-size: 16px;
    font-weight: 700;
    font-family: var(--font-mono);
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.history-pnl .pnl-currency {
    font-size: 10px;
    font-weight: 500;
    color: var(--text-muted);
}

/* (Redundant definition removed) */

/* (Redundant resize-handle removed) */

.detail-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}

.detail-symbol-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.detail-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
    color: white;
}

.detail-symbol-text {
    display: flex;
    align-items: center;
}

.detail-symbol-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.detail-contract {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    font-size: 12px;
    color: var(--text-secondary);
}

.detail-exchange {
    color: var(--accent);
    font-weight: 500;
}

.detail-type {
    padding: 0 16px 8px;
    font-size: 11px;
    color: var(--text-muted);
}

.detail-price-section {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
}

.detail-main-price {
    font-size: 28px;
    font-weight: 700;
    font-family: var(--font-mono);
    letter-spacing: -0.5px;
}

.detail-change {
    font-size: 13px;
    font-weight: 500;
    font-family: var(--font-mono);
    margin-top: 4px;
}

.detail-market-status {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    font-size: 11px;
    color: var(--text-muted);
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

/* ====================================
   POSITIONS LIST WRAPPER
   ==================================== */
.positions-list-wrapper,
.history-list-wrapper {
    padding: 16px;
}

/* ====================================
   HISTORY FILTER (Already added, but ensuring structure)
   ==================================== */
.history-pnl-chart {
    min-height: 60px;
}

/* ====================================
   DETAIL STATS SECTION
   ==================================== */
.detail-stats {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
}

.detail-stats-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 10px;
}

.detail-stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 12px;
}

.detail-stat-row .stat-label {
    color: var(--text-secondary);
}

.detail-stat-row .stat-value {
    font-family: var(--font-mono);
    color: var(--text-primary);
    font-weight: 500;
}

/* ====================================
   CLEAN POSITIONS PANEL
   ==================================== */
/* ====================================
   CLEAN POSITIONS PANEL (Bybit Style)
   ==================================== */
.position-info-panel {
    background: #000;
    /* Deep black as in image */
    padding: 16px;
    color: #fff;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.pos-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.pos-symbol-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pos-top-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pos-symbol {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
}

.pos-side-badge {
    font-size: 12px;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 12px;
}

.pos-side-badge.long {
    background: rgba(34, 171, 148, 0.2);
    color: #22ab94;
}

.pos-side-badge.short {
    background: rgba(242, 54, 69, 0.2);
    color: #f23645;
}

.pos-sub-row {
    font-size: 12px;
    color: #888;
}

.pos-pnl-group {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.pos-pnl-label {
    font-size: 11px;
    color: #888;
    margin-bottom: 4px;
}

.pos-pnl-value {
    font-size: 18px;
    font-weight: 700;
    font-family: var(--font-mono);
}

.pos-pnl-value.up {
    color: #22ab94;
}

.pos-pnl-value.down {
    color: #f23645;
}

.pos-grid-v2 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.pos-item-v2 {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pos-item-label {
    font-size: 11px;
    color: #555;
    white-space: nowrap;
}

.pos-item-value {
    font-size: 14px;
    font-weight: 600;
    font-family: var(--font-mono);
}

.pos-item-value.liq {
    color: #f7931a;
    /* Orange for liquidation price */
}

.pos-tp-sl-bar {
    background: #111;
    border-radius: 20px;
    padding: 10px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    font-size: 12px;
}

.pos-tp-sl-label {
    color: #555;
    font-weight: 600;
}

.pos-tp-sl-values {
    color: #888;
}

.pos-tp-sl-values .tp {
    color: #22ab94;
}

.pos-tp-sl-values .sl {
    color: #f23645;
}

.pos-actions-v2 {
    display: flex;
    gap: 10px;
}

.btn-pos-action {
    flex: 1;
    padding: 10px 0;
    background: transparent;
    border: 1px solid #333;
    border-radius: 20px;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.btn-pos-action:hover {
    background: #222;
    border-color: #555;
}


/* TP/SL Compact */
.pos-tpsl {
    margin-bottom: 12px;
}

.tpsl-compact {
    display: flex;
    gap: 8px;
    align-items: center;
}

.tpsl-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tpsl-item label {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
}

.tpsl-compact-input {
    padding: 8px 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-family: var(--font-mono);
    color: var(--text-primary);
    outline: none;
}

.tpsl-compact-input:focus {
    border-color: var(--accent);
}

.btn-sm {
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-sm.primary {
    background: var(--accent);
    color: white;
}

.btn-sm.primary:hover {
    filter: brightness(1.1);
}

/* Close Position Actions */
.pos-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.btn-close-position {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-close-position.market {
    background: var(--down);
    color: white;
}

.btn-close-position.limit {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-close-position:hover {
    filter: brightness(1.1);
}

/* Technical Analysis in Positions */
.pos-ta-section {
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
}

.pos-ta-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.ta-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.ta-recommendation {
    font-size: 12px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
}

.ta-recommendation.up {
    background: var(--up-light);
    color: var(--up);
}

.ta-recommendation.down {
    background: var(--down-light);
    color: var(--down);
}

.ta-recommendation.neutral {
    background: var(--bg-primary);
    color: var(--text-secondary);
}

.ta-indicators {
    display: flex;
    gap: 6px;
}

.ta-indicator {
    flex: 1;
    padding: 8px;
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    text-align: center;
}

.ta-ind-name {
    display: block;
    font-size: 10px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.ta-ind-value {
    display: block;
    font-size: 12px;
    font-weight: 600;
    font-family: var(--font-mono);
    color: var(--text-primary);
}

.ta-ind-value.up {
    color: var(--up);
}

.ta-ind-value.down {
    color: var(--down);
}

/* Alarm Button Full Width */
.btn-alarm-full {
    width: 100%;
    padding: 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-alarm-full:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
    color: var(--text-primary);
}

/* Position List Header */
.pos-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

.btn-refresh-sm {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-refresh-sm:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    transform: rotate(180deg);
}

/* Mini Position Card */
.position-card-mini {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    background: var(--bg-secondary);
    border-left: 3px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
}

.position-card-mini:hover {
    background: var(--bg-tertiary);
}

.position-card-mini.active {
    background: var(--bg-tertiary);
}

.position-card-mini.long {
    border-left-color: var(--up);
}

.position-card-mini.short {
    border-left-color: var(--down);
}

.pos-card-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pos-card-symbol {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.pos-card-lev {
    font-size: 9px;
    padding: 1px 4px;
    background: var(--bg-primary);
    border-radius: 2px;
    color: var(--text-muted);
}

.pos-card-side {
    font-size: 9px;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 3px;
}

.pos-card-side.long {
    background: var(--up-light);
    color: var(--up);
}

.pos-card-side.short {
    background: var(--down-light);
    color: var(--down);
}

.pos-card-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.pos-card-size {
    font-size: 11px;
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

.pos-card-pnl {
    font-size: 12px;
    font-weight: 600;
    font-family: var(--font-mono);
}

/* ====================================
   ALARM MODAL STYLES
   ==================================== */
.alarm-modal {
    max-width: 400px;
}

.alarm-symbol-display {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    margin-bottom: 16px;
}

.alarm-symbol-display #alarm-symbol {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.alarm-current-price {
    font-size: 18px;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--accent);
}

.alarm-condition-btns {
    display: flex;
    gap: 8px;
}

.alarm-condition-btn {
    flex: 1;
    padding: 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.alarm-condition-btn:hover {
    border-color: var(--accent);
}

.alarm-condition-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.alarm-notify-options {
    display: flex;
    gap: 16px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
}

.alarm-error {
    padding: 10px;
    background: var(--down-light);
    border-radius: var(--radius-sm);
    color: var(--down);
    font-size: 12px;
    margin-bottom: 12px;
}

.active-alarms {
    margin-top: 20px;
    border-top: 1px solid var(--border);
    padding-top: 16px;
}

.active-alarms-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.active-alarms-list {
    max-height: 150px;
    overflow-y: auto;
}

.alarm-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
}

.alarm-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.alarm-condition {
    font-size: 14px;
    font-weight: 600;
    font-family: var(--font-mono);
    color: var(--text-primary);
}

.alarm-options {
    font-size: 12px;
}

.alarm-delete-btn {
    width: 24px;
    height: 24px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
}

.alarm-delete-btn:hover {
    background: var(--down-light);
    color: var(--down);
}

.no-alarms {
    text-align: center;
    padding: 16px;
    color: var(--text-muted);
    font-size: 12px;
}

/* ====================================
   CHART POSITION LINES OVERLAY
   ==================================== */
.position-lines-overlay {
    position: absolute;
    top: 0;
    left: 60px;
    right: 60px;
    bottom: 25px;
    pointer-events: none;
    z-index: 15;
}

.chart-position-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 0;
    pointer-events: auto;
}

.chart-position-line .line-dash {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    border-top: 2px dashed transparent;
}

.chart-position-line.entry .line-dash {
    border-color: var(--accent);
}

.chart-position-line.tp .line-dash {
    border-color: var(--up);
}

.chart-position-line.sl .line-dash {
    border-color: #f0b90b;
}

.chart-position-line .line-label {
    position: absolute;
    left: 0;
    top: -12px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 600;
    font-family: var(--font-mono);
    white-space: nowrap;
}

.chart-position-line.entry .line-label {
    background: var(--accent);
    color: white;
    border: 1px solid var(--accent);
}

.chart-position-line.tp .line-label {
    background: var(--bg-secondary);
    color: var(--up);
    border: 1px solid var(--up);
}

.chart-position-line.sl .line-label {
    background: var(--bg-secondary);
    color: #f0b90b;
    border: 1px solid #f0b90b;
}

.line-qty {
    padding-right: 6px;
    border-right: 1px solid rgba(255, 255, 255, 0.3);
}

.line-pnl {
    font-weight: 500;
}

.line-pnl.up {
    color: var(--up);
}

.line-pnl.down {
    color: var(--down);
}

.chart-position-line.entry .line-pnl.up {
    color: white;
    opacity: 0.9;
}

.line-type {
    padding-right: 6px;
    border-right: 1px solid rgba(255, 255, 255, 0.2);
}

.line-close {
    margin-left: 6px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.15s ease;
}

.line-close:hover {
    opacity: 1;
}

/* ====================================
   TOOLTIP SIGNALS SECTION
   ==================================== */
.tooltip-signals {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.tooltip-signals-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.signal-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    margin-bottom: 4px;
    font-size: 11px;
}

.signal-row.buy {
    background: var(--up-light);
    border-left: 3px solid var(--up);
}

.signal-row.sell {
    background: var(--down-light);
    border-left: 3px solid var(--down);
}

.signal-icon {
    font-size: 12px;
}

.signal-reason {
    flex: 1;
    font-weight: 500;
    color: var(--text-primary);
}

.signal-strength {
    font-size: 10px;
    color: var(--text-muted);
    letter-spacing: -1px;
}

/* Indicator Value Coloring */
.indicator-value.up {
    color: var(--up) !important;
}

.indicator-value.down {
    color: var(--down) !important;
}

/* ====================================
   INDICATOR PANEL ENHANCEMENTS
   ==================================== */
.indicator-section {
    margin-bottom: 12px;
}

.section-title {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    padding-left: 4px;
}

.indicator-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.indicator-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.indicator-btn:hover {
    background: var(--bg-hover);
    border-color: var(--border-light);
    color: var(--text-primary);
}

.indicator-btn.active {
    background: var(--accent-light);
    border-color: var(--accent);
    color: var(--accent);
}

.indicator-color {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.indicator-name {
    font-family: var(--font-family);
}

.active-indicators {
    margin-top: 16px;
}

.active-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.active-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 11px;
}

.active-item .indicator-name {
    flex: 1;
    color: var(--text-secondary);
}

.remove-btn {
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 14px;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.15s ease;
}

.remove-btn:hover {
    background: var(--down-light);
    color: var(--down);
}

.no-indicators {
    text-align: center;
    padding: 16px;
    color: var(--text-muted);
    font-size: 11px;
}

/* ====================================
   RESIZABLE INDICATOR PANEL
   ==================================== */
.indicator-panel-container {
    position: relative;
    width: 100%;
    height: 0;
    flex: 0 0 auto;
    background: var(--bg-primary);
    border-top: none;
    overflow: hidden;
    transition: height 0.3s ease, border-top 0.3s ease;
}

.indicator-panel-container.visible {
    height: 200px;
    border-top: 1px solid var(--border);
}


.indicator-panel-resize-handle {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    cursor: ns-resize;
    background: transparent;
    z-index: 10;
}

.indicator-panel-resize-handle:hover,
.indicator-panel-resize-handle.dragging {
    background: var(--accent);
    opacity: 0.5;
}

/* ====================================
   SIGNAL ALERTS BADGE
   ==================================== */
.signal-alert-badge {
    position: fixed;
    top: 60px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    z-index: 1000;
    animation: slideIn 0.3s ease;
}

.signal-alert-badge.buy {
    border-left: 4px solid var(--up);
}

.signal-alert-badge.sell {
    border-left: 4px solid var(--down);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.signal-alert-icon {
    font-size: 20px;
}

.signal-alert-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.signal-alert-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.signal-alert-message {
    font-size: 11px;
    color: var(--text-secondary);
}

.signal-alert-close {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
}

.signal-alert-close:hover {
    color: var(--text-primary);
}

/* ====================================
   COMPACT TECHNICAL ANALYSIS
   ==================================== */
.detail-ta-compact {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: 12px;
    margin-top: 8px;
}

.ta-compact-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.ta-compact-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ta-compact-verdict {
    font-size: 12px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    background: var(--bg-hover);
}

.ta-compact-verdict.up {
    background: var(--up-light);
    color: var(--up);
}

.ta-compact-verdict.down {
    background: var(--down-light);
    color: var(--down);
}

.ta-compact-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.ta-compact-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 8px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
}

.ta-compact-label {
    font-size: 10px;
    color: var(--text-muted);
}

.ta-compact-value {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-primary);
}

.ta-compact-value.up {
    color: var(--up);
}

.ta-compact-value.down {
    color: var(--down);
}

.ta-compact-signals {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

/* ====================================
   NEW TECHNICAL ANALYSIS PANEL
   ==================================== */
.detail-ta-container {
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    margin-top: 12px;
}

.ta-section-header {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.ta-group {
    margin-bottom: 24px;
}

.ta-group-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 12px;
}

.ta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.ta-row:last-child {
    border-bottom: none;
}

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

.ta-value {
    font-size: 12px;
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--text-primary);
    margin-left: auto;
    margin-right: 12px;
}

.ta-status {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: var(--radius-xs);
    min-width: 44px;
    text-align: center;
}

.ta-status.neutral {
    background: var(--bg-tertiary);
    color: var(--text-muted);
}

.ta-status.up {
    background: var(--up-light);
    color: var(--up);
}

.ta-status.down {
    background: var(--down-light);
    color: var(--down);
}

.ta-row.fib {
    padding: 6px 0;
}

.ta-row.fib .ta-label {
    font-size: 11px;
    color: var(--text-muted);
}

.ta-row.fib .ta-value {
    font-size: 11px;
    margin-right: 0;
}

.ta-row.current-pos {
    margin-top: 8px;
    padding: 10px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    border-bottom: none;
}

.ta-row.current-pos .ta-label {
    font-weight: 600;
    color: var(--text-primary);
}

.ta-row.current-pos .ta-value {
    color: var(--accent);
    margin-right: 0;
}

.ta-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    padding: 14px;
    background: linear-gradient(to right, var(--bg-tertiary), var(--bg-secondary));
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.ta-summary-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
}

.ta-summary-value {
    font-size: 14px;
    font-weight: 800;
    padding: 4px 12px;
    border-radius: var(--radius-sm);
    background: var(--bg-active);
}

.ta-summary-value.up {
    color: var(--up);
    background: var(--up-light);
}

.ta-summary-value.down {
    color: var(--down);
    background: var(--down-light);
}

.ta-signals {
    margin-top: 20px;
}

/* Sentiment & Range Visuals */
.sentiment-container,
.range-container {
    padding: 12px 0;
}

.sentiment-labels {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 11px;
    font-weight: 700;
}

.sentiment-labels .long {
    color: var(--up);
}

.sentiment-labels .short {
    color: var(--down);
}

.sentiment-bar {
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    display: flex;
    overflow: hidden;
    margin-bottom: 8px;
}

.sentiment-fill {
    height: 100%;
    transition: width 0.3s ease;
}

.sentiment-fill.long {
    background: var(--up);
}

.sentiment-fill.short {
    background: var(--down);
}

.sentiment-desc {
    font-size: 10px;
    color: var(--text-muted);
    text-align: center;
}

.range-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 11px;
    font-family: var(--font-mono);
    color: var(--text-secondary);
}

.range-bar {
    height: 4px;
    background: linear-gradient(to right, var(--down), var(--bg-tertiary), var(--up));
    border-radius: 2px;
    position: relative;
    margin: 10px 0;
}

.range-marker {
    position: absolute;
    top: -6px;
    width: 2px;
    height: 16px;
    background: #fff;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.8);
    transition: left 0.3s ease;
}

@media (max-width: 768px) {

    .left-sidebar.visible,
    .indicator-sidebar-panel.visible {
        position: fixed;
        top: var(--header-height);
        left: 0;
        width: 100%;
        height: calc(100% - var(--header-height));
        z-index: 900;
        border-right: none;
    }

    .indicator-sidebar-panel.visible {
        z-index: 901;
        /* Higher than left sidebar if both open */
    }
}

/* Mini Position View */
.mini-position-view {
    position: absolute;
    top: 60px;
    /* Below OHLC Label */
    left: 12px;
    z-index: 40;
    background: rgba(30, 34, 45, 0.9);
    backdrop-filter: blur(4px);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    padding: 8px 12px;
    display: none;
    /* Hidden by default */
    flex-direction: column;
    gap: 4px;
    min-width: 140px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    pointer-events: auto;
    /* Allow interaction if needed */
    transition: opacity 0.2s;
}

.mini-position-view.visible {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.mpv-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.mpv-symbol {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 13px;
}

.mpv-side {
    font-size: 11px;
    font-weight: 600;
    padding: 1px 4px;
    border-radius: 3px;
}

.mpv-side.long {
    color: var(--up-bright);
    background: var(--up-light);
}

.mpv-side.short {
    color: var(--down-bright);
    background: var(--down-light);
}

.mpv-pnl-value {
    font-family: var(--font-mono);
    font-size: 15px;
    font-weight: 700;
}

.mpv-pnl-value.up {
    color: var(--up-bright);
}

.mpv-pnl-value.down {
    color: var(--down-bright);
}

.mpv-roe {
    font-size: 11px;
    color: var(--text-secondary);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Position Context Log */
.pcl-header {
    font-weight: 500;
}

.pcl-item {
    padding: 2px 0;
    border-bottom: 1px solid rgba(42, 46, 57, 0.4);
}

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

.up-text {
    color: var(--up-bright);
}

.down-text {
    color: var(--down-bright);
}

/* Updated Mini Position View - Compact & Draggable */
.mini-position-view {
    position: absolute;
    top: 50px;
    /* Adjusted to be clearly visible */
    left: 10px;
    z-index: 100 !important;
    /* Force on top */

    background: #1e222d;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3), 0 0 0 1px #2a2e39;
    /* Explicit border/shadow */
    border-radius: 4px;
    padding: 4px 8px;

    display: none;
    /* Controlled by JS */
    flex-direction: column;
    gap: 2px;
    min-width: 110px;

    pointer-events: auto;
    transition: opacity 0.2s;
    user-select: none;
}

/* Ensure visible class works */
.mini-position-view.visible {
    display: flex !important;
}

/* Compact rows */
.mpv-row {
    gap: 8px;
    height: 18px;
    /* Fixed height for consistency */
}

.mpv-symbol {
    font-size: 11px;
    font-weight: 600;
}

.mpv-side {
    font-size: 9px;
    padding: 0 3px;
    border-radius: 2px;
    line-height: 12px;
}

.mpv-pnl-value {
    font-size: 11px;
    font-weight: 600;
}

.mpv-roe {
    font-size: 9px;
}

/* Drag Handle */
.mpv-drag-handle {
    width: 100%;
    height: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: grab;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 2px;
    color: var(--text-muted);
    font-size: 10px;
    line-height: 0;
}

.mpv-drag-handle:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
}

.mpv-drag-handle:active {
    cursor: grabbing;
    background: rgba(255, 255, 255, 0.1);
}

.mpv-drag-icon {
    font-size: 12px;
    font-weight: bold;
    user-select: none;
}
/* ... existing styles ... */

/* Toggle Switch Styles */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #363a45;
    transition: .4s;
    border-radius: 20px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: #b2b5be;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background-color: var(--accent);
}

input:checked + .toggle-slider:before {
    transform: translateX(20px);
    background-color: #fff;
}

/* Settings Status Badges */
.status-badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.status-badge.connected {
    background: rgba(38, 166, 154, 0.15);
    color: var(--up);
    border: 1px solid rgba(38, 166, 154, 0.3);
}

.status-badge.disconnected {
    background: rgba(239, 83, 80, 0.15);
    color: var(--down);
    border: 1px solid rgba(239, 83, 80, 0.3);
}

.settings-info-card {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: 12px;
    margin-bottom: 16px;
}

.settings-item-value {
    font-family: var(--font-mono);
    color: var(--text-primary);
    font-size: 13px;
}

.input-sm {
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    color: var(--text-primary);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
}

.input-sm:focus {
    border-color: var(--accent);
    outline: none;
}

.settings-divider {
    height: 1px;
    background: var(--border);
    margin: 16px 0;
}

.btn-danger {
    background: rgba(239, 83, 80, 0.1);
    color: var(--down);
    border: 1px solid rgba(239, 83, 80, 0.3);
    padding: 10px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-danger:hover {
    background: rgba(239, 83, 80, 0.2);
}
