:root {
    /* Strict Semantic Palette */
    --tv-bg: #121212;
    /* Off-black */
    --tv-sidebar: #1a1a1a;
    --tv-border: rgba(255, 255, 255, 0.08);
    --tv-hover: rgba(255, 255, 255, 0.05);

    --tv-text: #e0e0e0;
    --tv-text-dim: #9e9e9e;
    --text-bright: #ffffff;
    --text-muted: #9e9e9e;

    /* Semantic Colors */
    --color-profit: #089981;
    /* Green: confirmed profit */
    --color-danger: #f23645;
    /* Red: danger / stop */
    --color-warning: #ffea00;
    /* Yellow: warning / wait */
    --color-scan: #2979ff;
    /* Blue: active scan */

    /* Generic UI Accent */
    --tv-accent: #e0e0e0;
    /* Neutral active state */
    --tv-accent-hover: #ffffff;

    /* Legacy JS variable aliases mapped to semantic colors */
    --tv-buy: var(--color-profit);
    --tv-sell: var(--color-danger);
    --tv-buy-bg: rgba(8, 153, 129, 0.15);
    --tv-sell-bg: rgba(242, 54, 69, 0.15);
    --buy-green: var(--color-profit);
    --sell-red: var(--color-danger);
    --sell: var(--color-danger);
    --accent-cyan: var(--color-scan);

    /* Layout Constants */
    --tools-width: 0px;
    --header-height: calc(64px + env(safe-area-inset-top, 0px));
    --radius: 6px;
    --glass: blur(12px);

    --font-main: 'Inter', sans-serif;
    --font-mono: 'Inter', sans-serif;

    --tv-bg-darker: #0d0d0d;
    --tv-bg-lighter: rgba(255, 255, 255, 0.1);
    --tv-bg-alt: #1a1a1a;
}

body.light-mode {
    --tv-bg: #f5f5f5;
    /* Soft white */
    --tv-sidebar: #ffffff;
    --tv-border: rgba(0, 0, 0, 0.1);
    --tv-hover: rgba(0, 0, 0, 0.05);

    --tv-text: #212121;
    --tv-text-dim: #757575;
    --text-bright: #000000;
    --text-muted: #616161;

    --tv-accent: #1a1a1a;
    /* Neutral active state */
    --tv-accent-hover: #000000;

    --tv-bg-darker: #eeeeee;
    --tv-bg-lighter: rgba(0, 0, 0, 0.1);
    --tv-bg-alt: #fafafa;
}

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

body {
    background-color: var(--tv-bg);
    color: var(--tv-text);
    font-family: var(--font-main);
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    font-size: 12px;
    height: 100vh;
    height: 100dvh;
    width: 100vw;
    overflow: hidden;
    touch-action: pan-x pan-y;
    -ms-touch-action: pan-x pan-y;
}

#loginOverlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(8px);
}

#loginOverlay.hidden {
    display: none !important;
}

.terminal-auth-card {
    width: min(360px, 100%);
    padding: 28px;
    border: 1px solid #333945;
    border-radius: 8px;
    background: #11151d;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
}

.terminal-auth-mark {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    margin-bottom: 18px;
    border-radius: 6px;
    background: rgba(41, 98, 255, 0.16);
    color: #7da2ff;
}

.terminal-auth-card h1 {
    margin: 0 0 8px;
    color: #fff;
    font-size: 20px;
    font-weight: 700;
}

#terminalAuthMessage,
.terminal-auth-hint {
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.5;
}

#terminalAuthMessage {
    min-height: 18px;
    margin: 0 0 18px;
}

.terminal-auth-card label {
    display: block;
    margin-bottom: 6px;
    color: #d6d9e0;
    font-size: 11px;
    font-weight: 600;
}

#terminalAuthInput {
    width: 100%;
    height: 42px;
    box-sizing: border-box;
    padding: 0 12px;
    border: 1px solid #3b424f;
    border-radius: 5px;
    outline: 0;
    background: #090c11;
    color: #fff;
    font: inherit;
}

#terminalAuthInput:focus {
    border-color: #5f87ff;
    box-shadow: 0 0 0 2px rgba(41, 98, 255, 0.2);
}

#terminalAuthSave {
    width: 100%;
    height: 40px;
    margin-top: 12px;
    border: 0;
    border-radius: 5px;
    background: #2962ff;
    color: #fff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

#terminalAuthSave:hover {
    background: #3f73ff;
}

#terminalAuthSave:disabled {
    cursor: wait;
    opacity: 0.55;
}

.terminal-auth-hint {
    margin: 12px 0 0;
}

/* ─── Grid Layout ─── */

/* Keep the whole app inside the visible viewport on mobile. With
   viewport-fit=cover the bottom home-indicator / browser toolbar overlaps
   content, which was hiding the chart's time-axis (bar timestamps). Reserve
   that inset so the time axis stays visible. */
.terminal-container {
    height: 100vh;
    height: 100dvh;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

.terminal-container.resizing {
    transition: none !important;
}

.terminal-container.resizing * {
    transition: none !important;
    user-select: none;
}

.glass-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.03) 0%, rgba(0, 0, 0, 0.2) 100%);
    pointer-events: none;
}

.sidebar-tab {
    flex: 1;
    padding: 12px;
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    color: var(--tv-text-dim);
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 2px solid transparent;
}

.sidebar-tab.active {
    color: #fff;
    border-bottom-color: var(--tv-accent);
    background: rgba(255, 255, 255, 0.05);
}

.terminal-container.sidebar-collapsed .right-rail-container .rail-flyout {
    width: 0 !important;
}

.right-rail-container {
    position: relative;
    z-index: 1300;
    --desktop-rail-width: 84px;
    --desktop-flyout-max-width: calc(100vw - var(--desktop-rail-width) - 16px);
}

.terminal-container.bottom-collapsed {
    --bottom-height: 34px !important;
}

.bottom-collapsed .quick-switch-bar {
    display: none !important;
}

.sidebar-resizer {
    display: none;
}

.terminal-container.full-screen-mode {
    --bottom-height: 0px;
    --header-height: 0px;
    --tools-width: 0px;
}

.terminal-container.full-screen-mode .right-rail-container {
    display: none;
}

/* ─── Header ─── */
/* ─── Header (Unified Toolbar) ─── */


.top-left {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.top-ticker-hud {
    display: flex;
    align-items: center;
    gap: 16px;
    font-family: var(--font-main);
    font-variant-numeric: tabular-nums;
    cursor: pointer;
    white-space: nowrap;
    margin-right: 12px;
}

.top-ticker-hud span {
    font-size: 16px !important;
    font-weight: 700 !important;
    white-space: nowrap;
}

#topDollarChange {
    font-weight: 500;
    margin-left: 2px;
}

#topSymbol {
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.5px;
    flex-shrink: 0;
}

.symbol-search-container {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--tv-border);
    border-radius: var(--radius);
    padding: 2px 8px;
    transition: border-color 0.2s;
}

.symbol-search-container:focus-within {
    border-color: var(--tv-accent);
}

/* Always open on desktop — the symbol search is the primary action.
   Mobile collapses it back to the icon via the responsive rule below. */
.symbol-search-container input {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 11px;
    width: 130px;
    padding: 2px;
    opacity: 1;
    outline: none;
    transition: width 0.15s ease, opacity 0.15s ease;
}

.symbol-search-container:focus-within input,
.symbol-search-container.expanded input {
    width: 90px;
    padding: 2px;
    opacity: 1;
}

.symbol-search-container i {
    color: var(--tv-text-dim);
    font-size: 12px;
}

.symbol-search-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    color: var(--tv-text-dim);
    background: transparent;
    border: 0;
    cursor: pointer;
}

.symbol-input-wrap {
    position: relative;
    display: flex;
    flex-direction: column;
}

.recent-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    width: 100%;
    min-width: 150px;
    background: #1e222d;
    border: 1px solid var(--tv-border);
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: none;
    max-height: 200px;
    overflow-y: auto;
}

.recent-dropdown.visible {
    display: block;
}

.recent-item {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 12px;
    color: var(--tv-text);
    transition: background 0.1s;
}

.recent-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.header-watchlist-menu {
    position: relative;
    flex-shrink: 0;
    margin-left: 6px;
}

.header-watchlist-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 30px;
    padding: 0 9px;
    color: #d9eef0;
    background: rgba(35, 240, 199, 0.08);
    border: 1px solid rgba(35, 240, 199, 0.32);
    border-radius: 7px;
    font-family: var(--font-main);
    font-size: 10px;
    font-weight: 800;
    cursor: pointer;
}

.header-watchlist-pill i {
    color: #23f0c7;
    font-size: 11px;
}


.header-watchlist-pill strong {
    max-width: 58px;
    overflow: hidden;
    color: #fff;
    font-size: 12px;
    text-overflow: ellipsis;
}

.header-watchlist-pill small {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    color: #061713;
    background: #23f0c7;
    border-radius: 999px;
    font-size: 9px;
    font-weight: 900;
}

.header-watchlist-pill strong,
.header-watchlist-pill small {
    display: none;
}

.header-watchlist-pill .fa-star {
    color: #fff;
}

.header-watchlist-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 1100;
    display: none;
    width: 190px;
    max-height: 320px;
    overflow-y: auto;
    padding: 5px;
    background: #121721;
    border: 1px solid var(--tv-border);
    border-radius: 8px;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.55);
}

.header-watchlist-menu.open .header-watchlist-dropdown {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.header-watchlist-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 24px;
    align-items: center;
    min-height: 30px;
    border-radius: 6px;
}

.header-watchlist-item.active {
    background: rgba(35, 240, 199, 0.12);
}

.header-watchlist-symbol,
.header-watchlist-remove {
    height: 30px;
    color: var(--tv-text);
    background: transparent;
    border: 0;
    font-family: var(--font-main);
    cursor: pointer;
}

.header-watchlist-symbol {
    overflow: hidden;
    padding: 0 9px;
    font-size: 12px;
    font-weight: 800;
    text-align: left;
    text-overflow: ellipsis;
}

.header-watchlist-remove {
    color: var(--tv-text-dim);
    font-size: 15px;
}

.header-watchlist-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.header-watchlist-item.active .header-watchlist-symbol {
    color: #23f0c7;
}

.header-watchlist-remove:hover {
    color: var(--sell-red);
}

.header-watchlist-empty {
    padding: 10px;
    color: var(--tv-text-dim);
    font-size: 11px;
    white-space: normal;
}

.symbol-search {
    display: flex;
    position: relative;
}

.symbol-search input {
    background: var(--tv-bg);
    border: 1px solid var(--tv-border);
    color: var(--tv-text);
    padding: 4px 12px;
    font-size: 12px;
    border-radius: var(--radius);
    width: 140px;
}

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

.account-summary-minimal {
    display: flex;
    gap: 16px;
    border-left: 1px solid var(--tv-border);
    padding-left: 16px;
}

.system-status-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.terminal-pill {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--tv-border);
    padding: 2px 6px;
    border-radius: 100px;
    font-size: 10px;
    color: var(--tv-text-dim);
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ─── Indicator Menu ─── */
.indicator-menu-container {
    position: relative;
    margin-left: 12px;
}

.indicator-menu-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--tv-text);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
}

.indicator-menu-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.indicator-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    width: 180px;
    background: #1e222d;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

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

.ind-menu-item {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.1s;
    font-size: 12px;
}

.ind-menu-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.ind-menu-item.active .check-icon {
    display: block;
}

.ind-menu-item .check-icon {
    margin-left: auto;
    font-size: 10px;
    color: var(--tv-buy);
    display: none;
}

.indicator-toggles {
    display: flex;
    gap: 8px;
    margin-left: 8px;
    padding-left: 16px;
    border-left: 1px solid var(--tv-border);
}

.ind-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    background: transparent;
    transition: background 0.2s;
}

.ind-pill:hover {
    background: var(--tv-hover);
}

.ind-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.ind-name {
    font-size: 11px;
    font-weight: 600;
    color: var(--tv-text-dim);
}

.ind-pill.active .ind-name {
    color: #fff;
}

.stat-label {
    font-size: 9px;
    text-transform: uppercase;
    color: var(--tv-text-dim);
    font-weight: 700;
    display: block;
    line-height: 1;
    margin-bottom: 2px;
}

/* ─── Sidebar Tab Buttons (Krug: visible, scannable navigation) ─── */
.sidebar-tabs-row {
    display: flex;
    flex: 1;
    align-items: center;
    height: 100%;
    background: rgba(0, 0, 0, 0.15);
}

.sidebar-tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--tv-text-dim);
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 0.5px;
    height: 100%;
    transition: all 0.2s ease;
    border-bottom: 2px solid transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 0 4px;
}

.sidebar-tab-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.03);
}

.sidebar-tab-btn.active {
    color: #fff;
    border-bottom: 2px solid var(--tv-accent);
    background: rgba(255, 255, 255, 0.05);
}

/* ─── Main Content (Chart) ─── */


.chart-area {
    flex: 1;
    min-height: 0;
    min-width: 0;
    position: relative;
    padding: 0;
    /* Hand every touch gesture to the chart library so pinch zooms the chart,
       never the page. */
    touch-action: none;
}

.chart-legend {
    display: none !important;
}

#legendSymbol {
    font-weight: 700;
    color: #fff;
    margin-right: 4px;
}

.chart-legend span span {
    color: #fff;
}

/* ─── Right Rail Container ─── */


/* ─── Vertical Tab Rail ─── */
.mobile-primary-tab,
.mobile-chain-modes {
    display: none;
}

.right-tab-rail {
    width: var(--desktop-rail-width, 84px);
    min-width: var(--desktop-rail-width, 84px);
    background: rgba(20, 24, 33, 0.95);
    backdrop-filter: var(--glass);
    border-right: 1px solid var(--tv-border);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 0;
    gap: 2px;
    z-index: 20;
    overflow-y: auto;
    scrollbar-width: none;
    flex-shrink: 0;
    order: -1;
}

.right-tab-rail::-webkit-scrollbar {
    display: none;
}

.rail-group-label {
    font-size: 9px;
    font-weight: 800;
    color: var(--tv-accent);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 10px 4px 4px;
    text-align: center;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    user-select: none;
}

.rail-tab {
    width: 76px;
    min-height: 52px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 8px 4px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--tv-text-dim);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    line-height: 1;
    text-align: center;
}

.rail-tab span {
    display: block;
    width: 100%;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    line-height: 1.1;
    transition: color 0.2s ease;
}

.rail-tab:hover {
    background: rgba(255, 255, 255, 0.05);
}

.rail-tab.active {
    color: #fff;
    background: rgba(41, 98, 255, 0.18);
}

.rail-tab.active::after {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 60%;
    width: 3px;
    background: var(--color-scan);
    border-radius: 0 4px 4px 0;
}

/* ─── Rail Sub Tabs (Popped out below main rail tabs) ─── */
.rail-tab-group {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.rail-sub-tabs {
    display: none;
    flex-direction: column;
    width: 100%;
    background: rgba(10, 12, 18, 0.6);
    border-top: 1px solid rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.rail-tab.active ~ .rail-sub-tabs {
    display: flex;
}

.rail-sub-tab {
    background: transparent;
    border: none;
    color: var(--tv-text-dim);
    font-size: 10px;
    font-weight: 800;
    padding: 10px 0;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
    border-right: 2px solid transparent;
}

.rail-sub-tab:hover {
    color: var(--tv-text);
    background: rgba(255, 255, 255, 0.05);
}

.rail-sub-tab.active {
    color: #fff;
    background: rgba(41, 98, 255, 0.1);
    border-right: 2px solid var(--color-scan);
}

.rail-tab i {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    font-size: 16px;
    line-height: 1;
    color: inherit;
    transition: color 0.2s ease, transform 0.15s ease;
}

.rail-tab:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
}

.rail-tab:hover i {
    transform: scale(1.1);
}

.rail-tab.active {
    color: #fff;
    background: rgba(41, 98, 255, 0.18);
}

.rail-tab.active i {
    /* Kept intentionally empty to remove the old drop-shadow */
}

/* Alerts special badge indicator */
.rail-tab[data-rail="alertsRail"] i {
    position: relative;
}

.rail-alert-badge {
    position: absolute;
    top: 4px;
    right: 6px;
    display: none;
    align-items: center;
    justify-content: center;
    min-width: 14px;
    height: 14px;
    padding: 0 3px;
    color: #fff;
    background: #f44336;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    font-size: 9px;
    font-weight: 800;
    line-height: 14px;
}

.rail-tab .rail-alert-badge {
    display: none;
    width: auto;
}

/* Collapse toggle at bottom of rail */
.rail-collapse-toggle {
    margin-top: auto;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--tv-text-dim);
    background: transparent;
    border: 0;
    transition: all 0.2s ease;
    border-radius: 4px;
}

