/* ==========================================================================
   MetaTrader 5 Android Professional Style Sheet
   Visual System: 90% MT5 Mobile + 10% TradingView
   ========================================================================== */

:root {
    /* Color System */
    --bg-primary: #08090d;
    /* Flat near-black background */
    --bg-secondary: #101115;
    /* Panels & nav bars bg */
    --bg-hover: #16181e;
    /* Item selection & hover */
    --border-color: #1a1c22;
    /* Minimal flat borders */

    --accent-blue: #2196f3;
    /* MT5 classic blue accent */
    --text-white: #ffffff;
    /* Bright white for symbols/primary values */
    --text-gray: #8e929a;
    /* MT5 gray for labels/timestamps */
    --text-muted: #525660;
    /* Darker gray for inactive elements */

    /* Price direction / Order colors */
    --bull-green: #00e676;
    /* Bright neon-ish green for buy rates */
    --bear-red: #ff3d00;
    /* Bright neon-ish red for sell rates */
    --bull-green-bg: rgba(0, 230, 118, 0.12);
    --bear-red-bg: rgba(255, 61, 0, 0.12);

    /* Typography */
    --font-sans: 'Roboto', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

/* ==========================================================================
   Resets & Base Layout
   ========================================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-white);
    font-family: var(--font-sans);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    -webkit-font-smoothing: antialiased;
}

button {
    font-family: inherit;
    border: none;
    background: none;
    color: inherit;
    cursor: pointer;
}

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

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
}

/* ==========================================================================
   App Container & Navigation Layout
   ========================================================================== */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

/* Top Header Bar */
.mt5-top-header {
    height: 52px;
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 0 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 10;
}

.header-left-meta {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.symbol-title-group {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.active-symbol-text {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-white);
    letter-spacing: 0.2px;
}

.active-timeframe-text {
    font-size: 11px;
    font-weight: 500;
    color: var(--accent-blue);
}

.connection-status-group {
    display: flex;
    gap: 8px;
    margin-top: 2px;
}

.status-indicator-mini {
    display: flex;
    align-items: center;
    gap: 4px;
}

.status-indicator-mini .status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.status-indicator-mini .status-dot.connected {
    background-color: var(--bull-green);
    box-shadow: 0 0 4px var(--bull-green);
}

.status-indicator-mini .status-dot.awaiting {
    background-color: #ffb800;
    box-shadow: 0 0 4px #ffb800;
}

.status-indicator-mini .status-dot.disconnected {
    background-color: var(--bear-red);
    box-shadow: 0 0 4px var(--bear-red);
}

.status-indicator-mini .status-lbl {
    font-size: 8px;
    font-weight: 500;
    color: var(--text-gray);
    text-transform: uppercase;
}

/* Quick Trading Panel (MT5-style Sell/Buy boxes) */
.quick-trade-panel {
    display: flex;
    align-items: center;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    height: 36px;
}

.trade-box {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 0 10px;
    min-width: 65px;
    height: 100%;
}

.trade-box.sell-box {
    border-right: 1px solid var(--border-color);
    color: var(--bear-red);
}

.trade-box.buy-box {
    border-left: 1px solid var(--border-color);
    color: var(--bull-green);
}

.trade-lbl {
    font-size: 7px;
    font-weight: 700;
    color: var(--text-gray);
}

.trade-price {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 700;
}

.spread-badge-box {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: var(--bg-secondary);
    padding: 0 6px;
    height: 100%;
    min-width: 32px;
}

.spread-lbl {
    font-size: 6px;
    font-weight: 700;
    color: var(--text-gray);
    text-transform: uppercase;
}

.spread-val {
    font-size: 9px;
    font-weight: 700;
    color: var(--text-white);
}

/* ==========================================================================
   Main Content & Multi-Screen Views
   ========================================================================== */
.app-main-content {
    flex-grow: 1;
    position: relative;
    overflow: hidden;
    width: 100vw;
}

.screen-view {
    display: none;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    background-color: var(--bg-primary);
}

.screen-view.active {
    display: flex;
    flex-direction: column;
}

/* Common Pane Header */
.pane-header {
    height: 40px;
    padding: 0 12px;
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.pane-header h2 {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-white);
}

.count-badge {
    font-size: 10px;
    font-weight: 700;
    background-color: var(--bg-hover);
    color: var(--text-gray);
    padding: 1px 6px;
    border-radius: 10px;
}

/* ==========================================================================
   Screen 1: Quotes Watchlist Style
   ========================================================================== */
.watchlist-list {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    flex-grow: 1;
}

.watchlist-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 48px;
    padding: 0 12px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background-color 0.15s ease;
}

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

.watchlist-item.active {
    background-color: rgba(33, 150, 243, 0.08);
    border-left: 3px solid var(--accent-blue);
    padding-left: 9px;
    /* Offset border width */
}

.watchlist-left {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.item-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-white);
}

.item-time {
    font-family: var(--font-mono);
    font-size: 9px;
    color: var(--text-gray);
}

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

.watchlist-rates-row {
    display: flex;
    gap: 10px;
}