/* ─── Quiet AI Analyst ─── */
.ai-analyst-pane {
    min-height: 100%;
    padding: 12px;
    color: var(--tv-text);
    background: #0d1016;
}

.ai-context-row {
    display: flex;
    align-items: center;
    gap: 7px;
    min-height: 28px;
    padding-bottom: 10px;
    color: var(--tv-text-dim);
    border-bottom: 1px solid var(--tv-border);
    font-size: 10px;
    font-weight: 700;
}

.ai-context-row span:first-child {
    color: #ffffff;
    font-size: 13px;
}

.ai-context-row span + span::before {
    content: "·";
    margin-right: 7px;
    color: #555c69;
}

.ai-mode-control {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 12px;
    border: 1px solid #333947;
    border-radius: 4px;
    overflow: hidden;
}

.ai-mode-btn {
    min-height: 30px;
    padding: 0 5px;
    color: #8f97a4;
    background: #121720;
    border: 0;
    border-right: 1px solid #333947;
    cursor: pointer;
    font-size: 9px;
    font-weight: 700;
}

.ai-mode-btn:last-child {
    border-right: 0;
}

.ai-mode-btn.active {
    color: #ffffff;
    background: #50488d;
}

.ai-scope-control {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-top: 8px;
    border: 1px solid #333947;
    border-radius: 4px;
    overflow: hidden;
}

.ai-scope-btn {
    min-height: 28px;
    padding: 0 4px;
    color: #8f97a4;
    background: #121720;
    border: 0;
    border-right: 1px solid #333947;
    cursor: pointer;
    font-size: 9px;
    font-weight: 700;
}

.ai-scope-btn:last-child {
    border-right: 0;
}

.ai-scope-btn.active {
    color: #ffffff;
    background: #2962ff;
}

.ai-analyze-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 34px;
    margin-top: 10px;
    color: #151225;
    background: #a9a4dc;
    border: 0;
    border-radius: 4px;
    cursor: pointer;
    font-size: 10px;
    font-weight: 800;
}

.ai-analyze-btn:disabled {
    cursor: wait;
    opacity: 0.55;
}

.ai-analyst-status {
    min-height: 25px;
    padding: 8px 1px 5px;
    color: #747d8b;
    font-size: 9px;
}

.ai-analyst-status.error {
    color: #ef7377;
}

.ai-decision-output {
    border-top: 1px solid var(--tv-border);
    max-height: 48vh;
    overflow-y: auto;
}

.ai-empty-state {
    padding: 28px 5px;
    color: #68717f;
    font-size: 10px;
    line-height: 16px;
    text-align: center;
}

.ai-chat-message {
    margin-top: 10px;
}

.ai-chat-user {
    margin-left: 22px;
    padding: 9px 10px;
    color: #edf0f4;
    background: rgba(133, 128, 195, 0.16);
    border: 1px solid rgba(133, 128, 195, 0.34);
    border-radius: 10px 10px 2px 10px;
    font-size: 10px;
    font-weight: 650;
    line-height: 15px;
    white-space: pre-wrap;
}

.ai-chat-assistant {
    padding: 0 1px 2px;
}

.ai-decision-head {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: baseline;
    gap: 8px;
    padding: 12px 0 10px;
    border-bottom: 1px solid var(--tv-border);
}

.ai-decision-bias {
    font-size: 16px;
    font-weight: 900;
}

.ai-decision-bias.long {
    color: #23f0c7;
}

.ai-decision-bias.short {
    color: #ef7377;
}

.ai-decision-bias.wait {
    color: #ffe34e;
}

.ai-decision-confidence {
    color: #8d96a4;
    font-size: 9px;
    font-weight: 700;
}

.ai-decision-time {
    color: #626b79;
    font-size: 8px;
}

.ai-decision-summary {
    padding: 11px 0;
    color: #e8ebef;
    border-bottom: 1px solid var(--tv-border);
    font-size: 11px;
    font-weight: 600;
    line-height: 16px;
}

.ai-coach-btn {
    background: #f4c971;
}

.ai-coach-output {
    max-height: 38vh;
}

.ai-coach-stat-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    padding: 10px 0;
    border-bottom: 1px solid var(--tv-border);
}

.ai-coach-stat {
    display: grid;
    gap: 2px;
    padding: 7px 8px;
    background: rgba(244, 201, 113, 0.08);
    border: 1px solid rgba(244, 201, 113, 0.18);
    border-radius: 6px;
}

.ai-coach-stat span {
    color: #8d96a4;
    font-size: 8px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.ai-coach-stat strong {
    color: #f4d48b;
    font-size: 11px;
    font-weight: 900;
}

.ai-decision-section {
    padding: 9px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.055);
}

.ai-decision-section > span {
    display: block;
    margin-bottom: 4px;
    color: #727b89;
    font-size: 8px;
    font-weight: 800;
}

.ai-decision-section > strong,
.ai-decision-section > p {
    margin: 0;
    color: #dce1e8;
    font-size: 10px;
    font-weight: 600;
    line-height: 15px;
}

.ai-evidence-list {
    display: grid;
    gap: 5px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.ai-evidence-list li {
    position: relative;
    padding-left: 10px;
    color: #b9c0ca;
    font-size: 9px;
    line-height: 14px;
}

.ai-evidence-list li::before {
    content: "";
    position: absolute;
    top: 6px;
    left: 0;
    width: 4px;
    height: 4px;
    background: #8580c3;
}

.ai-question-row {
    display: grid;
    grid-template-columns: 1fr 32px;
    gap: 6px;
    margin-top: 12px;
}

.ai-question-row textarea {
    min-height: 48px;
    max-height: 100px;
    padding: 8px;
    resize: vertical;
    color: #edf0f4;
    background: #11161e;
    border: 1px solid #343a47;
    border-radius: 4px;
    outline: none;
    font-family: var(--font-main);
    font-size: 10px;
    line-height: 14px;
}

.ai-question-row textarea:focus {
    border-color: #8580c3;
}

.ai-send-btn {
    align-self: end;
    width: 32px;
    height: 32px;
    color: #151225;
    background: #8580c3;
    border: 0;
    border-radius: 4px;
    cursor: pointer;
}

.ai-advisory-note {
    padding: 9px 0 2px;
    color: #59616e;
    font-size: 8px;
    line-height: 12px;
}

/* ─── AI Watchlist Scan ─── */
.ai-scan-divider {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 14px 0 8px;
    color: #59616e;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.08em;
}

.ai-scan-divider::before,
.ai-scan-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
}

.ai-scan-idea {
    padding: 8px 9px;
    margin-top: 7px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 8px;
}

.ai-scan-idea-head {
    display: flex;
    align-items: center;
    gap: 6px;
}

.ai-scan-rank {
    color: #8a93a3;
    font-size: 10px;
    font-weight: 900;
}

.ai-scan-symbol {
    padding: 0;
    color: #fff;
    background: transparent;
    border: 0;
    font-family: var(--font-main);
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
}

.ai-scan-symbol:hover {
    color: #23f0c7;
    text-decoration: underline;
}

.ai-scan-driver {
    padding: 1px 6px;
    color: #cdd5e1;
    background: rgba(255, 255, 255, 0.07);
    border-radius: 999px;
    font-size: 8px;
    font-weight: 800;
    letter-spacing: 0.05em;
}

.ai-scan-idea-head .ai-decision-confidence {
    margin-left: auto;
}

.ai-scan-trade {
    margin-top: 5px;
    color: #dfe5ee;
    font-size: 11px;
    line-height: 15px;
}

.ai-scan-levels {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 12px;
    margin-top: 5px;
    color: #aab3c2;
    font-size: 9px;
}

.ai-scan-levels b {
    color: #6d7686;
    font-weight: 800;
    letter-spacing: 0.04em;
}

.ai-scan-rationale {
    margin-top: 5px;
    color: #79828f;
    font-size: 9px;
    line-height: 13px;
}

/* ─── Positioning Auto-Trade card ─── */
.automation-safety-summary {
    margin: 0 8px 8px;
    padding: 10px 11px;
    background: rgba(41, 98, 255, 0.08);
    border: 1px solid rgba(41, 98, 255, 0.28);
    border-radius: 10px;
}

.automation-summary-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    color: #e8ebf0;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.06em;
}

.automation-summary-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    margin-top: 8px;
}

.automation-summary-grid > div {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.automation-summary-grid span {
    color: #79828f;
    font-size: 8px;
}

.automation-summary-grid strong {
    color: #9aa3b2;
    font-size: 10px;
    overflow-wrap: anywhere;
}

.automation-summary-grid strong.good { color: #23f0c7; }
.automation-summary-grid strong.warn { color: #f5c451; }
.automation-summary-grid strong.danger { color: #ff6b81; }
.automation-summary-grid strong.loading { color: #79828f; }

.inline-retry-btn {
    padding: 2px 6px;
    color: var(--accent-cyan, #23f0c7);
    background: rgba(35, 240, 199, 0.06);
    border: 1px solid rgba(35, 240, 199, 0.28);
    border-radius: 5px;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.autotrade-card {
    margin: 8px 8px 4px;
    padding: 10px 11px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
}

.autotrade-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.autotrade-title {
    color: #e8ebf0;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.04em;
}

.autotrade-pill {
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 8px;
    font-weight: 900;
    letter-spacing: 0.05em;
}

.autotrade-pill.disarmed { color: #9aa3b2; background: rgba(255, 255, 255, 0.08); }
.autotrade-pill.paper    { color: #061713; background: #23f0c7; }
.autotrade-pill.live     { color: #fff; background: #f5375a; }

.autotrade-desc {
    margin: 6px 0 8px;
    color: #79828f;
    font-size: 9px;
    line-height: 13px;
}

.autotrade-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: stretch;
}

.autotrade-arm {
    flex: 1;
    padding: 7px;
    color: #cdd5e1;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 7px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.06em;
    cursor: pointer;
}

.autotrade-arm.armed {
    color: #fff;
    background: #f5375a;
    border-color: #f5375a;
}

.autotrade-arm:disabled,
.autotrade-mode-btn:disabled,
.autotrade-save:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.autotrade-mode {
    display: flex;
    flex: 1 1 180px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 7px;
    padding: 2px;
}

.autotrade-mode-btn {
    padding: 5px 10px;
    color: #8a93a3;
    background: transparent;
    border: 0;
    border-radius: 5px;
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
}

.autotrade-mode-btn.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
}

#autotradeModeLive.active {
    color: #fff;
    background: #f5375a;
}

.autotrade-settings {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 6px;
    margin: 9px 0 8px;
}

.autotrade-settings label {
    display: flex;
    flex-direction: column;
    gap: 2px;
    color: #6d7686;
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 0.03em;
}

.autotrade-settings input {
    padding: 4px 5px;
    color: #e8ebf0;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}

.autotrade-save {
    width: 100%;
    padding: 6px;
    color: var(--accent-cyan, #23f0c7);
    background: rgba(35, 240, 199, 0.06);
    border: 1px solid rgba(35, 240, 199, 0.28);
    border-radius: 6px;
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
}

.autotrade-status {
    margin: 8px 0 4px;
    color: #79828f;
    font-size: 9px;
}

#scannerSettingsControls[inert] {
    opacity: 0.5;
}

.autotrade-log-head {
    margin-top: 8px;
    color: #59616e;
    font-size: 8px;
    font-weight: 800;
    letter-spacing: 0.08em;
}

.autotrade-log {
    max-height: 150px;
    overflow-y: auto;
    margin-top: 4px;
}

.autotrade-log-empty {
    color: #59616e;
    font-size: 9px;
    padding: 4px 0;
}

.autotrade-log-row {
    padding: 4px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: #cdd5e1;
    font-size: 9px;
    line-height: 14px;
}

.autotrade-log-row b { color: #fff; }
.autotrade-log-row .atl-rule { color: #8a93a3; }
.autotrade-log-row .atl-time { color: #59616e; float: right; }
.autotrade-log-row .atl-status { font-weight: 800; }
.autotrade-log-row .atl-status.paper { color: #23f0c7; }
.autotrade-log-row .atl-status.executed { color: #22c55e; }
.autotrade-log-row .atl-status.rejected,
.autotrade-log-row .atl-status.error { color: #f5375a; }

/* ─── Max Drawdown card ─── */
.drawdown-card #drawdownResetBtn.autotrade-arm {
    color: #fff;
    background: #f5375a;
    border-color: #f5375a;
}

.drawdown-meters {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 6px;
    margin: 10px 0 4px;
}

.dd-meter {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 6px;
    background: rgba(0, 0, 0, 0.22);
    border-radius: 6px;
}

.dd-meter span {
    color: #6d7686;
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.dd-meter strong {
    color: #e8ebf0;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.dd-meter strong.negative { color: #f5375a; }

.autotrade-status.dd-halted {
    color: #ffb4c1;
    font-weight: 700;
}

.rail-collapse-toggle:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.rail-collapse-toggle i {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.right-rail-container.flyout-open .rail-collapse-toggle i {
    transform: rotate(180deg);
}

/* ─── Flyout Panel ─── */
.rail-flyout {
    width: 0;
    max-width: var(--desktop-flyout-max-width, calc(100vw - 100px));
    min-width: 0;
    overflow: hidden;
    background: rgba(20, 24, 33, 0.95);
    backdrop-filter: var(--glass);
    border-right: 1px solid var(--tv-border);
    display: flex;
    flex-direction: column;
    transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    position: relative;
    z-index: 1301;
}

.right-rail-container.flyout-open .rail-flyout {
    width: min(var(--flyout-width, 240px), var(--desktop-flyout-max-width, calc(100vw - 100px)));
}

.right-rail-container.flyout-open {
    z-index: 1300;
}

.right-rail-container.flyout-open .right-tab-rail {
    position: relative;
    z-index: 1402;
}

/* Disable slide animation while the user is actively dragging the resizer */
.right-rail-container.resizing .rail-flyout {
    transition: none;
}

.flyout-resizer {
    position: absolute;
    right: 0;
    top: 0;
    width: 6px;
    height: 100%;
    cursor: ew-resize;
    z-index: 10;
}

.flyout-resizer:hover,
.flyout-resizer.dragging {
    background: var(--tv-accent, var(--accent-cyan));
}

.flyout-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid var(--tv-border);
    background: rgba(0, 0, 0, 0.2);
    min-height: 40px;
    flex-shrink: 0;
}

.flyout-title {
    font-size: 11px;
    font-weight: 800;
    color: #fff;
    letter-spacing: 0.8px;
    white-space: nowrap;
}

.flyout-close {
    background: none;
    border: none;
    color: var(--tv-text-dim);
    font-size: 18px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: color 0.2s;
}

.flyout-close:hover {
    color: #fff;
}

.flyout-content {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    min-width: 240px;
}

/* ─── Sidebar Dropdown Tabs ─── */
.sidebar-header-dropdown-container {
    position: relative;
    border-bottom: 1px solid var(--tv-border);
    background: rgba(0, 0, 0, 0.2);
    cursor: pointer;
    user-select: none;
}

.sidebar-active-tab {
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.8px;
    display: flex;
    align-items: center;
    transition: background 0.2s;
}

.sidebar-active-tab:hover {
    background: rgba(255, 255, 255, 0.03);
}

.sidebar-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: #1e222d;
    border-bottom: 1px solid var(--tv-border);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: none;
    flex-direction: column;
}

.sidebar-dropdown-menu.visible {
    display: flex;
}

.sidebar-dropdown-menu.hidden {
    display: none;
}

.sidebar-menu-item {
    padding: 12px 16px;
    font-size: 11px;
    font-weight: 600;
    color: var(--tv-text-dim);
    display: flex;
    align-items: center;
    letter-spacing: 0.5px;
    transition: background 0.2s;
}

.sidebar-menu-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.sidebar-menu-item.active {
    color: #fff;
    background: rgba(41, 98, 255, 0.1);
}

.tab-badge {
    background: var(--tv-accent);
    color: #fff;
    font-size: 9px;
    padding: 1px 5px;
    border-radius: 10px;
    margin-left: 8px;
    vertical-align: middle;
    font-weight: 800;
}

.sidebar-content-area {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.sidebar-pane {
    display: none;
}

.sidebar-pane.active {
    display: block;
}

#logsRailPane.active {
    display: flex;
    flex-direction: column;
}

.logs-capital-card {
    flex-shrink: 0;
    margin-bottom: 10px;
    padding: 10px;
    background: #0b0f16;
    border: 1px solid var(--tv-border);
    border-radius: 8px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.logs-capital-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    color: var(--tv-text-dim);
    font-family: var(--font-main);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.04em;
}

.logs-capital-head small {
    color: #687180;
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 0;
}

.logs-capital-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
}

.logs-capital-item {
    min-width: 0;
    padding: 7px;
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid rgba(255, 255, 255, 0.055);
    border-radius: 6px;
}

.logs-capital-item span {
    display: block;
    margin-bottom: 4px;
    color: var(--tv-text-dim);
    font-size: 8px;
    font-weight: 800;
    text-transform: uppercase;
}

.logs-capital-item strong {
    display: block;
    overflow: hidden;
    color: #f3f6fb;
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 800;
    line-height: 16px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#logsCapitalDailyPnl.positive {
    color: var(--buy-green);
}

#logsCapitalDailyPnl.negative {
    color: var(--sell-red);
}



/* ─── New UI Components (Usability Audit Fixes) ─── */

/* Segmented Control */
.segmented-control {
    display: flex;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--tv-border);
    border-radius: 6px;
    padding: 2px;
    gap: 2px;
}

.segmented-control .mode-btn {
    flex: 1;
    background: transparent;
    color: var(--tv-text-dim);
    border-radius: 4px;
    padding: 6px 0;
    transition: all 0.2s;
}

.segmented-control .mode-btn.active {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* iOS Style Switch Toggle */
.switch-toggle-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.switch-toggle-wrapper input[type="checkbox"] {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.switch-toggle-wrapper input[type="checkbox"]:focus-visible+.switch-toggle {
    outline: 2px solid var(--tv-accent);
    outline-offset: 2px;
}

.switch-toggle {
    position: relative;
    width: 32px;
    height: 18px;
    background: var(--tv-bg-lighter, rgba(255, 255, 255, 0.1));
    border-radius: 100px;
    transition: background 0.3s;
}

.switch-toggle::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.switch-toggle-wrapper input[type="checkbox"]:checked+.switch-toggle {
    background: var(--accent-cyan);
}

.switch-toggle-wrapper input[type="checkbox"]:checked+.switch-toggle::after {
    transform: translateX(14px);
}

.switch-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--tv-text-dim);
}

.switch-toggle-wrapper input[type="checkbox"]:checked~.switch-label {
    color: #fff;
}

/* Action Buttons */
.action-btn {
    background: rgba(41, 98, 255, 0.1);
    color: var(--tv-accent);
    border: 1px solid rgba(41, 98, 255, 0.2);
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.action-btn:hover {
    background: rgba(41, 98, 255, 0.2);
    color: #fff;
}

/* Accordion for Advanced Settings */
.settings-accordion {
    margin-bottom: 8px;
}

.settings-accordion details {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--tv-border);
    border-radius: 6px;
}

.settings-accordion summary {
    padding: 8px 12px;
    font-size: 11px;
    font-weight: 700;
    color: var(--tv-text-dim);
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.settings-accordion summary::-webkit-details-marker {
    display: none;
}

.settings-accordion summary::after {
    content: '▼';
    font-family: var(--font-mono);
    font-size: 10px;
    transition: transform 0.2s;
}

.settings-accordion details[open] summary::after {
    transform: rotate(180deg);
}

.settings-accordion details[open] summary {
    border-bottom: 1px solid var(--tv-border);
    color: #fff;
}

.settings-accordion .accordion-content {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* ─── UI Components ─── */
.data-stream-section {
    margin-bottom: 16px;
}

.stream-header {
    font-size: 11px;
    font-weight: 700;
    color: var(--tv-text-dim);
    text-transform: uppercase;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.save-contract-star {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 24px;
    margin-right: 4px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #9e9e9e;
    opacity: 0;
    cursor: pointer;
    transition: color 0.15s ease, opacity 0.15s ease;
}

.chain-table tr:hover .save-contract-star,
.save-contract-star:focus-visible,
.save-contract-star.is-saved {
    opacity: 1;
}

.save-contract-star.is-saved {
    color: var(--color-scan);
}

.clear-all-alerts-btn {
    padding: 2px 0;
    border: 0;
    background: transparent;
    color: #f87171;
    font: inherit;
    font-size: 10px;
    font-weight: 600;
    text-transform: none;
    cursor: pointer;
}

.clear-all-alerts-btn:hover {
    color: #ffffff;
}

.quick-exec-grid {
    display: grid;
    gap: 12px;
}

.trade-field {
    display: flex;
    flex: 1;
    min-width: 0;
    flex-direction: column;
    gap: 5px;
}

.trade-field-label {
    color: var(--tv-text-dim);
    font-size: 10px;
    font-weight: 700;
}

.trade-order-fields {
    display: grid;
    grid-template-columns: minmax(74px, 0.7fr) minmax(112px, 1fr) minmax(94px, 1fr);
}

.trade-order-type-btn,
.option-intent-btn,
.trade-option-type-btn {
    flex: 1;
    padding: 6px 5px;
    border: 0;
    border-radius: 4px;
    color: var(--tv-text-dim);
    background: transparent;
    cursor: pointer;
    font-size: 10px;
    font-weight: 700;
}

.trade-order-type-btn.active,
.option-intent-btn.active,
.trade-option-type-btn.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
}

.option-action-fields {
    margin-top: 8px;
}

#limitPriceField:has(input:disabled) {
    opacity: 0.5;
}

.trade-order-summary {
    min-height: 38px;
    padding: 8px 10px;
    border: 1px solid var(--tv-border);
    border-radius: var(--radius);
    color: var(--tv-text-dim);
    background: rgba(255, 255, 255, 0.025);
    font-size: 11px;
    line-height: 1.45;
}

.trade-order-summary strong {
    color: var(--tv-text);
}

.alert-create-row {
    align-items: flex-end;
}

.alert-review-action {
    min-height: 34px;
    white-space: nowrap;
}

.exec-input-row {
    display: flex;
    gap: 8px;
    min-width: 0;
}

.exec-input-row input,
.exec-input-row select {
    background: var(--tv-bg);
    border: 1px solid var(--tv-border);
    color: var(--tv-text);
    padding: 5px 8px;
    border-radius: var(--radius);
    flex: 1;
    font-size: 11px;
    min-width: 0;
    width: 100%;
}

.mode-toggle-row {
    display: flex;
    gap: 1px;
    background: var(--tv-border);
    border: 1px solid var(--tv-border);
    border-radius: var(--radius);
    overflow: hidden;
    min-width: 0;
}

.mode-btn {
    flex: 1;
    background: var(--tv-bg);
    border: none;
    color: var(--tv-text-dim);
    padding: 5px 10px;
    cursor: pointer;
    font-size: 10px;
    font-weight: 600;
    white-space: nowrap;
}

.mode-btn.active {
    background: var(--tv-accent);
    color: white;
}

.mode-btn.import-loading {
    background: var(--tv-text-dim);
    cursor: wait;
    opacity: 0.7;
}

.exec-action-row {
    display: flex;
    gap: 8px;
    min-width: 0;
}

.buy-btn,
.sell-btn {
    flex: 1;
    padding: 12px 16px;
    border: none;
    border-radius: 6px;
    font-weight: 800;
    cursor: pointer;
    color: white;
    font-size: 14px;
    letter-spacing: 1px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    min-width: 0;
}

.buy-btn {
    background: var(--tv-buy);
    box-shadow: 0 6px 16px rgba(8, 153, 129, 0.3);
}

.sell-btn {
    background: var(--tv-sell);
    box-shadow: 0 6px 16px rgba(242, 54, 69, 0.3);
}

.buy-btn:hover {
    background: #068470;
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(8, 153, 129, 0.5);
}

.sell-btn:hover {
    background: #d92e3c;
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(242, 54, 69, 0.5);
}

.buy-btn:active,
.sell-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* ─── Watchlist & Positions ─── */
.watchlist-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.watchlist-chip {
    background: var(--tv-bg);
    border: 1px solid var(--tv-border);
    padding: 4px 8px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.watchlist-chip:hover {
    background: var(--tv-hover);
}

.watchlist-chip .chip-remove {
    color: var(--tv-text-dim);
    cursor: pointer;
    background: none;
    border: none;
    font-size: 14px;
    padding: 0 4px;
    line-height: 1;
}

.watchlist-chip .chip-remove:hover {
    color: var(--tv-sell);
}

.text-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    font-family: inherit;
}

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

/* ─── Logs ─── */
.terminal-log-content {
    font-family: var(--font-mono);
    font-size: 11px;
    color: #a0a0a0;
}

.log-entry {
    margin-bottom: 2px;
    padding: 2px 4px;
}

.log-entry.sys-info {
    color: #5db0ff;
}

.log-entry.sys-warn {
    color: #ffb86c;
}

.log-entry.sys-err {
    color: #ff5555;
}

/* ─── Scrollbars ─── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

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

::-webkit-scrollbar-thumb {
    background: #363c4e;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #4c5264;
}

/* ─── Animations ─── */
@keyframes pulse {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }

    100% {
        opacity: 1;
    }
}

.sync-dot-mini {
    color: #089981;
    animation: pulse 2s infinite;
}

/* ─── Indicators Bar (Top of Chart) ─── */
.indicators-bar {
    background: var(--tv-sidebar);
    border-bottom: 1px solid var(--tv-border);
    display: flex;
    padding: 2px 12px;
    align-items: center;
    justify-content: space-between;
    z-index: 30;
}

.panel-toggles {
    display: flex;
    gap: 12px;
    align-items: center;
}

.tool-dropdown-item {
    color: #cbd5e1;
    transition: all 0.15s ease;
}
.tool-dropdown-item:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    color: #ffffff !important;
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--tv-text-dim);
    cursor: pointer;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.2s ease;
    border-radius: 4px;
}

.icon-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.bottom-tab-toggle {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--tv-text-dim);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 4px;
    margin: 0 12px 0 4px;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.05);
}

.bottom-tab-toggle:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.bottom-collapsed .bottom-tab-toggle {
    transform: rotate(180deg);
}

.right-toggle {
    margin-left: auto;
    font-size: 14px;
    opacity: 0.8;
}

.right-toggle:hover {
    opacity: 1;
}

.tf-btn {
    background: transparent;
    border: none;
    color: var(--tv-text-dim);
    padding: 2px 8px;
    cursor: pointer;
    font-weight: 500;
}

.tf-btn:hover {
    color: var(--tv-text);
}

.tf-btn.active {
    color: var(--tv-accent);
    background: rgba(41, 98, 255, 0.1);
    border-radius: var(--radius);
}

/* ─── Toast Notifications ─── */
.toast-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-radius: var(--radius);
    background: rgba(20, 24, 33, 0.95);
    backdrop-filter: var(--glass);
    border: 1px solid var(--tv-border);
    color: var(--tv-text);
    font-size: 12px;
    min-width: 260px;
    max-width: 380px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    animation: toastSlideIn 0.3s ease-out;
}

@keyframes toastSlideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

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

.toast-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.toast-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.toast-title {
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.toast-title.buy,
.toast-title.success {
    color: var(--tv-buy);
}

.toast-title.sell,
.toast-title.error {
    color: var(--tv-sell);
}

.toast-title.info,
.toast-title.alert {
    color: var(--tv-accent);
}

.toast-message {
    color: var(--tv-text-dim);
    font-size: 12px;
}

.toast-close {
    background: none;
    border: none;
    color: var(--tv-text-dim);
    cursor: pointer;
    font-size: 18px;
    padding: 0 4px;
    line-height: 1;
}

.toast-close:hover {
    color: #fff;
}

/* ─── Loading Overlay & Spinner ─── */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(11, 14, 20, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 60;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.loading-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

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

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

/* ─── Settings Overlay ─── */
.settings-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 5000;
    align-items: center;
    justify-content: center;
}

.settings-overlay.visible {
    display: flex;
}

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

.overlay-header h3 {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
}

.overlay-close {
    background: none;
    border: none;
    color: var(--tv-text-dim);
    font-size: 22px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.overlay-close:hover {
    color: #fff;
}

.overlay-content {
    flex: 1;
    padding: 16px 20px;
    overflow-y: auto;
    max-height: 70vh;
    background: var(--tv-bg);
    border-radius: 0 0 8px 8px;
}

/* ─── HUD Values ─── */
.hud-value {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 600;
    color: #fff;
}

.mini-stat {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.header-cog-btn {
    background: none;
    border: none;
    color: var(--tv-text-dim);
    cursor: pointer;
    font-size: 13px;
    padding: 4px;
    transition: color 0.2s, transform 0.3s;
}

.header-cog-btn:hover {
    color: var(--tv-accent);
    transform: rotate(45deg);
}

/* ─── Hidden/Collapsed Fields ─── */
.hidden {
    display: none !important;
}

.hidden-exec-fields {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.3s ease;
}

.hidden-exec-fields:not(.hidden),
.expanded {
    max-height: 400px;
}

/* ─── Automation Panel ─── */
.automation-hud {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius);
    border: 1px solid var(--tv-border);
}

.automation-hud #autoStatusText {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 700;
    color: var(--tv-text);
}

.hud-actions {
    display: flex;
    gap: 6px;
}

.auto-settings-grid {
    display: grid;
    gap: 8px;
}

.setting-group-header {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--tv-text-dim);
    letter-spacing: 0.5px;
    margin-top: 3px;
    margin-bottom: 1px;
}

.setting-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    background: rgba(255, 255, 255, 0.03);
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.setting-item label {
    color: var(--tv-text);
    min-width: 50px;
}

.setting-item input[type="number"] {
    background: var(--tv-bg);
    border: 1px solid var(--tv-border);
    color: var(--tv-text);
    padding: 4px 8px;
    border-radius: var(--radius);
    width: 80px;
    font-size: 12px;
}

.setting-item input[type="checkbox"] {
    accent-color: var(--tv-accent);
}

/* ─── Calendar Grid ─── */
.cal-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    font-size: 11px;
}

.cal-header-cell {
    text-align: center;
    font-weight: 700;
    color: var(--tv-text-dim);
    padding: 6px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cal-day {
    padding: 10px 6px;
    text-align: center;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid var(--tv-border);
    cursor: default;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 54px;
}

.cal-day.empty {
    background: transparent;
    border-color: transparent;
    pointer-events: none;
}

.cal-day.no-data {
    opacity: 0.6;
}

.cal-day.future {
    opacity: 0.25;
}

.cal-day:not(.empty):not(.future):hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.cal-day.positive {
    border-color: rgba(16, 185, 129, 0.15);
    background: rgba(16, 185, 129, 0.04);
}

.cal-day.positive:hover {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.5);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.15);
}

.cal-day.negative {
    border-color: rgba(239, 68, 68, 0.15);
    background: rgba(239, 68, 68, 0.04);
}

.cal-day.negative:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.5);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.15);
}

.cal-day-num {
    font-weight: 500;
    color: var(--tv-text-dim);
    font-size: 10px;
    text-align: left;
    margin-bottom: 4px;
}

.cal-day.positive .cal-day-num,
.cal-day.negative .cal-day-num {
    color: #fff;
    font-weight: 600;
}

.cal-day-pnl {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 700;
    display: block;
    margin: 2px 0;
}

.cal-day.positive .cal-day-pnl {
    color: var(--tv-buy);
}

.cal-day.negative .cal-day-pnl {
    color: var(--tv-sell);
}

.cal-day-trades {
    font-size: 8px;
    color: var(--tv-text-dim);
    display: block;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 3px;
    padding: 1px 0;
    margin-top: 4px;
    border: 1px solid rgba(255, 255, 255, 0.02);
}

.cal-day.positive .cal-day-trades {
    background: rgba(16, 185, 129, 0.1);
    color: rgba(16, 185, 129, 0.95);
}

.cal-day.negative .cal-day-trades {
    background: rgba(239, 68, 68, 0.1);
    color: rgba(239, 68, 68, 0.95);
}

/* ─── Calendar Journal ─── */
.calendar-journal {
    background: rgba(0, 0, 0, 0.12);
    border-radius: 6px;
    padding: 12px;
    border: 1px solid var(--tv-border);
    animation: journalSlideIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes journalSlideIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

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

.journal-trade-item {
    transition: all 0.15s ease;
}

.journal-trade-item:hover {
    background: rgba(255, 255, 255, 0.04) !important;
    border-color: rgba(255, 255, 255, 0.12) !important;
    transform: translateX(2px);
}

/* ─── Calendar Summary Cards (Kinfo Style) ─── */
.cal-summary-card {
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid var(--tv-border);
    padding: 10px;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.cal-summary-card:hover {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.cal-summary-label {
    font-size: 8px;
    color: var(--tv-text-dim);
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.cal-summary-value {
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    font-family: var(--font-mono);
}

.cal-summary-value.positive {
    color: var(--tv-buy) !important;
}

.cal-summary-value.negative {
    color: var(--tv-sell) !important;
}

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

.cal-nav button {
    background: transparent;
    border: 1px solid var(--tv-border);
    color: var(--tv-text-dim);
    padding: 4px 10px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 11px;
}

.cal-nav button:hover {
    color: #fff;
    border-color: var(--tv-accent);
}

.cal-nav .cal-month-label {
    font-weight: 700;
    font-size: 13px;
    color: var(--tv-text);
}

/* ─── Positions ─── */
.position-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--tv-border);
    border-radius: var(--radius);
    padding: 10px 12px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: background 0.15s;
}

.position-card:hover {
    background: var(--tv-hover);
}

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

.position-symbol {
    font-weight: 700;
    color: #fff;
    font-size: 12px;
}

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

.position-details {
    display: flex;
    gap: 12px;
    font-size: 10px;
    color: var(--tv-text-dim);
}

.positions-loading,
.signal-empty {
    text-align: center;
    padding: 20px;
    color: var(--tv-text-dim);
    font-size: 12px;
}

/* ─── Price Change Display ─── */
.change-display {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
}

.change-display.pos {
    color: var(--tv-buy);
}

.change-display.neg {
    color: var(--tv-sell);
}

.change-display.neutral {
    color: var(--tv-text-dim);
}

/* ─── Status Pill ─── */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* ─── Responsive Media Queries ─── */
@media (max-width: 768px) {
    .terminal-container {
        --tools-width: 0px;

        .indicator-toggles {
            display: none;
        }

        .account-summary-minimal {
            display: none;
        }
    }

    /* ─── Quick Switch Bar ─── */
    .quick-switch-bar {
        display: flex;
        gap: 8px;
        padding: 6px 12px;
        background: rgba(0, 0, 0, 0.3);
        border-top: 1px solid var(--tv-border);
        overflow-x: auto;
        white-space: nowrap;
        scrollbar-width: none;
        z-index: 10;
    }

    .quick-switch-bar::-webkit-scrollbar {
        display: none;
    }

    .quick-switch-chip {
        padding: 4px 10px;
        background: var(--tv-sidebar);
        border: 1px solid var(--tv-border);
        border-radius: 4px;
        font-size: 11px;
        font-weight: 600;
        color: var(--tv-text-dim);
        cursor: pointer;
        transition: all 0.2s;
    }

    .quick-switch-chip:hover {
        background: var(--tv-hover);
        color: #fff;
        border-color: var(--tv-text-dim);
    }

    .quick-switch-chip.active {
        background: var(--tv-accent);
        color: #fff;
        border-color: var(--tv-accent);
        box-shadow: 0 0 10px rgba(41, 98, 255, 0.3);
    }
}

/* ─── Options Chain Panel ─── */
.chain-panel {
    background: var(--tv-sidebar);
    border-top: 1px solid var(--tv-border);
    display: flex;
    flex-direction: column;
    height: 350px;
    /* Default height */
    max-height: 80vh;
    z-index: 50;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chain-panel.hidden {
    display: none;
}

.chain-resizer {
    height: 4px;
    background: transparent;
    cursor: ns-resize;
    z-index: 60;
    transition: background 0.2s;
}

.chain-resizer:hover,
.chain-resizer.dragging {
    background: var(--tv-accent);
}


.chain-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid var(--tv-border);
}

.chain-info {
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: var(--font-mono);
}

#chainSymbol {
    font-weight: 800;
    color: #fff;
    font-size: 13px;
}

.chain-exp-select {
    background: var(--tv-bg);
    border: 1px solid var(--tv-border);
    color: var(--tv-accent);
    font-size: 11px;
    font-weight: 700;
    padding: 2px 4px;
    border-radius: 4px;
    cursor: pointer;
    outline: none;
}

.chain-exp-select:hover {
    border-color: var(--tv-accent);
}

.chain-tabs {
    display: flex;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    padding: 2px;
}

.chain-tab {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background: transparent;
    border: none;
    color: var(--tv-text-dim);
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 3px;
    transition: all 0.2s;
    white-space: nowrap;
}

.chain-tab.active {
    background: var(--tv-accent);
    color: #fff;
}

.chain-table-container {
    height: calc(28px + 26px * 12);
    overflow-y: auto;
    overflow-x: auto;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--tv-border);
    border-radius: var(--radius);
}

.chain-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    text-align: right;
    table-layout: fixed;
}