.watchlist-rates-row .rate-val {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 700;
    padding: 2px 4px;
    border-radius: 2px;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.watchlist-rates-row .rate-val.bid {
    color: var(--bull-green);
}

.watchlist-rates-row .rate-val.ask {
    color: var(--bear-red);
}

.watchlist-spread-row {
    font-size: 8px;
    color: var(--text-gray);
    display: flex;
    gap: 2px;
}

.watchlist-spread-row .spread-val {
    font-family: var(--font-mono);
    font-weight: 700;
    color: var(--text-white);
}

/* Tick flashing indicators */
.up-flash {
    background-color: var(--bull-green-bg) !important;
    color: var(--bull-green) !important;
    animation: flashGreen 0.6s ease;
}

.down-flash {
    background-color: var(--bear-red-bg) !important;
    color: var(--bear-red) !important;
    animation: flashRed 0.6s ease;
}

@keyframes flashGreen {
    0% {
        background-color: rgba(0, 230, 118, 0.4);
    }

    100% {
        background-color: var(--bull-green-bg);
    }
}

@keyframes flashRed {
    0% {
        background-color: rgba(255, 61, 0, 0.4);
    }

    100% {
        background-color: var(--bear-red-bg);
    }
}

/* ==========================================================================
   Screen 2: Charts Area
   ========================================================================== */
.timeframe-bar {
    height: 32px;
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 0 6px;
    display: flex;
    align-items: center;
    overflow-x: auto;
}

.timeframe-selector {
    display: flex;
    gap: 2px;
}

.tf-btn {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-gray);
    padding: 3px 8px;
    border-radius: 2px;
}

.tf-btn:hover {
    color: var(--text-white);
    background-color: var(--bg-hover);
}

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

.chart-wrapper {
    flex-grow: 1;
    position: relative;
    background-color: var(--bg-primary);
}

#tv-chart {
    width: 100%;
    height: 100%;
}

.chart-loader {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    z-index: 5;
}

.loader-spinner {
    width: 28px;
    height: 28px;
    border: 2px solid rgba(33, 150, 243, 0.1);
    border-top: 2px solid var(--accent-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.chart-loader span {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--text-gray);
}

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

/* ==========================================================================
   Screen 3: Trade View Panel
   ========================================================================== */
.trade-container {
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 0px;
}

.trade-summary-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    /* Reduced gap by 25% for a compact look */
}

.trade-summary-card.margin-call-active {
    border-color: var(--bear-red) !important;
    box-shadow: 0 0 10px rgba(255, 61, 0, 0.25);
}

.trade-summary-card.margin-call-active #trade-margin-level {
    color: var(--bear-red) !important;
    font-weight: 700;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-gray);
}

.summary-row.highlight {
    font-size: 14px;
    color: var(--text-white);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 6px;
    /* Reduced from 8px to 6px */
    margin-bottom: 2px;
    /* Reduced from 4px to 2px */
}

.bold-text {
    font-weight: 700;
    color: var(--accent-blue);
}

.summary-val {
    font-family: var(--font-mono);
}

.no-positions-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
}

.no-positions-card i {
    font-size: 36px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.no-positions-card h3 {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 6px;
}

.no-positions-card p {
    font-size: 11px;
    color: var(--text-gray);
    line-height: 1.5;
    max-width: 260px;
}

/* ==========================================================================
   Screen 4: History View Panel
   ========================================================================== */
.history-container {
    padding: 0;
}

.history-list {
    display: flex;
    flex-direction: column;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
}

.history-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

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

.meta-row.font-mono {
    font-family: var(--font-mono);
    font-size: 10px;
}

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

.trade-type {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 0px 4px;
    border-radius: 2px;
}

.trade-type.buy {
    color: var(--bull-green);
    background-color: var(--bull-green-bg);
}

.trade-type.sell {
    color: var(--bear-red);
    background-color: var(--bear-red-bg);
}

.history-profit {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 700;
}

.history-profit.positive {
    color: var(--bull-green);
}

.history-profit.negative {
    color: var(--bear-red);
}

/* ==========================================================================
   Screen 5: Settings Panel & Console
   ========================================================================== */
.settings-container {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

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

.group-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-gray);
    letter-spacing: 0.5px;
    margin-left: 2px;
}

.group-title-with-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2px;
}

.clear-btn-flat {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-gray);
    background-color: var(--bg-hover);
    padding: 2px 8px;
    border-radius: 2px;
}

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

.settings-option {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 10px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
}

.option-lbl {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.option-lbl .bold-text {
    font-weight: 700;
    color: var(--text-white);
}

.badge-demo {
    background-color: #ff9f43;
    color: var(--bg-primary);
    font-size: 9px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 2px;
    text-transform: uppercase;
}

.checkbox-wrapper-toggle input[type="checkbox"] {
    position: relative;
    width: 32px;
    height: 16px;
    appearance: none;
    background-color: var(--bg-hover);
    border-radius: 10px;
    transition: background-color 0.2s ease;
    cursor: not-allowed;
}

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

.checkbox-wrapper-toggle input[type="checkbox"]::before {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: var(--text-white);
    top: 2px;
    left: 2px;
    transition: transform 0.2s ease;
}

.checkbox-wrapper-toggle input[type="checkbox"]:checked::before {
    transform: translateX(16px);
}

/* Settings Log Console styling */
.console-box {
    border: 1px solid var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    height: 160px;
    display: flex;
    flex-direction: column;
}

.console-log {
    flex-grow: 1;
    overflow-y: auto;
    padding: 8px;
    font-family: var(--font-mono);
    font-size: 9px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    background-color: #040507;
}

.log-line {
    display: flex;
    gap: 6px;
    line-height: 1.3;
}

.log-time {
    color: var(--text-muted);
}

.log-txt {
    color: var(--text-white);
    word-break: break-all;
}

.log-line.system-msg .log-txt {
    color: var(--accent-blue);
}

.log-line.error-msg .log-txt {
    color: var(--bear-red);
}

.log-line.success-msg .log-txt {
    color: var(--bull-green);
}

/* ==========================================================================
   Bottom Navigation Bar
   ========================================================================== */
.bottom-nav {
    height: 56px;
    background-color: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: 10;
}

.nav-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--text-gray);
    width: 60px;
    height: 100%;
}

.nav-tab i {
    font-size: 16px;
}

.nav-tab span {
    font-size: 9px;
    font-weight: 500;
}