/* Strike column reads as the row label: left-aligned, roomier */
.chain-table th:first-child,
.chain-table td:first-child {
    text-align: left;
    width: 30%;
}

.chain-table th {
    position: sticky;
    top: 0;
    background: #141821;
    height: 28px;
    padding: 0 8px;
    color: var(--tv-text-dim);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 10px;
    border-bottom: 1px solid var(--tv-border);
    z-index: 10;
}

.chain-table tr {
    height: 26px;
    /* Compact row height */
    transition: background 0.15s ease;
}

.chain-table td {
    padding: 0 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    color: var(--tv-text);
    white-space: nowrap;
    vertical-align: middle;
}

.chain-table tr:hover {
    background: rgba(255, 255, 255, 0.04) !important;
    cursor: pointer;
}

.chain-table tr.row-atm {
    background: rgba(0, 240, 255, 0.07) !important;
    /* Premium glassmorphic cyan highlight */
    border-left: 3px solid var(--accent-cyan);
}

.chain-table tr.row-atm td {
    color: #fff;
    font-weight: 600;
}

.chain-table tr.row-itm {
    background: rgba(41, 98, 255, 0.06);
}

.save-contract-star {
    font-size: 12px;
    transition: color 0.15s ease, opacity 0.15s ease;
}

.save-contract-star:hover {
    opacity: 1 !important;
    color: var(--color-scan) !important;
}

.atm-badge {
    display: inline-block;
    padding: 1px 3px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.7);
    border-radius: 2px;
    font-size: 7px;
    font-weight: 600;
    margin-left: 6px;
    vertical-align: middle;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cell-call {
    color: var(--buy-green);
    font-weight: 700;
}

.cell-put {
    color: var(--sell-red);
    font-weight: 700;
}

.status-dot-mini {
    font-size: 10px;
    color: var(--tv-buy);
}

.status-dot-mini.pulse {
    animation: pulse 1s infinite;
}

.sentiment-badge {
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 9px;
    font-weight: 800;
}

.badge-whale {
    background: #9333ea;
    color: #fff;
}

.badge-sweep {
    background: #2563eb;
    color: #fff;
}

.badge-bullish {
    background: rgba(8, 153, 129, 0.2);
    color: var(--tv-buy);
    border: 1px solid var(--tv-buy);
}

.badge-bearish {
    background: rgba(242, 54, 69, 0.2);
    color: var(--tv-sell);
    border: 1px solid var(--tv-sell);
}

/* ─── Automation Tab Enhanced ─── */
/* ─── Automation Tab Layout ─── */
.automation-tab-container {
    flex-direction: row !important;
    gap: 0;
    padding: 0;
}

.automation-left-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 12px;
}

.automation-right-col {
    width: 320px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--tv-border);
    padding: 12px;
    background: rgba(0, 0, 0, 0.15);
}

.automation-footer-full {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    border-top: none;
    padding-top: 0;
    margin-top: 8px;
}

.screener-import-row.horizontal {
    flex-direction: row;
    align-items: center;
    gap: 8px;
}

.screener-import-row input {
    flex: 1;
    padding: 6px 8px;
    border-radius: 4px;
    border: 1px solid var(--tv-border);
    background: var(--tv-bg);
    color: var(--tv-text);
    font-size: 11px;
    min-width: 0;
}

.auto-settings-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 12px;
    align-items: stretch;
}

.settings-column {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1 1 210px;
    background: rgba(255, 255, 255, 0.005);
    border: 1px solid rgba(255, 255, 255, 0.02);
    border-radius: 8px;
    padding: 12px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.settings-column:hover {
    background: rgba(255, 255, 255, 0.015);
    border-color: rgba(255, 255, 255, 0.05);
}

.settings-column.params-column {
    flex: 3 1 500px;
}

.settings-column .setting-group-header {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--tv-accent);
    letter-spacing: 0.8px;
    margin-bottom: 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.strategy-checks {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.01);
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.02);
    height: 100%;
}

.strategy-checks.active {
    border-color: var(--tv-accent);
    background: rgba(41, 98, 255, 0.03);
}

.strategy-tabs {
    display: flex;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    padding: 2px;
    margin-left: auto;
}

.strategy-tab {
    background: transparent;
    border: 1px solid transparent;
    color: var(--tv-text-dim);
    padding: 4px 12px;
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
    text-transform: uppercase;
    appearance: none;
    -webkit-appearance: none;
}

.strategy-tab:hover {
    color: #fff;
}

.strategy-tab.active {
    background: rgba(0, 240, 255, 0.15);
    color: #fff;
    border: 1px solid var(--accent-cyan);
}

.params-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 12px;
    background: rgba(255, 255, 255, 0.01);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.02);
    padding: 12px;
    height: 100%;
}

.params-sub-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sub-group-label {
    font-size: 9px;
    font-weight: 700;
    color: var(--accent-cyan);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0;
    opacity: 0.9;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.05);
    padding-bottom: 4px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
    transition: color 0.2s ease;
}

.sub-group-label:hover {
    color: #fff;
    opacity: 1;
}

.sub-group-chevron {
    font-size: 8px;
    color: var(--tv-text-dim);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), color 0.2s ease;
}

.params-sub-group.expanded .sub-group-chevron {
    transform: rotate(180deg);
    color: var(--accent-cyan);
}

.sub-group-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease;
    opacity: 0;
}

.params-sub-group.expanded .sub-group-content {
    max-height: 500px;
    opacity: 1;
    margin-top: 6px;
}

.params-sub-group {
    cursor: pointer;
}

.params-grid {
    display: none;
}

.setting-item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.015);
    padding: 5px 8px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.03);
    width: 100%;
    box-sizing: border-box;
    font-size: 11px;
}

.setting-item label {
    color: var(--tv-text-dim);
    flex: 1;
    min-width: 0;
    font-size: 11px;
}

.setting-item input[type="number"],
.setting-item select {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    padding: 4px 6px;
    border-radius: 4px;
    width: 60px;
    font-size: 11px;
    text-align: right;
    appearance: none;
    -webkit-appearance: none;
    outline: none;
    cursor: pointer;
}

.setting-item select {
    width: auto;
    padding-right: 20px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' fill='rgba(255,255,255,0.5)' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 6px center;
}

.setting-item.dulled {
    opacity: 0.35;
    background: rgba(0, 0, 0, 0.1);
    pointer-events: none;
}

.setting-item.dulled input {
    background: rgba(0, 0, 0, 0.2) !important;
    color: rgba(255, 255, 255, 0.3) !important;
    border-color: rgba(255, 255, 255, 0.03) !important;
}

.automation-footer {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 10px;
    border-top: 1px solid var(--tv-border);
    padding-top: 8px;
}

.active-signals-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.signal-only-banner {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 8px 10px;
    color: #d8f9f1;
    background: rgba(35, 240, 199, 0.1);
    border: 1px solid rgba(35, 240, 199, 0.28);
    border-radius: 6px;
    font-size: 10px;
    line-height: 1.35;
}

.signal-only-banner[hidden] {
    display: none;
}

.signal-history-toggle {
    min-height: 28px;
    padding: 0 5px;
    color: var(--tv-accent);
    font-size: 10px;
    font-weight: 700;
}

.signal-feed-item {
    --signal-color: var(--tv-text-dim);
    overflow: hidden;
    flex: 0 0 auto;
    background: transparent;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    border-left: 2px solid var(--signal-color);
}

.signal-feed-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    min-height: 44px;
    padding: 7px 9px;
    color: var(--tv-text);
    background: transparent;
    border: 0;
    cursor: pointer;
    text-align: left;
}

.signal-feed-summary:hover,
.signal-feed-summary:focus-visible {
    background: rgba(255, 255, 255, 0.04);
}

.signal-feed-main,
.signal-feed-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.signal-feed-direction {
    color: var(--signal-color);
    font-size: 10px;
    font-weight: 800;
}

.signal-feed-symbol {
    color: #fff;
    font-size: 12px;
    font-weight: 700;
}

.signal-feed-strategy {
    overflow: hidden;
    color: var(--tv-text-dim);
    font-size: 9px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.signal-feed-time {
    color: var(--tv-text-dim);
    font-size: 9px;
    white-space: nowrap;
}

.signal-lag-chip,
.signal-timeframe-chip {
    padding: 2px 5px;
    color: #cbd5e1;
    background: rgba(255, 255, 255, 0.07);
    border-radius: 999px;
    font-size: 9px;
    font-weight: 700;
    white-space: nowrap;
}

.signal-lag-chip {
    color: #ffe29a;
    background: rgba(245, 158, 11, 0.14);
}

.signal-feed-chevron {
    color: var(--tv-text-dim);
    font-size: 9px;
    transition: transform 0.15s ease;
}

.signal-feed-item.expanded .signal-feed-chevron {
    transform: rotate(180deg);
}

.signal-feed-detail {
    display: none;
    padding: 0 10px 10px;
    color: var(--tv-text-dim);
    font-size: 10px;
    line-height: 1.45;
}

.signal-feed-item.expanded .signal-feed-detail {
    display: block;
}

.signal-feed-detail-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
}

.signal-view-chart {
    min-height: 32px;
    padding: 0 9px;
    color: var(--tv-accent);
    background: transparent;
    border: 1px solid rgba(41, 98, 255, 0.35);
    border-radius: 4px;
    cursor: pointer;
    font-size: 10px;
    font-weight: 700;
}

.section-header {
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--tv-text-dim);
    letter-spacing: 0.5px;
}

.auto-pos-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 24px;
}

.pos-badge {
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 700;
}

.pos-badge.long {
    background: var(--tv-buy-bg);
    color: var(--tv-buy);
    border: 1px solid var(--tv-buy);
}

.pos-badge.short {
    background: var(--tv-sell-bg);
    color: var(--tv-sell);
    border: 1px solid var(--tv-sell);
}

.signal-log-mini {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    padding: 8px;
    height: 120px;
    overflow-y: auto;
    font-family: var(--font-mono);
    font-size: 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.screener-import-row {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#finvizUrl {
    background: var(--tv-bg);
    border: 1px solid var(--tv-border);
    color: var(--tv-text);
    padding: 8px;
    border-radius: 4px;
    font-size: 11px;
}

/* ─── Tick Update Animations ─── */
@keyframes tickPulse {
    0% {
        transform: scale(1.0);
        filter: brightness(1.2);
    }

    50% {
        transform: scale(1.02);
        filter: brightness(1.5);
    }

    100% {
        transform: scale(1.0);
        filter: brightness(1.0);
    }
}

.tick-pulse {
    animation: tickPulse 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Options Chain UX Enhancements --- */
.chain-table tr:hover {
    background: rgba(255, 255, 255, 0.05) !important;
    cursor: pointer;
}

.chain-table tr:active {
    background: rgba(41, 98, 255, 0.2) !important;
}

.chain-table td {
    transition: background 0.15s ease;
}

/* Watchlist active state */
.watchlist-chip.active {
    background: var(--tv-accent) !important;
    color: #fff !important;
    border-color: var(--tv-accent) !important;
    box-shadow: 0 0 8px rgba(41, 98, 255, 0.4);
}

/* ─── PnL Calibration ─── */
.pnl-calibrate-btn {
    font-size: 10px;
    opacity: 0.3;
    cursor: pointer;
    transition: opacity 0.2s;
    padding: 6px;
    margin: -6px;
}

.pnl-calibrate-btn:hover {
    opacity: 1;
    color: #3b82f6;
    /* tv-accent approximation */
}

/* ─── Trades Tab ─── */
.positive {
    color: var(--tv-buy) !important;
}

.negative {
    color: var(--tv-sell) !important;
}

.trade-recap-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid var(--tv-border);
    transition: background 0.2s ease;
}

.trade-recap-row:hover {
    background: var(--tv-bg-lighter);
}

.trade-recap-header {
    background: var(--tv-bg-darker);
    border-bottom: 1px solid var(--tv-border);
}

/* Options Sub-Panels */
.options-sub-panel {
    display: none;
    flex: 1;
    overflow-y: auto;
}

.options-sub-panel.active {
    display: flex;
    flex-direction: column;
}



.market-status-pill {
    margin-left: 12px;
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    color: var(--tv-text-dim);
}

/* ─── Responsiveness: Header Crowding Fixes ─── */

@media (max-width: 1300px) {
    .top-bar {
        gap: 8px;
        padding: 0 12px;
    }

    .top-left {
        gap: 12px;
    }

    .header-right-group {
        gap: 12px;
    }

    #activeSymbol,
    #marketStatus {
        display: none;
    }
}

@media (max-width: 1150px) {
    .tf-btn {
        padding: 2px 6px;
        font-size: 11px;
    }

    .symbol-search-container:focus-within input,
    .symbol-search-container.expanded input {
        width: 80px;
    }

    .account-summary-minimal {
        gap: 8px;
        padding-left: 12px;
    }

    .top-ticker-hud {
        gap: 6px;
    }
}

@media (max-width: 1000px) {
    :root {
        --header-height: 88px;
    }

    .top-bar {
        flex-wrap: wrap;
        padding: 6px 12px;
        align-content: space-evenly;
        height: var(--header-height);
    }

    .header-right-group {
        margin-left: 0;
        width: 100%;
        justify-content: space-between;
    }

    .stat-label {
        display: none;
    }

    .account-summary-minimal {
        padding-left: 0;
        border-left: none;
        gap: 16px;
    }

    .top-ticker-hud span {
        font-size: 13px;
    }

    #topSymbol {
        font-size: 14px;
    }

    .indicator-menu-btn:not(.tf-menu-btn) span {
        display: none;
    }

    .indicator-menu-btn {
        padding: 6px 8px;
    }
}

@media (max-width: 850px) {
    #apiStatus {
        display: none;
    }

    .tf-btn:nth-child(1),
    .tf-btn:nth-child(4) {
        display: none;
        /* Hide 1m and 1H to save space */
    }

    .system-status-group .terminal-pill:first-child {
        display: none;
        /* Hide Disk Usage */
    }
}

/* Timeframe Dropdown */
.tf-dropdown {
    min-width: 80px;
    left: 0;
}

.tf-item {
    padding: 6px 12px;
    font-size: 11px;
}

.tf-menu-btn {
    min-width: 50px;
    justify-content: center;
}

/* ─── Sidebar Toggle & Collapse System ─── */
.sidebar-header-container {
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--tv-border);
    background: rgba(0, 0, 0, 0.2);
    height: 41px;
    width: 100%;
}

.sidebar-tab-toggle {
    width: 34px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--tv-text-dim);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    border-left: 1px solid var(--tv-border);
    background: rgba(255, 255, 255, 0.02);
}

.sidebar-tab-toggle:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

/* Old collapsed sidebar overrides removed — handled by .flyout-open class now */

/* ─── Mobile Responsiveness Additions ─── */

/* Default hidden state for mobile elements on desktop */
.mobile-only-tab {
    display: none !important;
}

.mobile-only-tab-content {
    display: none !important;
}

@media (max-width: 600px) {
    .mobile-only-tab {
        display: flex !important;
    }

    .mobile-only-tab-content.active {
        display: block !important;
        overflow-y: auto;
        padding: 12px;
        flex: 1;
        width: 100%;
    }

    .mobile-only-tab-content .sidebar-pane {
        display: block !important;
        width: 100% !important;
        padding: 0 !important;
        border: none !important;
        background: transparent !important;
        box-shadow: none !important;
    }

    .bottom-tabs {
        overflow-x: auto;
        white-space: nowrap;
        scrollbar-width: none;
        /* Hide scrollbar on Firefox */
    }

    .bottom-tabs::-webkit-scrollbar {
        display: none;
        /* Hide scrollbar on Chrome/Safari/Webkit */
    }

    .bottom-tab {
        flex-shrink: 0;
    }
}

@media (max-width: 600px) {
    .top-bar {
        padding: 0 8px !important;
        gap: 6px !important;
    }

    .top-left {
        gap: 6px !important;
    }

    .top-ticker-hud {
        gap: 4px !important;
    }

    #topSymbol {
        font-size: 13px !important;
    }

    #topPrice {
        font-size: 12px !important;
    }

    #topDollarChange,
    #topChange {
        font-size: 10px !important;
    }

    .indicator-menu-container {
        margin-left: 4px;
    }

    .header-watchlist-menu {
        margin-left: 0;
    }

    .header-watchlist-pill {
        max-width: 128px;
        padding: 0 7px;
        gap: 4px;
    }

    .header-watchlist-pill span {
        display: none;
    }

    .header-watchlist-dropdown {
        width: 168px;
    }

    .indicator-menu-btn {
        padding: 4px 6px !important;
        font-size: 11px !important;
    }

    .indicator-dropdown {
        top: calc(100% + 4px) !important;
    }

    #indicatorMenu {
        left: auto !important;
        right: 0 !important;
    }

    #tfMenu {
        left: 0 !important;
        right: auto !important;
        width: auto !important;
        min-width: 80px !important;
    }

    .symbol-search-container input {
        width: 0 !important;
    }

    .symbol-search-container input:focus,
    .symbol-search-container.expanded input {
        width: 70px !important;
        opacity: 1 !important;
    }

    .system-status-group .terminal-pill {
        display: none !important;
        /* Hide all system status pills */
    }
}

/* --- Compact Option Chain for Alerts Tab --- */
.alert-chain-table-container {
    max-height: 110px;
    overflow: auto;
    border: 1px solid var(--tv-border);
    border-radius: var(--radius);
    background: rgba(0, 0, 0, 0.2);
    margin-bottom: 6px;
    scrollbar-width: thin;
}

.alert-chain-table {
    width: max-content;
    min-width: 700px;
    border-collapse: collapse;
    font-size: 10px;
}

.alert-chain-table th {
    position: sticky;
    top: 0;
    background: #141821;
    color: var(--tv-text-dim);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 8px;
    padding: 6px 8px;
    border-bottom: 1px solid var(--tv-border);
    z-index: 5;
}

.alert-chain-table td {
    padding: 4px 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.02);
    vertical-align: middle;
}

.alert-chain-table tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.alert-chain-table tr.row-atm {
    background: rgba(41, 98, 255, 0.15) !important;
    box-shadow: inset 0 1px 0 rgba(41, 98, 255, 0.25), inset 0 -1px 0 rgba(41, 98, 255, 0.25);
}

.alert-chain-price-btn {
    appearance: none;
    display: inline-block;
    padding: 3px 6px;
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    min-width: 70px;
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    border: 1px solid transparent;
}

.alert-chain-price-btn:focus-visible {
    outline: 2px solid var(--tv-accent);
    outline-offset: 2px;
}

.alert-chain-price-btn.call-side {
    color: var(--buy-green);
    background: rgba(16, 185, 129, 0.08);
    border-color: rgba(16, 185, 129, 0.2);
}

.alert-chain-price-btn.call-side:hover {
    background: rgba(16, 185, 129, 0.15);
    border-color: var(--buy-green);
}

.alert-chain-price-btn.call-side.selected {
    color: #ffffff;
    background: var(--buy-green) !important;
    border-color: var(--buy-green) !important;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
    font-weight: 700;
}

.alert-chain-price-btn.put-side {
    color: var(--sell-red);
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.2);
}

.alert-chain-price-btn.put-side:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: var(--sell-red);
}

.alert-chain-price-btn.put-side.selected {
    color: #ffffff;
    background: var(--sell-red) !important;
    border-color: var(--sell-red) !important;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
    font-weight: 700;
}

.alert-selected-option-display {
    padding: 8px 10px;
    border: 1px dashed var(--tv-border);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.01);
    color: var(--tv-text-dim);
    font-size: 11px;
    text-align: center;
    transition: all 0.2s ease;
    margin-top: 4px;
    min-height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.alert-selected-option-display.active {
    background: rgba(41, 98, 255, 0.05);
    border-color: var(--tv-accent);
    color: #ffffff;
}

.chart-alert-remove {
    position: absolute;
    right: 75px;
    width: 20px;
    height: 20px;
    padding: 0;
    background: rgba(18, 18, 18, 0.88);
    border: 1px solid rgba(242, 54, 69, 0.55);
    border-radius: 3px;
    color: #f87171;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    opacity: 0.65;
    transform: translateY(-50%);
    transition: all 0.15s ease;
    z-index: 1000 !important;
    pointer-events: auto !important;
    box-shadow: none;
}

.chart-alert-remove::before {
    content: '';
    position: absolute;
    inset: -12px;
}

.chart-drawing-remove {
    position: absolute;
    right: 40px;
    width: 24px;
    height: 24px;
    background: rgba(255, 152, 0, 0.95);
    border: 2px solid #ffffff;
    border-radius: 4px;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
    transform: translateY(-50%);
    transition: all 0.15s ease;
    z-index: 1000 !important;
    pointer-events: auto !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}
.chart-drawing-remove:hover, .chart-alert-remove:hover {
    transform: translateY(-50%) scale(1.15);
    background: #ff0000;
}

.chart-alert-add {
    position: absolute;
    z-index: 90;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    touch-action: manipulation;
}

.flyout-header-actions {
    display: flex;
    align-items: center;
    gap: 3px;
}

.flyout-maximize {
    width: 18px;
    height: 18px;
    padding: 0;
    border: 0;
    border-radius: 3px;
    color: var(--tv-text-dim);
    background: transparent;
    font-size: 8px;
    cursor: pointer;
}

.flyout-maximize:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.right-rail-container.flyout-open.flyout-maximized .rail-flyout {
    position: fixed;
    top: var(--header-height);
    right: 0;
    bottom: 0;
    left: var(--desktop-rail-width, 84px);
    width: calc(100vw - var(--desktop-rail-width, 84px));
    max-width: calc(100vw - var(--desktop-rail-width, 84px));
    z-index: 1400;
}

.chart-alert-add span,
.chart-alert-add .chart-alert-cancel {
    display: none;
}

.chart-alert-add.above {
    background: rgba(8, 153, 129, 0.85);
}

.chart-alert-add.below {
    background: rgba(242, 54, 69, 0.85);
}

.chart-alert-add:active {
    opacity: 0.8;
}

/* TradingView-style hover "+" — small and faint, brightens on hover */
.chart-alert-plus {
    position: absolute;
    right: 54px;
    width: 16px;
    height: 16px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    color: var(--tv-text-dim);
    font-size: 8px;
    cursor: pointer;
    opacity: 0.28;
    transform: translateY(-50%);
    transition: opacity 0.12s ease, background 0.12s ease, color 0.12s ease;
    z-index: 95;
    touch-action: manipulation;
}

.chart-alert-plus:hover {
    opacity: 1;
    background: var(--tv-accent, #2962ff);
    color: #fff;
}

.chart-alert-remove:hover {
    background: rgba(242, 54, 69, 0.16);
    color: #f23645;
    opacity: 1;
    transform: translateY(-50%);
    box-shadow: none;
}

/* ─── Drawing Tools & Simple Dollar Measure Badge ─── */
.tool-icon.active {
    color: var(--accent-cyan, #00f0ff) !important;
    background: rgba(0, 240, 255, 0.18) !important;
    border: 1px solid rgba(0, 240, 255, 0.5);
    box-shadow: 0 0 8px rgba(0, 240, 255, 0.3);
}

.chart-measure-badge {
    position: absolute;
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 200;
    background: rgba(15, 23, 42, 0.94);
    border: 1px solid #3b82f6;
    border-radius: 6px;
    padding: 6px 14px;
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    pointer-events: auto;
}
.chart-measure-badge.positive { border-color: #10b981; color: #34d399; }
.chart-measure-badge.negative { border-color: #ef4444; color: #f87171; }
.chart-measure-badge button {
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 0 2px;
    transition: color 0.15s ease;
}
.chart-measure-badge button:hover { color: #ffffff; }

/* ─── Premium Positions Card & Interactive Drawer ─── */
.position-card {
    background: rgba(20, 24, 33, 0.6);
    backdrop-filter: var(--glass);
    -webkit-backdrop-filter: var(--glass);
    border: 1px solid var(--tv-border);
    border-radius: var(--radius);
    padding: 12px;
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.position-card:hover {
    background: rgba(26, 31, 43, 0.85);
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

/* Dynamic Left Accent Borders for P&L state */
.position-card.pos-gain-up {
    border-left: 3px solid var(--tv-buy);
}

.position-card.pos-gain-down {
    border-left: 3px solid var(--tv-sell);
}

.pos-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    padding-bottom: 6px;
}

.pos-card-symbol-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
}

.pos-card-symbol {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.2px;
}

.pos-badge {
    font-size: 10px;
    font-weight: 800;
    padding: 1px 5px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pos-badge.badge-stock {
    background: rgba(41, 98, 255, 0.15);
    color: #3b82f6;
    border: 1px solid rgba(41, 98, 255, 0.3);
}

.pos-badge.badge-option {
    background: rgba(139, 92, 246, 0.15);
    color: #a78bfa;
    border: 1px solid rgba(139, 92, 246, 0.3);
}

.pos-badge.badge-long {
    background: rgba(8, 153, 129, 0.1);
    color: var(--tv-buy);
    border: 1px solid rgba(8, 153, 129, 0.25);
}

.pos-badge.badge-short {
    background: rgba(242, 54, 69, 0.1);
    color: var(--tv-sell);
    border: 1px solid rgba(242, 54, 69, 0.25);
}

.pos-metric-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 12px;
    font-size: 13px;
}

.pos-metric-item {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.pos-metric-label {
    font-size: 10px;
    font-weight: 600;
    color: #8c939e;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.pos-metric-val {
    font-family: var(--font-mono);
    color: #ffffff;
    font-weight: 700;
    font-size: 14px;
}

.pos-metric-val.val-gain-positive {
    color: var(--tv-buy);
    font-weight: 600;
}

.pos-metric-val.val-gain-negative {
    color: var(--tv-sell);
    font-weight: 600;
}

.val-gain-positive {
    color: var(--tv-buy) !important;
}

.val-gain-negative {
    color: var(--tv-sell) !important;
}

.pos-action-row {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 6px;
    margin-top: 4px;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    padding-top: 8px;
}

.pos-actions-toggle {
    flex: none;
    font-size: 14px;
    letter-spacing: 1px;
}

.pos-secondary-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    max-height: 0;
    margin-top: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.16s ease, margin-top 0.16s ease, opacity 0.16s ease;
}

.pos-secondary-actions.expanded {
    max-height: 36px;
    margin-top: 2px;
    opacity: 1;
}

.pos-btn {
    flex: 1;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--tv-border);
    color: var(--tv-text);
    padding: 5px 0;
    border-radius: var(--radius);
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: all 0.2s ease;
}

.pos-btn:hover {
    background: var(--tv-hover);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.2);
}

.pos-btn:focus-visible {
    outline: 2px solid var(--tv-accent) !important;
    outline-offset: 2px;
}

.pos-btn.btn-protect {
    color: var(--accent-cyan);
}

.pos-btn.btn-protect:hover {
    background: rgba(0, 240, 255, 0.08);
    border-color: var(--accent-cyan);
}

.pos-btn.btn-buy-more {
    color: var(--tv-buy);
}

.pos-btn.btn-buy-more:hover {
    background: rgba(8, 153, 129, 0.08);
    border-color: var(--tv-buy);
}

.pos-btn.btn-sell-pos {
    color: var(--tv-sell);
}

.pos-btn.btn-sell-pos:hover {
    background: rgba(242, 54, 69, 0.08);
    border-color: var(--tv-sell);
}

/* Inline Sell drawer styling */
.pos-sell-drawer {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-top: 1px dashed rgba(255, 255, 255, 0.06);
}

.pos-sell-drawer.expanded {
    max-height: 140px;
    opacity: 1;
    padding-top: 8px;
    margin-top: 4px;
}

.pos-sell-drawer-title {
    font-size: 10px;
    font-weight: 700;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    justify-content: space-between;
}

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

.pos-sell-qty-input-wrap {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
}

.pos-sell-qty-input {
    width: 100%;
    background: var(--tv-bg);
    border: 1px solid var(--tv-border);
    color: #ffffff;
    font-family: var(--font-mono);
    font-size: 11px;
    padding: 5px 36px 5px 8px;
    border-radius: 4px;
    outline: none;
}

.pos-sell-qty-input:focus {
    border-color: var(--tv-sell);
}

.pos-sell-qty-max-label {
    position: absolute;
    right: 8px;
    font-size: 9px;
    font-weight: 700;
    color: var(--tv-text-dim);
}

.pos-sell-pct-group {
    display: flex;
    gap: 3px;
}

.pos-sell-pct-chip {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--tv-border);
    color: var(--tv-text-dim);
    font-size: 9px;
    font-weight: 700;
    padding: 5px 6px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.pos-sell-pct-chip:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.pos-sell-pct-chip.active {
    background: rgba(242, 54, 69, 0.15);
    color: var(--tv-sell);
    border-color: var(--tv-sell);
}

.pos-sell-drawer-actions {
    display: flex;
    gap: 6px;
}

.pos-sell-confirm-btn {
    flex: 2;
    background: var(--tv-sell);
    border: 1px solid var(--tv-sell);
    color: #ffffff;
    font-size: 10px;
    font-weight: 700;
    padding: 6px 0;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
}

.pos-sell-confirm-btn:hover {
    background: #d62c39;
    border-color: #d62c39;
    box-shadow: 0 0 10px rgba(242, 54, 69, 0.3);
}

.pos-sell-cancel-btn {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--tv-border);
    color: var(--tv-text-dim);
    font-size: 10px;
    font-weight: 600;
    padding: 6px 0;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s ease;
}

.pos-sell-cancel-btn:hover {
    background: var(--tv-hover);
    color: #ffffff;
}



/* ─── Daily R:R HUD Premium Styling ─── */
.rr-goal-stat {
    position: relative;
    padding: 0 4px;
}

.rr-values {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    padding: 2px 8px;
    border-radius: 4px;
    transition: all 0.2s ease-in-out;
}

.rr-values:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 240, 255, 0.1);
}