.nav-tab:hover {
    color: var(--text-white);
}

.nav-tab.active {
    color: var(--accent-blue);
}

/* ==========================================================================
   Floating Toast Alerts
   ========================================================================== */
.toast-container {
    position: fixed;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 9999;
    width: 90%;
    max-width: 320px;
    pointer-events: none;
}

.toast {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
    animation: fadeIn 0.2s ease forwards;
}

.toast span {
    font-size: 11px;
    color: var(--text-white);
}

.toast i {
    font-size: 12px;
}

.toast.success i {
    color: var(--bull-green);
}

.toast.error i {
    color: var(--bear-red);
}

.toast.info i {
    color: var(--accent-blue);
}

.toast.warning i {
    color: #ffb800;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

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

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }

    to {
        opacity: 0;
        transform: translateY(-10px);
    }
}

/* ==========================================================================
   Responsive Display Logic (Desktop / Mobile Tablet Styles)
   ========================================================================== */
@media (min-width: 768px) {

    /* Tablet / Desktop Split Screen Layout when Quotes or Chart tab is active */
    .tab-quotes .app-main-content,
    .tab-chart .app-main-content {
        display: grid !important;
        grid-template-columns: 280px 1fr !important;
    }

    .tab-quotes #screen-quotes,
    .tab-chart #screen-quotes {
        display: flex !important;
        border-right: 1px solid var(--border-color);
        height: 100%;
    }

    .tab-quotes #screen-chart,
    .tab-chart #screen-chart {
        display: flex !important;
        height: 100%;
    }

    /* Hide others when split layout is visible */
    .tab-quotes #screen-trade,
    .tab-chart #screen-trade,
    .tab-quotes #screen-history,
    .tab-chart #screen-history,
    .tab-quotes #screen-settings,
    .tab-chart #screen-settings {
        display: none !important;
    }

    /* Make top header trade buttons look premium on desktop */
    .quick-trade-panel {
        height: 38px;
    }

    .trade-box {
        min-width: 90px;
    }
}

/* ==========================================================================
   Terminal Account Management & Sub Screens
   ========================================================================== */
.sub-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-primary);
    z-index: 100;
    display: none;
    flex-direction: column;
}

.sub-screen.active {
    display: flex !important;
}

.back-btn {
    font-size: 13px;
    color: var(--text-white);
    margin-right: 16px;
    padding: 4px;
    cursor: pointer;
}

.add-acc-btn-top {
    font-size: 18px;
    color: var(--accent-blue);
    padding: 4px;
    cursor: pointer;
}

.account-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #11141e;
    border-bottom: 1px solid var(--border-color);
    padding: 6px 12px;
    font-size: 11px;
}

.acc-bar-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.acc-bar-left span {
    font-weight: 500;
}

.acc-bar-num {
    color: var(--text-gray);
    font-family: var(--font-mono);
}

.badge {
    border-radius: 3px;
    padding: 2px 6px;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    display: inline-block;
}

.badge-real {
    background-color: rgba(0, 230, 118, 0.15);
    color: var(--bull-green);
}

.badge-demo {
    background-color: rgba(255, 152, 0, 0.15);
    color: #ff9800;
}

/* Accounts Manager styles */
.accounts-manager-container {
    padding: 12px;
    overflow-y: auto;
    flex: 1;
}

.mapped-account-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 12px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: border-color 0.2s;
}

.mapped-account-card.active {
    border-color: var(--accent-blue);
    box-shadow: 0 0 6px rgba(33, 150, 243, 0.2);
}

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

.acc-card-client-name {
    font-weight: 700;
    font-size: 15px;
    color: var(--text-white);
}

.acc-card-server {
    font-size: 12px;
    color: #b0b3b8;
}

.acc-card-number {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-white);
}

.acc-card-balance {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--bull-green);
    font-weight: 700;
    margin-top: 2px;
}

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

/* Search Broker styles */
.search-broker-container {
    padding: 12px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.search-input-wrapper {
    display: flex;
    align-items: center;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 8px 12px;
    margin-bottom: 16px;
}

.search-icon-input {
    color: var(--text-gray);
    margin-right: 8px;
    font-size: 14px;
}

.search-box-input {
    background: none;
    border: none;
    color: var(--text-white);
    width: 100%;
    font-size: 14px;
}

.broker-results-list {
    flex: 1;
    overflow-y: auto;
}

.broker-result-item {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.broker-result-item:hover {
    background-color: var(--bg-hover);
}

.broker-result-item i {
    color: var(--accent-blue);
    font-size: 16px;
}

.no-results-msg {
    text-align: center;
    color: var(--text-gray);
    padding: 24px 12px;
    font-size: 13px;
}

/* Server Selection styles */
.server-selection-container {
    padding: 12px;
    overflow-y: auto;
    flex: 1;
}

.selection-broker-title {
    font-size: 15px;
    color: var(--text-gray);
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
    margin-top: 0;
}

.server-item {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.server-name-lbl {
    font-weight: 500;
    font-size: 13px;
}

/* Login Form styles */
.broker-login-container {
    padding: 16px;
    flex: 1;
    overflow-y: auto;
}

.login-header-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 24px;
    background-color: var(--bg-secondary);
    padding: 12px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.login-broker-name {
    font-weight: 700;
    font-size: 14px;
    color: var(--text-white);
}

.login-server-name {
    font-size: 12px;
    color: var(--text-gray);
}

.mt5-login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group-mt5 {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group-mt5 label {
    font-size: 11px;
    color: var(--text-gray);
    text-transform: uppercase;
}

.form-group-mt5 input {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 10px 12px;
    color: var(--text-white);
    font-size: 14px;
}

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

.login-error-msg {
    color: var(--bear-red);
    font-size: 12px;
    background-color: rgba(255, 61, 0, 0.1);
    border: 1px solid rgba(255, 61, 0, 0.2);
    border-radius: 4px;
    padding: 8px 12px;
}

.mt5-login-submit-btn {
    background-color: var(--accent-blue);
    color: var(--text-white);
    padding: 12px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 14px;
    margin-top: 12px;
    text-align: center;
    cursor: pointer;
}

/* ==========================================================================
   Watermarked & Glowing Active Account Cards (Refined MT5 Compact Design)
   ========================================================================== */
.active-account-card {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    /* Reduced padding for compact size */
    border-radius: 6px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    width: 100%;
}

.active-account-card.real-card {
    background-color: #0c1510;
    border: 1px solid rgba(0, 230, 118, 0.3);
    border-left: 4px solid #00e676;
    box-shadow: 0 0 15px rgba(0, 230, 118, 0.12);
    /* Fainter watermark text to avoid distraction (opacity 0.04 - 0.06) */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240' viewBox='0 0 240 240'%3E%3Cstyle%3E.txt%7Bfont-family:sans-serif;font-weight:700;font-size:9px;fill:rgba(0,230,118,0.04);%7D.large%7Bfont-family:sans-serif;font-weight:900;font-size:16px;fill:rgba(0,230,118,0.06);%7D%3C/style%3E%3Cg transform='rotate(-20 120 120)'%3E%3Ctext x='-20' y='40' class='txt'%3EQUANTUM VERIFIED REAL ACCOUNT%3C/text%3E%3Ctext x='180' y='40' class='large'%3EREAL%3C/text%3E%3Ctext x='-60' y='100' class='large'%3EREAL%3C/text%3E%3Ctext x='30' y='100' class='txt'%3EQUANTUM VERIFIED REAL ACCOUNT%3C/text%3E%3Ctext x='-20' y='160' class='txt'%3EQUANTUM VERIFIED REAL ACCOUNT%3C/text%3E%3Ctext x='180' y='160' class='large'%3EREAL%3C/text%3E%3Ctext x='-60' y='220' class='large'%3EREAL%3C/text%3E%3Ctext x='30' y='220' class='txt'%3EQUANTUM VERIFIED REAL ACCOUNT%3C/text%3E%3C/g%3E%3C/svg%3E");
    background-repeat: repeat;
}

.active-account-card.demo-card {
    background-color: #17110a;
    border: 1px solid rgba(255, 152, 0, 0.3);
    border-left: 4px solid #ff9800;
    box-shadow: 0 0 15px rgba(255, 152, 0, 0.12);
    /* Fainter watermark text to avoid distraction (opacity 0.04 - 0.06) */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240' viewBox='0 0 240 240'%3E%3Cstyle%3E.txt%7Bfont-family:sans-serif;font-weight:700;font-size:9px;fill:rgba(255,152,0,0.04);%7D.large%7Bfont-family:sans-serif;font-weight:900;font-size:16px;fill:rgba(255,152,0,0.06);%7D%3C/style%3E%3Cg transform='rotate(-20 120 120)'%3E%3Ctext x='-20' y='40' class='txt'%3EQUANTUM VERIFIED DEMO ACCOUNT%3C/text%3E%3Ctext x='180' y='40' class='large'%3EDEMO%3C/text%3E%3Ctext x='-60' y='100' class='large'%3EDEMO%3C/text%3E%3Ctext x='30' y='100' class='txt'%3EQUANTUM VERIFIED DEMO ACCOUNT%3C/text%3E%3Ctext x='-20' y='160' class='txt'%3EQUANTUM VERIFIED DEMO ACCOUNT%3C/text%3E%3Ctext x='180' y='160' class='large'%3EDEMO%3C/text%3E%3Ctext x='-60' y='220' class='large'%3EDEMO%3C/text%3E%3Ctext x='30' y='220' class='txt'%3EQUANTUM VERIFIED DEMO ACCOUNT%3C/text%3E%3C/g%3E%3C/svg%3E");
    background-repeat: repeat;
}

.active-account-card .acc-info-left {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    /* Reduced vertical spacing */
    z-index: 2;
    width: 65%;
    /* Mobile layout split */
}

.active-account-card .acc-info-left .client-name {
    font-size: 18px;
    /* Compact name size (18-20px) */
    font-weight: 700;
    color: var(--text-white);
    letter-spacing: 0.3px;
    line-height: 1.25;
}

.active-account-card .acc-info-left .acc-number-broker {
    font-size: 13px;
    /* Compact ID + Broker size (13-14px) */
    font-weight: 500;
    color: var(--text-white);
    line-height: 1.25;
}

.active-account-card .acc-info-left .server-name {
    font-size: 12px;
    /* Compact server name size (12-13px) */
    color: #b0b3b8;
    line-height: 1.25;
}

.active-account-card .acc-info-left .manage-link {
    color: #409eff;
    font-size: 13px;
    /* Link size (13px) */
    font-weight: 500;
    text-decoration: none;
    margin-top: 2px;
    display: inline-block;
    line-height: 1.25;
    transition: color 0.2s;
}

.active-account-card .acc-info-left .manage-link:hover {
    color: #66b1ff;
    text-decoration: underline;
}

.active-account-card .badge-highlight-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    /* Tight gap */
    z-index: 2;
    width: 35%;
    /* Mobile layout split */
    text-align: center;
}

.active-account-card .badge-highlight-box {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 4px 10px;
    /* Reduced padding (by ~25% or more) */
    border-radius: 4px;
    font-weight: 700;
    font-size: 12px;
    /* Reduced badge size by 25% */
    letter-spacing: 0.5px;
    text-transform: uppercase;
    background-color: rgba(0, 0, 0, 0.35);
}

.active-account-card .badge-highlight-box i {
    font-size: 11px;
}

.active-account-card.real-card .badge-highlight-box {
    border: 1px solid #00e676;
    color: #00e676;
}

.active-account-card.demo-card .badge-highlight-box {
    border: 1px solid #ff9800;
    color: #ff9800;
}

.active-account-card .badge-highlight-subtitle {
    font-size: 8px;
    /* Extremely compact verified subtitle */
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    line-height: 1.1;
}

.active-account-card.real-card .badge-highlight-subtitle {
    color: #00e676;
}

.active-account-card.demo-card .badge-highlight-subtitle {
    color: #ff9800;
}

/* Responsive Overrides */
@media (min-width: 768px) {
    .active-account-card .acc-info-left {
        width: 70%;
        /* Desktop split */
    }

    .active-account-card .badge-highlight-container {
        width: 30%;
        /* Desktop split */
    }
}

.checkbox-wrapper-toggle input[type="checkbox"]:not(:disabled) {
    cursor: pointer;
}

/* ==========================================================================
   LIGHT THEME DESIGN SYSTEM (Variables & Selectors)
   ========================================================================== */
body.light-theme {
    --bg-primary: #F5F7FA;
    --bg-secondary: #FFFFFF;
    --bg-hover: #E2E8F0;
    --border-color: #DDE3EA;

    --accent-blue: #1976D2;
    --text-white: #1A1A1A;
    --text-gray: #6B7280;
    --text-muted: #9CA3AF;

    --bull-green: #00A651;
    --bear-red: #E53935;
    --bull-green-bg: rgba(0, 166, 81, 0.1);
    --bear-red-bg: rgba(229, 57, 53, 0.1);
}

/* Light Theme Component Overrides */
body.light-theme .account-header-bar {
    background-color: #EDF2F7;
}

body.light-theme .console-log {
    background-color: #F8FAFC;
    border: 1px solid var(--border-color);
}

body.light-theme .log-txt {
    color: #1A1A1A;
}

body.light-theme .watchlist-item.active {
    background-color: rgba(25, 118, 210, 0.06);
}

body.light-theme .no-positions-card h3,
body.light-theme .no-positions-card i {
    color: var(--text-gray);
}

/* LIGHT THEME: REAL & DEMO Card Identity Preserved */
body.light-theme .active-account-card.real-card {
    background-color: #E8F5E9;
    /* Light green base */
    border: 1px solid rgba(0, 166, 81, 0.25);
    border-left: 4px solid #00A651;
    box-shadow: 0 4px 12px rgba(0, 166, 81, 0.08);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240' viewBox='0 0 240 240'%3E%3Cstyle%3E.txt%7Bfont-family:sans-serif;font-weight:700;font-size:9px;fill:rgba(0,166,81,0.035);%7D.large%7Bfont-family:sans-serif;font-weight:900;font-size:16px;fill:rgba(0,166,81,0.05);%7D%3C/style%3E%3Cg transform='rotate(-20 120 120)'%3E%3Ctext x='-20' y='40' class='txt'%3EQUANTUM VERIFIED REAL ACCOUNT%3C/text%3E%3Ctext x='180' y='40' class='large'%3EREAL%3C/text%3E%3Ctext x='-60' y='100' class='large'%3EREAL%3C/text%3E%3Ctext x='30' y='100' class='txt'%3EQUANTUM VERIFIED REAL ACCOUNT%3C/text%3E%3Ctext x='-20' y='160' class='txt'%3EQUANTUM VERIFIED REAL ACCOUNT%3C/text%3E%3Ctext x='180' y='160' class='large'%3EREAL%3C/text%3E%3Ctext x='-60' y='220' class='large'%3EREAL%3C/text%3E%3Ctext x='30' y='220' class='txt'%3EQUANTUM VERIFIED REAL ACCOUNT%3C/text%3E%3C/g%3E%3C/svg%3E");
}

body.light-theme .active-account-card.demo-card {
    background-color: #FFF3E0;
    /* Light orange base */
    border: 1px solid rgba(255, 152, 0, 0.25);
    border-left: 4px solid #ff9800;
    box-shadow: 0 4px 12px rgba(255, 152, 0, 0.08);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240' viewBox='0 0 240 240'%3E%3Cstyle%3E.txt%7Bfont-family:sans-serif;font-weight:700;font-size:9px;fill:rgba(255,152,0,0.035);%7D.large%7Bfont-family:sans-serif;font-weight:900;font-size:16px;fill:rgba(255,152,0,0.05);%7D%3C/style%3E%3Cg transform='rotate(-20 120 120)'%3E%3Ctext x='-20' y='40' class='txt'%3EQUANTUM VERIFIED DEMO ACCOUNT%3C/text%3E%3Ctext x='180' y='40' class='large'%3EDEMO%3C/text%3E%3Ctext x='-60' y='100' class='large'%3EDEMO%3C/text%3E%3Ctext x='30' y='100' class='txt'%3EQUANTUM VERIFIED DEMO ACCOUNT%3C/text%3E%3Ctext x='-20' y='160' class='txt'%3EQUANTUM VERIFIED DEMO ACCOUNT%3C/text%3E%3Ctext x='180' y='160' class='large'%3EDEMO%3C/text%3E%3Ctext x='-60' y='220' class='large'%3EDEMO%3C/text%3E%3Ctext x='30' y='220' class='txt'%3EQUANTUM VERIFIED DEMO ACCOUNT%3C/text%3E%3C/g%3E%3C/svg%3E");
}

body.light-theme .active-account-card .acc-info-left .client-name {
    color: #1A1A1A;
}

body.light-theme .active-account-card .acc-info-left .acc-number-broker {
    color: #1A1A1A;
}

body.light-theme .active-account-card .acc-info-left .server-name {
    color: #555860;
}

body.light-theme .active-account-card .badge-highlight-box {
    background-color: rgba(255, 255, 255, 0.7);
}

body.light-theme .active-account-card.real-card .badge-highlight-box {
    border: 1px solid #00A651;
    color: #00A651;
}

body.light-theme .active-account-card.demo-card .badge-highlight-box {
    border: 1px solid #ff9800;
    color: #ff9800;
}

body.light-theme .active-account-card.real-card .badge-highlight-subtitle {
    color: #00A651;
}

body.light-theme .active-account-card.demo-card .badge-highlight-subtitle {
    color: #ff9800;
}

/* ==========================================================================
   MT5 Style Quick Order Bar Layout (Compact Refinement)
   ========================================================================== */
.quick-order-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    gap: 8px;
    margin-bottom: 8px;
}

.quick-order-bar .order-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 35px;
    /* Reduced height */
    border-radius: 4px;
    color: #ffffff;
    font-family: var(--font-sans);
    cursor: pointer;
    border: none;
    font-weight: 700;
    transition: filter 0.15s ease, opacity 0.15s ease;
    line-height: 1.1;
}

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

.quick-order-bar .order-btn:active {
    filter: brightness(0.9);
}

.quick-order-bar .order-btn.sell-btn {
    background-color: var(--bear-red);
}

.quick-order-bar .order-btn.buy-btn {
    background-color: var(--bull-green);
}

.quick-order-bar .order-type-lbl {
    font-size: 8px;
    /* Extremely compact type label */
    font-weight: 500;
    opacity: 0.85;
    text-transform: uppercase;
    letter-spacing: 0.2px;
}

.quick-order-bar .order-price-val {
    font-size: 12px;
    /* Price font set to 12px */
    font-weight: 700;
    font-family: var(--font-mono);
}

.quick-order-bar .lot-selector-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 80px;
    /* Max width 80px */
    height: 35px;
    /* Height 35px */
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.quick-order-bar .lot-step-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    /* Width 22px */
    height: 35px;
    /* Height 35px */
    font-size: 11px;
    /* Font size 11px */
    color: var(--text-white);
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.quick-order-bar .lot-step-btn:hover {
    background-color: var(--bg-hover);
}

.quick-order-bar .lot-value-input {
    flex: 1;
    width: 100%;
    height: 100%;
    background: none;
    border: none;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-white);
    outline: none;
    padding: 0;
}