.rr-separator {
    opacity: 0.35;
    color: var(--tv-text-dim);
    margin: 0 2px;
    font-size: 11px;
}

.risk-glow {
    color: #fff;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.1);
}

.goal-glow {
    color: var(--accent-cyan) !important;
    text-shadow: 0 0 10px rgba(0, 240, 255, 0.35);
    font-weight: 700;
}



/* ─── Premium Kinfo Dashboard Stats Styling ─── */
.kinfo-stat-card {
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid var(--tv-border);
    border-radius: 6px;
    padding: 6px 8px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.kinfo-stat-card:hover {
    border-color: rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.035);
}

.kinfo-stat-label {
    font-size: 8px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--tv-text-dim);
    margin-bottom: 2px;
    letter-spacing: 0.4px;
}

.kinfo-stat-value {
    font-size: 13px;
    font-weight: 800;
    color: #ffffff;
    font-family: var(--font-mono);
    line-height: 1.2;
}

.kinfo-stat-sub {
    font-size: 8px;
    color: var(--tv-text-dim);
    margin-top: 2px;
    line-height: 1;
}

/* Upgraded Trade Ledger Badges */
.badge-kinfo-win {
    font-size: 8px;
    font-weight: 800;
    padding: 2px 5px;
    border-radius: 3px;
    background: rgba(16, 185, 129, 0.12);
    color: var(--tv-buy);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-kinfo-loss {
    font-size: 8px;
    font-weight: 800;
    padding: 2px 5px;
    border-radius: 3px;
    background: rgba(239, 68, 68, 0.12);
    color: var(--tv-sell);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.badge-kinfo-long {
    font-size: 8px;
    font-weight: 800;
    padding: 2px 5px;
    border-radius: 3px;
    background: rgba(59, 130, 246, 0.12);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.badge-kinfo-short {
    font-size: 8px;
    font-weight: 800;
    padding: 2px 5px;
    border-radius: 3px;
    background: rgba(139, 92, 246, 0.12);
    color: #a78bfa;
    border: 1px solid rgba(139, 92, 246, 0.2);
}

.badge-kinfo-option {
    font-size: 8px;
    font-weight: 800;
    padding: 2px 5px;
    border-radius: 3px;
    background: rgba(6, 182, 212, 0.12);
    color: #22d3ee;
    border: 1px solid rgba(6, 182, 212, 0.2);
}

.badge-kinfo-equity {
    font-size: 8px;
    font-weight: 800;
    padding: 2px 5px;
    border-radius: 3px;
    background: rgba(156, 163, 175, 0.12);
    color: #d1d5db;
    border: 1px solid rgba(156, 163, 175, 0.2);
}



/* ─── News Pane ─── */
.news-item {
    background: var(--tv-pane-bg);
    border: 1px solid var(--tv-border);
    border-radius: 4px;
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.news-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
}

.news-meta {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: var(--tv-text-dim);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.news-title {
    font-size: 12px;
    color: var(--tv-text);
    text-decoration: none;
    line-height: 1.4;
    font-weight: 500;
}

.news-title:hover {
    color: var(--tv-buy);
    text-decoration: underline;
}

.signal-badge {
    display: inline-block;
    width: 6px;
    height: 6px;
    background-color: #EF4444;
    border-radius: 50%;
    margin-left: 4px;
    box-shadow: 0 0 4px #EF4444;
    animation: pulse-red 2s infinite;
}

/* ─── Krug Usability Audit Fixes ─── */

/* Fix 1: Automation HUD — Button Risk Hierarchy */
#autoStartBtn {
    background: var(--tv-buy) !important;
    color: #fff !important;
    font-weight: 800;
    border: 1px solid var(--tv-buy);
    box-shadow: 0 0 12px rgba(8, 153, 129, 0.25);
    transition: all 0.2s ease;
}

#autoStartBtn:hover {
    box-shadow: 0 0 20px rgba(8, 153, 129, 0.5);
    transform: translateY(-1px);
}

#autoStartBtn:disabled {
    opacity: 0.6;
    box-shadow: none;
    transform: none;
}

#autoStopBtn {
    background: rgba(242, 54, 69, 0.15) !important;
    color: var(--tv-sell) !important;
    font-weight: 700;
    border: 1px solid rgba(242, 54, 69, 0.3);
    transition: all 0.2s ease;
}

#autoStopBtn:hover {
    background: var(--tv-sell) !important;
    color: #fff !important;
    box-shadow: 0 0 12px rgba(242, 54, 69, 0.4);
}

/* Fix 4: PnL Calibration — Increased Discoverability */
.pnl-calibrate-btn {
    opacity: 0.6 !important;
}

/* ─── Confirmation Modal (Defensive UI) ─── */
.confirm-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(6px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: confirmFadeIn 0.15s ease-out;
}

@keyframes confirmFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.confirm-modal {
    background: #1a1e2a;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    padding: 24px 28px;
    box-sizing: border-box;
    width: min(340px, calc(100vw - 24px));
    min-width: 0;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    animation: confirmSlideUp 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes confirmSlideUp {
    from {
        transform: translateY(12px);
        opacity: 0;
    }

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

.confirm-modal-title {
    font-size: 14px;
    font-weight: 800;
    color: #fff;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.confirm-modal-title .confirm-icon {
    font-size: 18px;
}

.confirm-modal-body {
    font-size: 12px;
    color: var(--tv-text-dim);
    line-height: 1.6;
    margin-bottom: 20px;
}

.confirm-modal-body .confirm-detail {
    margin-top: 8px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 12px;
    color: #fff;
    font-weight: 600;
}

.confirm-modal-actions {
    display: flex;
    gap: 10px;
}

@media (max-width: 480px) {
    .quick-trade-actions {
        flex-direction: column;
    }
}

.confirm-btn {
    flex: 1;
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    font-weight: 700;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s ease;
    letter-spacing: 0.5px;
}

.confirm-btn:focus-visible,
.trade-order-type-btn:focus-visible,
.option-intent-btn:focus-visible,
.trade-option-type-btn:focus-visible {
    outline: 2px solid var(--tv-accent);
    outline-offset: 2px;
}

.confirm-btn:disabled {
    opacity: 0.55;
    cursor: wait;
}

.confirm-btn-cancel {
    background: rgba(255, 255, 255, 0.06);
    color: var(--tv-text-dim);
    border: 1px solid var(--tv-border);
}

.confirm-btn-cancel:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.confirm-btn-buy {
    background: var(--tv-buy);
    color: #fff;
    box-shadow: 0 4px 12px rgba(8, 153, 129, 0.3);
}

.confirm-btn-buy:hover {
    box-shadow: 0 6px 18px rgba(8, 153, 129, 0.5);
    transform: translateY(-1px);
}

.confirm-btn-sell {
    background: var(--tv-sell);
    color: #fff;
    box-shadow: 0 4px 12px rgba(242, 54, 69, 0.3);
}

.confirm-btn-sell:hover {
    box-shadow: 0 6px 18px rgba(242, 54, 69, 0.5);
    transform: translateY(-1px);
}

.confirm-btn-start {
    background: var(--tv-buy);
    color: #fff;
    box-shadow: 0 4px 12px rgba(8, 153, 129, 0.3);
}

.confirm-btn-start:hover {
    box-shadow: 0 6px 18px rgba(8, 153, 129, 0.5);
    transform: translateY(-1px);
}

/* ─── Form Validation Error State ─── */
.input-error {
    border-color: var(--tv-sell) !important;
    box-shadow: 0 0 0 1px rgba(242, 54, 69, 0.3) !important;
    animation: inputShake 0.3s ease;
}

@keyframes inputShake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-3px);
    }

    75% {
        transform: translateX(3px);
    }
}

/* ─── Mobile Overrides for Automation Tab ─── */
@media (max-width: 850px) {
    .automation-tab-container {
        flex-direction: column !important;
        overflow-y: auto;
    }

    .automation-left-col {
        flex: none;
        overflow-y: visible;
        padding: 12px;
    }

    .automation-right-col {
        width: 100% !important;
        flex-shrink: 1;
        border-left: none;
        border-top: 1px solid var(--tv-border);
        padding: 12px;
        background: rgba(0, 0, 0, 0.15);
        box-sizing: border-box;
    }

    .settings-accordion {
        min-width: 100% !important;
    }
}

@media (max-width: 600px) {
    .automation-hud {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .automation-hud #autoStatus {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
    }

    .hud-actions {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 4px;
        width: 100%;
    }

    .hud-actions .mode-btn {
        padding: 6px 2px;
        font-size: 9px;
        text-align: center;
    }

    .screener-import-row.horizontal {
        flex-direction: column;
        align-items: stretch;
    }

    .screener-import-row.horizontal button,
    .screener-import-row.horizontal input {
        width: 100% !important;
    }
}

/* ─── Mobile Overrides for Right Rail ─── */
@media (max-width: 768px) {
    .terminal-container {
        grid-template-columns: 1fr 60px !important;
    }

    .rail-flyout {
        position: fixed;
        top: var(--header-height);
        left: 60px;
        bottom: 0;
        z-index: 1000;
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5);
    }

    .right-rail-container.flyout-open .rail-flyout {
        width: min(390px, calc(100vw - 72px));
    }
}

/* W3.CSS Refinements & Semantic Color Overrides */
.w3-green {
    background-color: var(--color-profit) !important;
    color: #fff !important;
}

.w3-light-green {
    background-color: rgba(0, 230, 118, 0.8) !important;
    color: #fff !important;
}

.w3-red {
    background-color: var(--color-danger) !important;
    color: #fff !important;
}

.w3-pale-red {
    background-color: rgba(255, 23, 68, 0.8) !important;
    color: #fff !important;
}

.w3-dark-grey {
    background-color: var(--tv-bg-alt) !important;
    color: var(--tv-text) !important;
}

.w3-black {
    background-color: var(--tv-bg) !important;
    color: var(--text-bright) !important;
}

.w3-blue {
    background-color: var(--color-scan) !important;
    color: #fff !important;
}

.w3-input,
.w3-button,
.w3-dropdown-content {
    font-family: var(--font-main);
}

.w3-table th {
    color: var(--tv-text-dim);
    text-transform: uppercase;
    font-size: 10px;
}

.w3-table td {
    color: var(--tv-text);
    font-size: 12px;
}
/* GEX & Charm Row Styling */
.gex-charm-row {
    transition: background-color 0.15s ease, transform 0.1s ease;
    cursor: pointer;
}
.gex-charm-row:hover {
    background-color: rgba(255, 255, 255, 0.05);
}
.gex-charm-row:active {
    transform: scale(0.99);
}

/* ─── GEX Strike Ladder ─────────────────────────────────────── */
.gex-panel {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    background: #090b10;
}

#optionsRailPane.active {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

#optionsRailPane > .chain-header {
    flex-shrink: 0;
}

.gex-summary {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto 30px;
    align-items: center;
    gap: 12px;
    min-height: 54px;
    padding: 8px 10px;
    background: #11141b;
    border-bottom: 1px solid var(--tv-border);
}

.gex-summary-main,
.gex-summary-value {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.gex-summary-value {
    align-items: flex-end;
    font-family: var(--font-mono);
}

.gex-eyebrow,
.gex-summary-value > span {
    color: var(--tv-text-dim);
    font-size: 9px;
    font-weight: 700;
}

.gex-regime,
.gex-summary-value strong {
    margin-top: 3px;
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.1;
    white-space: nowrap;
}

.gex-regime.positive,
.gex-summary-value strong.positive {
    color: #45e69a;
}

.gex-regime.negative,
.gex-summary-value strong.negative {
    color: #ff5a7a;
}

.gex-regime.neutral {
    color: var(--tv-text-dim);
}

.gex-refresh-btn {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    padding: 0;
    color: var(--tv-text-dim);
    background: transparent;
    border: 1px solid var(--tv-border);
    border-radius: 4px;
    cursor: pointer;
}

.gex-refresh-btn:hover {
    color: #fff;
    border-color: #45e69a;
}

.gex-level-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    background: #0d1016;
    border-bottom: 1px solid var(--tv-border);
}

.gex-level-item {
    min-width: 0;
    padding: 7px 9px;
    border-right: 1px solid var(--tv-border);
}

.gex-level-item:last-child {
    border-right: 0;
}

.gex-level-item span {
    display: block;
    color: var(--tv-text-dim);
    font-size: 8px;
    font-weight: 700;
    white-space: nowrap;
}