/* Light theme overrides for quick order bar buttons if needed */
body.light-theme .quick-order-bar .order-btn {
    color: #ffffff;
    /* keep text white on colored buttons */
}

/* ==========================================================================
   MT5 Order Type Dropdown & Price Inputs
   ========================================================================== */
/* Pending Mode for Quick Order Bar */
.quick-order-bar.pending-mode .sell-btn,
.quick-order-bar.pending-mode .buy-btn {
    display: none;
}

.quick-order-bar.pending-mode .lot-selector-wrapper {
    width: 100%;
    max-width: 100%;
}

/* Order Type Selector and Dynamic Inputs */
.order-type-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    margin-top: 0px;
    margin-bottom: 8px;
}

.order-type-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    height: 35px;
}

.order-type-dropdown {
    flex: 1;
    height: 35px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-white);
    font-size: 13px;
    font-weight: 500;
    border-radius: 4px;
    padding: 0 12px;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath fill='%238e929a' d='M0 3h10L5 8z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: calc(100% - 12px) center;
    cursor: pointer;
}

body.light-theme .order-type-dropdown {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath fill='%236B7280' d='M0 3h10L5 8z'/%3E%3C/svg%3E");
}

.pending-input-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    height: 35px;
    margin-top: 8px;
}

.input-row-lbl {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-gray);
    width: 80px;
    text-align: left;
}

.numeric-input-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 1;
    height: 35px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}

.numeric-input-wrapper .step-btn {
    width: 32px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: var(--text-white);
    background: none;
    border: none;
    cursor: pointer;
    transition: background-color 0.15s;
}

.numeric-input-wrapper .step-btn:hover {
    background-color: var(--bg-hover);
}

.numeric-input-field {
    flex: 1;
    height: 100%;
    background: none;
    border: none;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 700;
    color: var(--text-white);
    -moz-appearance: textfield;
    appearance: textfield;
}

.numeric-input-field::-webkit-outer-spin-button,
.numeric-input-field::-webkit-inner-spin-button {
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
}

.pending-place-btn {
    width: 100%;
    height: 35px;
    background-color: var(--accent-blue);
    color: #ffffff;
    font-size: 13px;
    font-weight: 700;
    border-radius: 4px;
    border: none;
    margin-top: 12px;
    cursor: pointer;
    transition: filter 0.15s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

.pending-place-btn:active {
    filter: brightness(0.9);
}

/* ==========================================================================
   MT5 Trade Engine Phase-1 Style Additions (Positions, Swipe, Modals, Badges)
   ========================================================================== */

/* Market Closed styles */
.market-closed-badge {
    font-size: 8px;
    background-color: var(--bear-red);
    color: #ffffff;
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: 700;
    margin-left: 6px;
    vertical-align: middle;
    text-transform: uppercase;
    display: inline-block;
}

body.light-theme .market-closed-badge {
    background-color: var(--bear-red);
    color: #ffffff;
}

.quick-order-bar.disabled button.order-btn {
    opacity: 0.4 !important;
    pointer-events: none !important;
    cursor: not-allowed !important;
}

/* Positions Section Header */
.positions-section {
    display: flex;
    flex-direction: column;
    margin-bottom: 8px;
}

.section-header-row {
    font-size: 9px;
    font-weight: 700;
    color: var(--text-gray);
    background-color: var(--bg-secondary);
    padding: 4px 12px;
    text-transform: uppercase;
    border-bottom: 1px solid var(--border-color);
}

body.light-theme .section-header-row {
    background-color: #EDF2F7;
}

/* Position Rows & Swipe actions */
.position-row {
    position: relative;
    overflow: hidden;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--bg-primary);
    width: 100%;
}