.gex-level-item strong {
    display: block;
    margin-top: 2px;
    overflow: hidden;
    color: #f3f5f8;
    font-family: var(--font-mono);
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gex-level-item.call-wall strong {
    color: #45e69a;
}

.gex-level-item.zero-gamma strong {
    color: #f3f5f8;
}

.gex-level-item.put-wall strong {
    color: #d786ff;
}

.exposure-readout {
    display: grid;
    grid-template-columns: minmax(115px, 0.8fr) minmax(150px, 1.25fr) minmax(120px, 1fr);
    min-height: 42px;
    background: #10141b;
    border-bottom: 1px solid var(--tv-border);
}

.exposure-readout-item {
    min-width: 0;
    padding: 7px 9px;
    border-right: 1px solid var(--tv-border);
}

.exposure-readout-item:last-child {
    border-right: 0;
}

.exposure-readout-item span {
    display: block;
    overflow: hidden;
    color: #7f8794;
    font-size: 7px;
    font-weight: 800;
    line-height: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.exposure-readout-item strong {
    display: block;
    margin-top: 2px;
    overflow: hidden;
    color: #e9edf3;
    font-family: var(--font-main);
    font-variant-numeric: tabular-nums;
    font-size: 10px;
    line-height: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.exposure-readout-item strong.positive {
    color: #58ed9d;
}

.exposure-readout-item strong.negative {
    color: #d786ff;
}

.exposure-readout-item strong.caution {
    color: #ff8c69;
}

.exposure-legend {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 24px;
    padding: 5px 9px;
    overflow-x: auto;
    color: #89919e;
    background: #0b0e13;
    border-bottom: 1px solid var(--tv-border);
    font-family: var(--font-main);
    font-size: 7px;
    font-weight: 700;
    white-space: nowrap;
}

.legend-swatch {
    display: inline-block;
    width: 9px;
    height: 9px;
    margin-right: 3px;
    vertical-align: -1px;
    border: 1px solid rgba(255, 255, 255, 0.24);
}

.legend-swatch.positive {
    background: #ffcc1a;
}

.legend-swatch.negative {
    background: #8a4fd6;
}

.legend-swatch.spot {
    background: #23f0c7;
}

.exposure-legend .legend-node {
    padding: 1px 3px;
    color: #090a0d;
    border-radius: 2px;
    font-size: 7px;
}

.exposure-legend .legend-node.major {
    color: #17130a;
    background: #ffe34e;
    border: 1px solid #fff4a3;
}

.exposure-legend .legend-node.strong {
    color: #ffffff;
    background: #7065ad;
    border: 1px solid #b8b1df;
}

.exposure-legend .legend-node.secondary {
    color: #f5f7fa;
    background: transparent;
    border: 1px solid #f5f7fa;
}

.gex-data-meta {
    min-height: 25px;
    padding: 6px 9px;
    overflow: hidden;
    color: var(--tv-text-dim);
    background: #0b0e13;
    border-bottom: 1px solid var(--tv-border);
    font-family: var(--font-main);
    font-variant-numeric: tabular-nums;
    font-size: 8px;
    line-height: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gex-heatmap-scroll {
    flex: 1;
    min-height: 180px;
    overflow: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    background: #080a0e;
}

.gex-matrix {
    --expiry-count: 1;
    width: 100%;
    font-family: var(--font-main);
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1;
}

/* Expiration filter chips pinned above the matrix (isolate 0DTE / a single expiry). */
.gex-expiry-filter {
    position: sticky;
    top: 0;
    left: 0;
    z-index: 11;
    display: flex;
    gap: 3px;
    padding: 3px 4px;
    background: #151922;
    border-bottom: 1px solid #2a2f3a;
    overflow-x: auto;
    scrollbar-width: none;
}

.gex-expiry-filter::-webkit-scrollbar {
    display: none;
}

.gex-exp-chip {
    flex: 0 0 auto;
    padding: 2px 7px;
    color: var(--tv-text-dim);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid transparent;
    border-radius: 5px;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.02em;
    cursor: pointer;
    white-space: nowrap;
}

.gex-exp-chip:hover {
    color: #e8ebf0;
    background: rgba(255, 255, 255, 0.1);
}

.gex-exp-chip.active {
    color: #061713;
    background: #23f0c7;
    border-color: #23f0c7;
}

.gex-matrix-header,
.gex-matrix-row {
    display: grid;
    grid-template-columns: 56px repeat(var(--expiry-count), minmax(72px, 1fr));
}

.gex-matrix-header {
    position: sticky;
    top: 0;
    z-index: 8;
    min-height: 30px;
    background: #151922;
    border-bottom: 1px solid #343946;
}

.gex-matrix-corner,
.gex-matrix-expiry {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3px 4px;
    color: var(--tv-text-dim);
    border-right: 1px solid var(--tv-border);
    font-size: 8px;
    font-weight: 700;
}

.gex-matrix-corner {
    position: sticky;
    left: 0;
    z-index: 10;
    justify-content: flex-start;
    background: #151922;
}

.gex-matrix-expiry {
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.gex-matrix-expiry strong {
    color: #e8ebf0;
    font-size: 9px;
    font-weight: 700;
}

.gex-matrix-expiry small {
    overflow: hidden;
    max-width: 100%;
    color: #7f8794;
    font-size: 7px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gex-matrix-row {
    min-height: 22px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.045);
}

.gex-matrix-strike {
    position: sticky;
    left: 0;
    z-index: 4;
    display: flex;
    align-items: center;
    gap: 3px;
    min-width: 0;
    padding: 0 5px;
    color: #e5e8ed;
    background: #10131a;
    border-right: 1px solid #303541;
}

.gex-matrix-strike > strong {
    font-size: 10px;
    font-weight: 700;
}

.gex-heat-cell {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    padding: 1px 3px;
    overflow: hidden;
    border-right: 1px solid rgba(255, 255, 255, 0.055);
    /* Hue scale computed per-cell in JS: yellow-green (max positive) -> green
       -> teal -> blue (max negative). Empty/zero cells fall back to neutral. */
    background: var(--gex-cell-bg, #24213d);
    color: var(--gex-cell-fg, #aaa6d2);
}

/* Sign-qualified + !important so these beat the global `.positive`/`.negative`
   trade-color rules that would otherwise force green/red text onto the cells. */
.gex-heat-cell.positive,
.gex-heat-cell.negative {
    color: var(--gex-cell-fg, #ece8f5) !important;
}

.gex-heat-cell.neutral {
    background: #24213d;
    color: #aaa6d2;
}

.gex-heat-cell:hover {
    z-index: 2;
    filter: brightness(1.22);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.48);
}

.gex-heat-cell > strong {
    overflow: hidden;
    font-size: 9px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gex-heat-cell > small {
    position: absolute;
    right: 3px;
    bottom: 1px;
    color: inherit;
    opacity: 0.75;
    font-size: 6px;
}

/* Badges follow the cell's computed text color so they stay readable
   anywhere on the yellow->purple scale. */
.gex-node-badge {
    position: absolute;
    top: 2px;
    left: 3px;
    padding: 0;
    color: inherit;
    background: transparent;
    border: 0;
    border-radius: 0;
    font-size: 7px;
    font-weight: 900;
    line-height: 9px;
}

/* Node cells keep the scale color; a ring marks their importance.
   "major" (top 3) gets a bold ring, "strong" (rank 4-8) a thinner one. */
.gex-heat-cell.has-major-node {
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.85);
}

.gex-heat-cell.has-strong-node {
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5);
}

.gex-matrix-row.is-spot {
    box-shadow: inset 0 2px 0 #23f0c7, inset 0 -2px 0 #0b9f84;
}

.gex-matrix-row.is-spot .gex-matrix-strike {
    color: #061713;
    background: #23f0c7;
}

/* Spot marker: little arrow to the left of the strike number so the
   current price row jumps out when scanning the GEX/charm matrix. */
.gex-matrix-row.is-spot .gex-matrix-strike::before {
    content: '\25B6';
    flex-shrink: 0;
    color: #061713;
    font-size: 8px;
    line-height: 1;
}

.gex-matrix-row.is-spot .gex-heat-cell {
    box-shadow: inset 0 2px 0 rgba(35, 240, 199, 0.95), inset 0 -2px 0 rgba(11, 159, 132, 0.95);
}

.gex-matrix-row:hover .gex-matrix-strike {
    background: #1a1f29;
}

.gex-matrix-row.is-spot:hover .gex-matrix-strike {
    background: #35d7ff;
}

.gex-ladder-head,
.gex-ladder-row {
    display: grid;
    grid-template-columns: 88px minmax(100px, 1fr) 92px;
    align-items: center;
}

.gex-ladder-head {
    min-height: 26px;
    padding: 0 8px;
    color: var(--tv-text-dim);
    background: #151922;
    border-bottom: 1px solid var(--tv-border);
    font-size: 8px;
    font-weight: 700;
}

.gex-ladder-head span:nth-child(2) {
    text-align: center;
}

.gex-ladder-head span:last-child {
    text-align: right;
}

.gex-ladder {
    flex: 1;
    min-height: 180px;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    background: #090b10;
}

.gex-ladder-row {
    position: relative;
    min-height: 34px;
    padding: 0 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.045);
    background: rgba(38, 212, 148, var(--gex-alpha));
    font-family: var(--font-main);
    font-variant-numeric: tabular-nums;
}

.gex-ladder-row.negative {
    background: rgba(123, 55, 162, var(--gex-alpha));
}

.gex-ladder-row:hover {
    filter: brightness(1.18);
}

.gex-ladder-row.has-level {
    box-shadow: inset 2px 0 0 rgba(255, 255, 255, 0.55);
}

.gex-ladder-row.is-spot {
    z-index: 1;
    min-height: 40px;
    background: #f2da38;
    color: #08090c;
    box-shadow: inset 0 2px 0 #fff59c, inset 0 -2px 0 #b89d00;
}

.gex-strike-cell {
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
}

.gex-strike-cell > strong {
    font-size: 12px;
}

.gex-badges {
    display: flex;
    gap: 2px;
    min-width: 0;
}

.gex-badge {
    padding: 1px 3px;
    color: #050608;
    background: #c8ced8;
    border-radius: 2px;
    font-size: 7px;
    font-weight: 800;
}

.gex-badge.call {
    background: #45e69a;
}

.gex-badge.put {
    color: #fff;
    background: #9b51c7;
}

.gex-badge.zero {
    background: #f3f5f8;
}

.gex-badge.spot {
    background: #f2da38;
}

.gex-ladder-row.is-spot .gex-badge.spot {
    border: 1px solid #08090c;
}

.gex-bar-track {
    position: relative;
    height: 16px;
    margin: 0 7px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.22);
}

.gex-center-line {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 1px;
    background: rgba(255, 255, 255, 0.35);
}

.gex-bar {
    position: absolute;
    top: 2px;
    bottom: 2px;
}

.gex-bar.positive {
    background: #4af0a2;
}

.gex-bar.negative {
    background: #d786ff;
}

.gex-ladder-row.is-spot .gex-bar-track {
    background: rgba(0, 0, 0, 0.18);
}

.gex-ladder-row.is-spot .gex-center-line {
    background: rgba(0, 0, 0, 0.45);
}

.gex-value-cell {
    overflow: hidden;
    font-size: 11px;
    font-weight: 700;
    text-align: right;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gex-value-cell.positive {
    color: #bdffdd;
}

.gex-value-cell.negative {
    color: #f0c8ff;
}

.gex-ladder-row.is-spot .gex-value-cell,
.gex-ladder-row.is-spot .gex-strike-cell {
    color: #08090c;
}

.gex-loading,
.gex-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 180px;
    padding: 20px;
    color: var(--tv-text-dim);
    font-size: 11px;
    text-align: center;
}

.gex-error {
    color: var(--sell-red);
}

@media (max-width: 768px) {
    :root {
        --header-height: calc(50px + env(safe-area-inset-top, 0px));
    }

    .terminal-container {
        padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px));
    }

    .top-bar {
        height: var(--header-height) !important;
        min-height: var(--header-height);
        flex-wrap: nowrap !important;
        justify-content: space-between !important;
        padding: env(safe-area-inset-top, 0px) 7px 0 !important;
        gap: 6px !important;
    }

    .top-left,
    .header-right-group {
        width: auto;
        min-width: 0;
        gap: 5px !important;
    }

    .header-watchlist-menu,
    .system-status-group,
    #topDollarChange {
        display: none !important;
    }

    #topSymbol {
        display: none;
    }

    .symbol-search-container input,
    .symbol-search-container:focus-within input,
    .symbol-search-container.expanded input {
        width: 66px !important;
        padding: 2px;
        opacity: 1;
    }

    .top-ticker-hud {
        gap: 5px !important;
        white-space: nowrap;
    }

    .indicators-bar {
        padding: 0 4px;
    }
    .panel-toggles {
        gap: 6px;
    }
    #chartToolsDropdownBtn {
        width: 36px !important;
        height: 32px !important;
        padding: 0 !important;
        justify-content: center;
        gap: 0 !important;
    }
    #chartToolsActiveLabel,
    #chartToolsDropdownBtn .fa-chevron-down,
    .panel-toggles > .icon-btn {
        display: none !important;
    }
    .mobile-chart-tool-item {
        display: flex !important;
    }
    .save-contract-star {
        opacity: 0.22;
    }
    .save-contract-star.is-saved,
    .save-contract-star:focus-visible {
        opacity: 1;
    }

    .right-rail-container { position: fixed; inset: auto 0 0; width: 100%; max-width: 100vw; height: calc(56px + env(safe-area-inset-bottom, 0px)); z-index: 1000; overflow: visible; isolation: isolate; }
    .right-rail-container.flyout-open { z-index: 1500; }
    .right-tab-rail { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: stretch; width: 100%; max-width: 100vw; height: 56px; padding: 0; gap: 0; overflow: visible; position: relative; z-index: 1502; background: #111722; }
    .rail-tab, .rail-tab-group { width: 100%; min-width: 0; height: 56px; }
    .rail-tab { padding: 5px 3px; }
    .rail-tab-group > .rail-tab { width: 100%; }
    .right-tab-rail .rail-tab.active::after { top: auto; bottom: 0; left: 50%; width: 22px; height: 2px; transform: translateX(-50%); }
    .right-rail-container:not(.flyout-open):not(.mobile-more-open) .mobile-chart-tab,
    .right-rail-container.mobile-more-open .mobile-more-tab,
    .mobile-more-tab.context-active { color: #fff; background: rgba(41, 98, 255, 0.18); }
    .right-rail-container:not(.flyout-open):not(.mobile-more-open) .mobile-chart-tab::after,
    .right-rail-container.mobile-more-open .mobile-more-tab::after,
    .mobile-more-tab.context-active::after { content: ''; position: absolute; bottom: 0; left: 50%; width: 22px; height: 2px; transform: translateX(-50%); background: var(--color-scan); border-radius: 2px 2px 0 0; }
    .rail-sub-tabs { display: none !important; }
    .rail-flyout { position: fixed; inset: auto 0 calc(56px + env(safe-area-inset-bottom, 0px)); width: 100%; max-width: 100vw; min-width: 0; max-height: 0; pointer-events: none; opacity: 0; overflow: hidden; border-top: 1px solid var(--tv-border); border-right: 0; box-sizing: border-box; z-index: 1501; }
    .right-rail-container.flyout-open .rail-flyout { width: 100%; max-width: 100vw; max-height: min(70dvh, calc(100dvh - var(--header-height) - 56px - env(safe-area-inset-bottom, 0px))); pointer-events: auto; opacity: 1; }
    .right-rail-container.flyout-open.flyout-maximized .rail-flyout { left: 0; width: 100vw; max-width: 100vw; }
    .flyout-header { position: sticky; top: 0; z-index: 4; }
    .flyout-header-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
    .flyout-content { min-width: 0; width: 100%; max-width: 100%; overflow-x: hidden; overscroll-behavior: contain; padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
    .flyout-close { flex-shrink: 0; position: relative; z-index: 5; border-radius: 8px; background: rgba(255, 255, 255, 0.04); }
    .mobile-primary-tab { display: flex; }
    .mobile-secondary-tab { display: none; }
    .right-rail-container.mobile-more-open .mobile-secondary-tab { display: flex; position: fixed; right: 8px; bottom: calc(var(--mobile-more-offset, 56px) + env(safe-area-inset-bottom, 0px)); z-index: 1001; width: 176px; height: 48px; background: #171b24; border: 1px solid var(--tv-border); }
    .right-rail-container.mobile-more-open button.mobile-secondary-tab,
    .right-rail-container.mobile-more-open .mobile-secondary-tab > .rail-tab { flex-direction: row; justify-content: flex-start; gap: 10px; width: 176px; height: 46px; padding: 0 14px; }
    .right-rail-container.mobile-more-open .mobile-secondary-tab span { width: auto; font-size: 10px; }
    .rail-collapse-toggle { display: none; }

    .flyout-close,
    .flyout-maximize,
    .overlay-close,
    .alert-remove-btn,
    .watchlist-chip .chip-remove {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 44px;
        width: 44px;
        min-height: 44px;
        height: 44px;
        padding: 0;
    }

    .gex-summary {
        grid-template-columns: minmax(0, 1fr) 28px;
        gap: 7px;
        min-height: 72px;
    }

    .gex-summary-main {
        grid-column: 1;
        grid-row: 1;
    }

    .gex-summary-value {
        grid-column: 1;
        grid-row: 2;
        align-items: flex-start;
    }

    .gex-refresh-btn {
        grid-column: 2;
        grid-row: 1 / span 2;
    }

    .gex-level-strip {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .gex-level-item:nth-child(2) {
        border-right: 0;
    }

    .gex-level-item:nth-child(-n + 2) {
        border-bottom: 1px solid var(--tv-border);
    }

    .exposure-readout {
        grid-template-columns: 1fr;
    }

    .exposure-readout-item {
        border-right: 0;
        border-bottom: 1px solid var(--tv-border);
    }

    .exposure-readout-item:last-child {
        border-bottom: 0;
    }

    .gex-ladder-head,
    .gex-ladder-row {
        grid-template-columns: 70px minmax(72px, 1fr) 70px;
    }

    .gex-ladder-head,
    .gex-ladder-row {
        padding-right: 5px;
        padding-left: 5px;
    }

    .gex-bar-track {
        margin-right: 4px;
        margin-left: 4px;
    }

    .gex-badge {
        display: none;
    }

    .gex-badge.spot {
        display: inline-block;
    }

    .gex-value-cell {
        font-size: 9px;
    }

    .chain-header {
        align-items: center;
        flex-direction: row;
        gap: 6px;
        padding: 5px 6px;
    }

    .chain-info,
    .chain-tabs-container {
        width: auto;
        min-width: 0;
    }

    .chain-info {
        flex: 1;
        gap: 5px;
    }

    #chainSymbol {
        font-size: 12px;
    }

    .chain-exp-select {
        min-width: 0;
        max-width: 126px;
        padding: 3px 5px;
        font-size: 11px;
    }

    .chain-table-container {
        height: min(44vh, 360px);
        border-radius: 4px;
    }

    .chain-table {
        min-width: 0;
        width: 100%;
        table-layout: fixed;
        font-size: 11px;
    }

    .chain-table th,
    .chain-table td {
        padding-right: 4px;
        padding-left: 4px;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .chain-table tr { height: 44px; }

    .chain-table th:nth-child(n+6),
    .chain-table td:nth-child(n+6),
    .chain-table th:nth-child(2),
    .chain-table td:nth-child(2) {
        display: none;
    }

    .chain-table th:nth-child(1),
    .chain-table td:nth-child(1) { width: 34%; }

    .chain-table th:nth-child(3),
    .chain-table td:nth-child(3),
    .chain-table th:nth-child(4),
    .chain-table td:nth-child(4),
    .chain-table th:nth-child(5),
    .chain-table td:nth-child(5) { display: table-cell; width: 24%; }

    .chain-table th:nth-child(1),
    .chain-table td:nth-child(1) {
        position: sticky;
        left: 0;
        z-index: 2;
        background: #111620;
    }

    .chart-alert-add {
        width: auto;
        min-width: 132px;
        height: 44px;
        border-width: 1px;
        background: #2a2e39 !important;
        color: #f0f3fa !important;
        box-shadow: none;
    }
    .chart-alert-add span { display: inline; margin: 0 10px 0 6px; }
    .chart-alert-add .chart-alert-cancel { display: inline-block; padding: 14px 8px; margin: -10px -6px -10px 0; }
    .chart-alert-mode-btn { display: flex !important; width: auto !important; border-radius: 4px !important; gap: 5px; }
    .chart-alert-mode-btn.active { color: var(--accent-cyan) !important; background: rgba(0,240,255,.12) !important; }
    .mobile-chain-modes { display: flex; gap: 4px; overflow-x: auto; padding: 0 6px 6px; }
    .mobile-chain-modes button { min-height: 36px; padding: 0 10px; border: 0; border-radius: 4px; background: #20242d; color: #b2b5be; }
    .mobile-chain-modes button.active { color: #fff; background: #2962ff; }

    .chain-table tr.row-first-itm td {
        background: rgba(35, 240, 199, 0.14);
    }

    .gex-heatmap-scroll {
        min-height: 52vh;
        max-height: calc(100dvh - 330px);
    }

    .gex-matrix {
        min-width: max-content;
    }

    .gex-matrix-header,
    .gex-matrix-row {
        grid-template-columns: 46px repeat(var(--expiry-count), 62px);
    }

    .gex-matrix-header {
        min-height: 28px;
    }

    .gex-matrix-row {
        min-height: 24px;
    }

    .gex-matrix-corner,
    .gex-matrix-expiry {
        padding: 3px;
    }

    .gex-matrix-strike {
        padding: 0 4px;
    }

    .gex-matrix-strike > strong {
        font-size: 10px;
    }

    .gex-heat-cell {
        padding: 1px 3px;
    }

    .gex-heat-cell > strong {
        font-size: 9px;
    }

    .gex-heat-cell > small {
        display: none;
    }

    .gex-node-badge {
        top: 2px;
        left: 2px;
        font-size: 7px;
    }
}


/* Extracted Inline Styles */
#autoSaveBtn.has-unsaved::after {
    content: ' •';
    color: #f7a600;
    font-weight: 700;
}

.extracted-style-3 {
    display:flex; flex-direction:column; height:100dvh; overflow:hidden;
}

.extracted-style-4 {
    display:flex; align-items:center; justify-content:flex-end; gap: 16px; z-index:100; padding-left:16px; padding-right:16px; overflow:visible !important; flex-shrink: 0;
}

#symbolInput {
    outline:none;
}

.extracted-style-5 {
    font-size: 8px; margin-left: 4px;
}

.extracted-style-6 {
    background: #089981;
}

.extracted-style-7 {
    background: #f23645;
}

.extracted-style-8 {
    background: #FFFFFF;
}

.extracted-style-9 {
    background: #E040FB;
}

.extracted-style-10 {
    background: #F59E0B;
}

.extracted-style-11 {
    background: rgba(0, 150, 255, 0.8);
}

.extracted-style-12 {
    background: rgba(255, 100, 100, 0.8);
}

.extracted-style-13 {
    background: #8B5CF6;
}

.extracted-style-14 {
    background: #089981; border: 1px dashed #f23645;
}

.extracted-style-15 {
    font-size: 8px; margin-left: 4px;
}

#activeSymbol {
    display: none;
}

#marketStatus {
    display: none;
}

.extracted-style-16 {
    display:flex; flex:1; min-height:0; width:100%; flex-direction: row-reverse;
}

.extracted-style-17 {
    flex:1; display:flex; flex-direction:column; position:relative; min-width:0;
}

.extracted-style-18 {
    justify-content: flex-start; border-bottom: 1px solid var(--tv-border); position: relative; top: 0; left: 0; background: var(--tv-sidebar);
}

#chart-wrapper {
    display: flex; flex-direction: row; width: 100%; height: 100%;
}

#chart-container {
    flex: 1; position: relative;
}