.position-row-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background-color: var(--bg-primary);
    width: 100%;
    position: relative;
    z-index: 2;
    transition: transform 0.2s ease;
    cursor: pointer;
}

body.light-theme .position-row-content {
    background-color: #FFFFFF;
}

.position-row.swiped .position-row-content {
    transform: translateX(-70px);
}

.position-row-swipe-actions {
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    width: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bear-red);
    color: #ffffff;
    z-index: 1;
    cursor: pointer;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.pos-row-left {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

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

.pos-row-symbol {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-white);
}

.pos-row-meta {
    font-size: 10px;
    color: var(--text-gray);
    display: flex;
    gap: 4px;
}

.pos-row-meta .buy-badge {
    color: var(--bull-green);
    font-weight: 700;
}

.pos-row-meta .sell-badge {
    color: var(--bear-red);
    font-weight: 700;
}

.pos-row-meta .pending-badge {
    color: var(--text-gray);
    font-weight: 700;
}

.pos-row-price {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-gray);
}

.pos-row-price span {
    color: var(--text-white);
}

.pos-row-pl {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 700;
}

.pos-row-pl.positive {
    color: var(--bull-green);
}

.pos-row-pl.negative {
    color: var(--bear-red);
}

.pos-row-pl.neutral {
    color: var(--text-white);
}

/* Position Details Expanded view */
.position-row-details {
    display: none;
    background-color: var(--bg-hover);
    padding: 8px 12px;
    border-top: 1px solid var(--border-color);
    z-index: 2;
    position: relative;
    border-bottom: 1px solid var(--border-color);
}

body.light-theme .position-row-details {
    background-color: #F8FAFC;
}

.position-row.expanded .position-row-details {
    display: block;
}

.details-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

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

.details-lbl {
    font-size: 8px;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 700;
}

.details-val {
    font-family: var(--font-mono);
    color: var(--text-white);
    font-size: 11px;
    font-weight: 500;
}

/* MT5 Style Action Sheet (Bottom modal for long press) */
.action-sheet {
    position: fixed;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.action-sheet-backdrop {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.65);
    z-index: 1;
}

.action-sheet-content {
    background-color: var(--bg-secondary);
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
    padding: 16px;
    z-index: 2;
    animation: slideUp 0.15s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

.action-sheet-header {
    text-align: center;
    font-weight: 700;
    font-size: 13px;
    color: var(--text-white);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
    margin-bottom: 12px;
}

.action-sheet-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.action-sheet-item {
    width: 100%;
    padding: 12px;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    text-align: center;
    color: var(--text-white);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
}

body.light-theme .action-sheet-item {
    background-color: #F1F5F9;
}

.action-sheet-item:active {
    background-color: var(--bg-hover);
}

.action-sheet-item.danger {
    color: var(--bear-red);
    border-color: rgba(255, 61, 0, 0.15);
}

.action-sheet-item.cancel {
    background-color: var(--bg-hover);
    font-weight: 700;
    margin-top: 4px;
}

/* MT5 Style Modals */
.mt5-modal {
    position: fixed;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.65);
    padding: 16px;
}

.mt5-modal-content {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    width: 100%;
    max-width: 320px;
    overflow: hidden;
    animation: scaleUp 0.15s ease-out;
}

@keyframes scaleUp {
    from {
        transform: scale(0.92);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

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

.mt5-modal-header h3 {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-white);
}

.close-modal-btn {
    font-size: 20px;
    color: var(--text-gray);
    cursor: pointer;
}

.mt5-modal-body {
    padding: 16px;
}

.modal-info-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-white);
}

.form-group-modify {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group-modify label {
    font-size: 11px;
    color: var(--text-gray);
    text-transform: uppercase;
}

.mt5-modify-submit-btn {
    width: 100%;
    background-color: var(--accent-blue);
    color: #ffffff;
    padding: 10px;
    font-size: 13px;
    font-weight: 700;
    text-align: center;
    border-radius: 4px;
    margin-top: 16px;
    cursor: pointer;
    transition: filter 0.15s;
}

.mt5-modify-submit-btn:hover {
    filter: brightness(1.1);
}

/* ==========================================================================
   History Refinement & Filtering
   ========================================================================== */
#screen-history {
    height: 100% !important;
    overflow-y: hidden !important;
    /* Constrain main view height */
}

#screen-history.active {
    display: flex !important;
    flex-direction: column !important;
}

#screen-history .pane-header {
    flex-shrink: 0 !important;
}

.history-filter-btn {
    background: none;
    border: none;
    color: var(--text-gray);
    font-size: 16px;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 4px;
    transition: color 0.15s, background-color 0.15s;
    flex-shrink: 0;
}

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

.history-summary-card {
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 10px 12px;
    flex-shrink: 0 !important;
}

.history-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.summary-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.summary-stat .stat-lbl {
    font-size: 9px;
    font-weight: 500;
    color: var(--text-gray);
    text-transform: uppercase;
    margin-bottom: 3px;
}

.summary-stat .stat-val {
    font-size: 12px;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--text-white);
}

.summary-stat .stat-val.positive {
    color: var(--bull-green);
}

.summary-stat .stat-val.negative {
    color: var(--bear-red);
}

.history-container {
    flex: 1 !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    /* Enable scrolling for history records only */
    -webkit-overflow-scrolling: touch;
}

.history-item {
    padding: 8px 12px !important;
    /* Compact rows */
}

/* Date picker and modal styling */
.period-options-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.period-opt-btn {
    width: 100%;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-white);
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 500;
    text-align: left;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s;
}

.period-opt-btn:hover,
.period-opt-btn.active {
    background-color: var(--border-color);
    border-color: var(--accent-blue);
}

.date-input-field {
    width: 100%;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-white);
    padding: 10px;
    font-size: 13px;
    font-family: var(--font-mono);
    border-radius: 4px;
    outline: none;
    box-sizing: border-box;
}

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

/* Light theme overrides */
body.light-theme .history-summary-card {
    background-color: #ffffff;
}

body.light-theme .period-opt-btn {
    background-color: #ffffff;
    border-color: #e2e8f0;
    color: #1a202c;
}

body.light-theme .period-opt-btn:hover,
body.light-theme .period-opt-btn.active {
    background-color: #edf2f7;
    border-color: var(--accent-blue);
}

body.light-theme .date-input-field {
    background-color: #ffffff;
    border-color: #e2e8f0;
    color: #1a202c;
}

/* Global Layout Protection constraints */
.mt5-top-header {
    flex-shrink: 0 !important;
}

.account-header-bar {
    flex-shrink: 0 !important;
}

.bottom-nav {
    flex-shrink: 0 !important;
}

/* ==========================================================================
   Desktop Responsive Layout (Widescreen >= 992px)
   ========================================================================== */
@media (min-width: 992px) {

    /* 1. Main layout grid structure */
    .app-main-content {
        display: grid !important;
        grid-template-columns: 280px 1fr 340px !important;
        width: 100% !important;
    }

    /* 2. Side column overrides: always visible and functional */
    #screen-quotes {
        display: flex !important;
        border-right: 1px solid var(--border-color) !important;
        height: 100% !important;
    }

    #screen-trade {
        display: flex !important;
        border-left: 1px solid var(--border-color) !important;
        height: 100% !important;
    }

    /* 3. Center column content display behavior based on active tab class on container */

    /* Default views (Quotes, Charts, Trade tabs active): show Chart in center column, hide History/Settings */
    .tab-quotes #screen-chart,
    .tab-chart #screen-chart,
    .tab-trade #screen-chart {
        display: flex !important;
        height: 100% !important;
    }

    .tab-quotes #screen-history,
    .tab-quotes #screen-settings,
    .tab-chart #screen-history,
    .tab-chart #screen-settings,
    .tab-trade #screen-history,
    .tab-trade #screen-settings {
        display: none !important;
    }

    /* History tab active: show History in center column, hide Chart/Settings */
    .tab-history #screen-history {
        display: flex !important;
        height: 100% !important;
    }

    .tab-history #screen-chart,
    .tab-history #screen-settings {
        display: none !important;
    }

    /* Settings tab active: show Settings in center column, hide Chart/History */
    .tab-settings #screen-settings {
        display: flex !important;
        height: 100% !important;
    }

    .tab-settings #screen-chart,
    .tab-settings #screen-history {
        display: none !important;
    }

    /* 4. Sub-screens as centered popup modal dialogs */
    .sub-screen {
        max-width: 500px !important;
        max-height: 600px !important;
        margin: auto !important;
        left: 0 !important;
        right: 0 !important;
        top: 0 !important;
        bottom: 0 !important;
        border: 1px solid var(--border-color) !important;
        border-radius: 8px !important;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5) !important;
        height: fit-content !important;
        display: none;
    }

    .sub-screen.active {
        display: flex !important;
    }

    /* 5. Center-aligned, maximum width constraint for settings and history logs */
    .settings-container,
    .history-container,
    .history-summary-card {
        max-width: 800px !important;
        margin-left: auto !important;
        margin-right: auto !important;
        width: 100% !important;
    }

    /* Ensure summary card border looks correct when centered */
    .history-summary-card {
        border-left: 1px solid var(--border-color) !important;
        border-right: 1px solid var(--border-color) !important;
        border-bottom: 1px solid var(--border-color) !important;
        border-bottom-left-radius: 6px !important;
        border-bottom-right-radius: 6px !important;
    }

    /* 6. Convert bottom drawer action sheets into centered popup dialogs */
    .action-sheet {
        align-items: center !important;
        justify-content: center !important;
    }

    .action-sheet-content {
        width: 100% !important;
        max-width: 360px !important;
        border-radius: 8px !important;
        border: 1px solid var(--border-color) !important;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5) !important;
        animation: scaleUp 0.15s ease-out !important;
    }

    /* 7. Constrain width of active account badge details block */
    .active-account-card {
        max-width: 600px !important;
        margin: 0 auto !important;
    }

    /* 8. Constrain and center bottom navigation bar on desktop */
    .bottom-nav {
        width: 100% !important;
        max-width: 600px !important;
        margin: 0 auto !important;
        border-left: 1px solid var(--border-color) !important;
        border-right: 1px solid var(--border-color) !important;
        border-top-left-radius: 6px !important;
        border-top-right-radius: 6px !important;
    }
}

/* Floating P/L Bar Style */
.floating-pl-bar {
    height: 38px;
    background: linear-gradient(180deg, var(--bg-secondary), var(--bg-primary));
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px;
    font-size: 0.95rem;
    font-weight: 500;
}
.floating-pl-bar .pl-label {
    color: var(--text-gray);
    text-transform: uppercase;
    font-size: 0.70rem;
    letter-spacing: 0.5px;
}
.floating-pl-bar .pl-value {
    font-family: var(--font-mono);
    font-weight: 500;
    font-size: 0.80rem;
}
.floating-pl-bar .pl-value.positive {
    color: var(--bull-green);
}
.floating-pl-bar .pl-value.negative {
    color: var(--bear-red);
}