#chart-container-2 {
    flex: 1; position: relative; display: none; border-left: 1px solid var(--tv-border);
}

.extracted-style-19 {
    position: absolute; top: 0; left: 0; right: 0; height: 32px; display: flex; align-items: center; padding: 0 12px; z-index: 10; background: rgba(0,0,0,0.1); border-bottom: 1px solid rgba(255,255,255,0.05);
}

#symbolInput2 {
    background: transparent; border: 1px solid rgba(255,255,255,0.1); color: #fff; width: 70px; font-size: 12px; padding: 4px 6px; border-radius: 4px; font-weight: 600;
}

#timeframeSelect2 {
    background: transparent; border: 1px solid rgba(255,255,255,0.1); color: #fff; font-size: 12px; font-weight: 500; margin-left: 8px; padding: 4px; border-radius: 4px; outline: none; cursor: pointer;
}

.extracted-style-20 {
    color: black;
}

.extracted-style-21 {
    color: black;
}

.extracted-style-22 {
    color: black;
}

.extracted-style-23 {
    color: black;
}

.extracted-style-24 {
    color: black;
}

.extracted-style-25 {
    color: black;
}

.extracted-style-26 {
    color: black;
}

.extracted-style-27 {
    color: black;
}

.extracted-style-28 {
    color: black;
}

.extracted-style-29 {
    color: black;
}

.extracted-style-30 {
    margin-left: auto;
}

#chartLegend2 {
    top: 36px;
}

#executionPanel {
    display:flex; flex-direction: row;
}

.extracted-style-31 {
    background: transparent; border-bottom: 1px solid var(--tv-border); margin-bottom: 8px;
}

.extracted-style-32 {
    gap: 8px;
}

.extracted-style-33 {
    display: flex; gap: 8px; align-items: center;
}

.extracted-style-34 {
    font-size: 10px; color: var(--tv-text-dim); display: flex; align-items: center; gap: 4px; cursor: pointer;
}

.extracted-style-35 {
    font-size: 10px; padding: 2px 8px; color: var(--accent-cyan); display: flex; align-items: center; gap: 4px; font-weight: 700; border-radius: 4px; border: 1px solid rgba(0, 240, 255, 0.2); background: rgba(0, 240, 255, 0.03);
}

.extracted-style-36 {
    font-size: 9px;
}

#autoRailPane {
    padding: 0;
}

#drawdownResetBtn {
    display:none;
}

.extracted-style-37 {
    grid-template-columns:1fr 1fr;
}

#engineStatus {
    margin-left: 8px; color: var(--tv-text-dim); font-size: 10px; font-weight: 400;
}

#autoSaveBtn {
    color: var(--accent-cyan);
}

#autoResetBtn {
    color: var(--tv-text-dim);
}

#scannerSettingsControls {
    display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 8px;
}

.extracted-style-38 {
    flex: 1; min-width: 320px; margin-bottom: 0;
}

.extracted-style-39 {
    height: 100%;
}

.extracted-style-40 {
    margin-bottom: 0;
}

#stratTabOptions {
    display: none;
}

.extracted-style-41 {
    display: flex; flex-direction: column; gap: 4px; padding-top: 8px;
}

.extracted-style-42 {
    font-size: 11px; color: var(--tv-text-dim);
}

#timerStartTime {
    background: var(--tv-bg); color: var(--tv-text); font-size: 13px; padding: 4px;
}

.extracted-style-43 {
    display: flex; flex-direction: column; gap: 4px; padding-top: 8px;
}

.extracted-style-44 {
    font-size: 11px; color: var(--tv-text-dim);
}

#timerStopTime {
    background: var(--tv-bg); color: var(--tv-text); font-size: 13px; padding: 4px;
}

.extracted-style-45 {
    flex: 1; min-width: 320px; margin-bottom: 0;
}

.extracted-style-46 {
    height: 100%;
}

.extracted-style-47 {
    display: flex; gap: 16px; flex-wrap: wrap;
}

.extracted-style-48 {
    min-width: 200px;
}

.extracted-style-49 {
    margin-top: 8px;
}

.extracted-style-50 {
    font-size: 11px; color: var(--tv-text-dim);
}

#lagBarsInput {
    width: 60px; background: rgba(0,0,0,0.2); border: 1px solid var(--tv-border); color: #fff; padding: 4px; border-radius: 4px;
}

.extracted-style-51 {
    flex: 1; min-width: 200px;
}

.extracted-style-52 {
    grid-column: 1 / -1; margin-bottom: 4px;
}

.extracted-style-53 {
    grid-column: 1 / -1; margin-bottom: 8px;
}

.extracted-style-54 {
    display: flex; align-items: center; gap: 8px; justify-content: flex-start; margin-top: 8px; grid-column: 1 / -1;
}

.extracted-style-55 {
    display: flex; align-items: center; gap: 8px; justify-content: flex-start; margin-bottom: 8px;
}

.extracted-style-56 {
    display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px;
}

.extracted-style-57 {
    font-size: 9px; color: var(--tv-accent);
}

#watchlistChipsAuto {
    margin-bottom: 12px; max-height: 80px; overflow-y: auto;
}

.extracted-style-58 {
    margin-bottom: 8px;
}

.extracted-style-59 {
    margin-top: 8px; justify-content: space-between;
}

.extracted-style-60 {
    margin: 0;
}

.extracted-style-61 {
    font-size: 12px;
}

#alertAutoFields {
    margin-top: 8px; border-top: 1px solid var(--tv-bg-lighter); padding-top: 8px;
}

.extracted-style-62 {
    display: flex; gap: 12px; margin-bottom: 8px;
}

.extracted-style-63 {
    flex: 1;
}

.extracted-style-64 {
    flex: 1;
}

#alertStockOrderNote {
    margin: -2px 0 8px; font-size: 10px; color: var(--tv-text-dim);
}

#alertOptionConfig {
    display: none; flex-direction: column; gap: 8px; margin-bottom: 8px;
}

.extracted-style-65 {
    align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 2px;
}

.extracted-style-66 {
    font-size: 10px; font-weight: 700; color: var(--tv-text-dim); text-transform: uppercase; margin-bottom: 0;
}

#alertAutoExpirationSelect {
    flex: 1; min-width: 120px;
}

.extracted-style-67 {
    text-align: center; width: 60px;
}

.extracted-style-68 {
    text-align: right;
}

.extracted-style-69 {
    flex: 1;
}

.extracted-style-70 {
    font-size: 11px; font-weight: 500; color: var(--tv-text-dim); display: block; margin-bottom: 4px;
}

#alertAutoQty {
    width: 100%; padding: 6px; font-size: 11px; background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.1);
}

.extracted-style-71 {
    flex: 1;
}

.extracted-style-72 {
    font-size: 11px; font-weight: 500; color: var(--tv-text-dim); display: block; margin-bottom: 4px;
}

#alertAutoMaxPrice {
    width: 100%; padding: 6px; font-size: 11px; background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.1);
}

.extracted-style-73 {
    flex: 1;
}

.extracted-style-74 {
    font-size: 11px; font-weight: 500; color: var(--tv-text-dim); display: block; margin-bottom: 4px;
}

#alertAutoOptionSL {
    width: 100%; padding: 6px; font-size: 11px; background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.1);
}

.extracted-style-75 {
    flex: 1;
}

.extracted-style-76 {
    font-size: 11px; font-weight: 500; color: var(--tv-text-dim); display: block; margin-bottom: 4px;
}

#alertAutoOptionTP {
    width: 100%; padding: 6px; font-size: 11px; background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.1);
}

.extracted-style-77 {
    margin-top: 8px;
}

.extracted-style-78 {
    flex: 1;
}

.extracted-style-79 {
    font-size: 11px; font-weight: 500; color: var(--tv-text-dim); display: block; margin-bottom: 4px;
}

#alertAutoMaxSpread {
    width: 100%; padding: 6px; font-size: 11px; background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.1);
}

.extracted-style-80 {
    flex: 1;
}

.extracted-style-81 {
    font-size: 11px; font-weight: 500; color: var(--tv-text-dim); display: block; margin-bottom: 4px;
}

#alertAutoTimeout {
    width: 100%; padding: 6px; font-size: 11px; background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.1);
}

.extracted-style-82 {
    margin: 0; flex: 1; justify-content: flex-end;
}

#alertsListHeader {
    margin-top: 12px;
}

#alertsList {
    min-height: 120px; flex: unset;
}

.extracted-style-83 {
    display: flex; flex-direction: column; box-sizing: border-box; margin-top: 12px; border-top: 1px solid var(--tv-bg-lighter); padding-top: 8px; flex: 1;
}

.extracted-style-84 {
    display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px;
}

.extracted-style-85 {
    display: flex; align-items: center; gap: 8px;
}

.extracted-style-86 {
    font-size: 10px; color: var(--tv-text-dim); display: flex; align-items: center; gap: 4px; cursor: pointer; margin-right: 4px;
}

.extracted-style-87 {
    font-size: 9px; color: var(--tv-accent);
}

#signalTabDirectional {
    display: block; flex: 1; min-height: 200px;
}

.extracted-style-88 {
    display: flex; flex-direction: column; height: 100%;
}

#autoPositionDirectional {
    margin-bottom: 4px;
}

#signalLog {
    flex: 1; height: 100%;
}

#signalTabOptions {
    display: none; flex: 1; min-height: 200px;
}

.extracted-style-89 {
    display: flex; flex-direction: column; height: 100%;
}

#autoPositionOptions {
    margin-bottom: 4px;
}

#signalLogOptions {
    flex: 1; height: 100%;
}

.extracted-style-90 {
    display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px;
}

.extracted-style-91 {
    font-size: 11px; font-weight: 700; color: var(--tv-text-dim);
}

.extracted-style-92 {
    margin-top: 12px;
}

.extracted-style-93 {
    margin-top: 8px;
}

#clearWatchlistBtn {
    margin-top: 8px; width: 100%; color: var(--tv-sell);
}

.extracted-style-94 {
    display: flex; gap: 10px; margin-bottom: 12px; justify-content: flex-start; flex-wrap: wrap;
}

.extracted-style-95 {
    display: none;
}

.extracted-style-96 {
    font-size: 10px;
}

#liveFlowTerminal {
    margin-bottom: 12px;
}

#alertCountBadge {
    position: absolute; top: 4px; right: 6px; background-color: #f44336; color: white; border-radius: 10px; min-width: 14px; height: 14px; padding: 0 3px; font-size: 9px; display: none; align-items: center; justify-content: center; font-weight: bold; line-height: 14px; box-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.extracted-style-97 {
    padding: 20px;
}

.extracted-style-98 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.trade-history-sort {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--tv-text-dim);
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
}

.trade-history-sort select {
    min-width: 132px;
    height: 30px;
    border: 1px solid var(--tv-border);
    border-radius: 4px;
    background: var(--tv-bg-alt);
    color: var(--tv-text);
    font-family: var(--font-mono);
    font-size: 11px;
    outline: none;
    padding: 0 8px;
}

#simpleTradesList {
    width: 100%; max-height: 400px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px;
}

.extracted-style-99 {
    color: var(--tv-text-dim); text-align: center; padding: 20px;
}
