/* Shared controls are deliberately independent of legacy page-specific palettes. */
:root{--bfx-ui-surface:#fff;--bfx-ui-soft:#f1f5f9;--bfx-ui-ink:#17263a;--bfx-ui-muted:#52657b;--bfx-ui-line:#d7e1ec;--bfx-ui-accent:#a83e05;--bfx-ui-active:#fdebf0}
html[data-theme="dark"]{--bfx-ui-surface:#132034;--bfx-ui-soft:#1c2e44;--bfx-ui-ink:#edf3fa;--bfx-ui-muted:#b7c7da;--bfx-ui-line:#34485f;--bfx-ui-accent:#ffb17a;--bfx-ui-active:#382a22;color-scheme:dark}
.bfx-view-bar{box-sizing:border-box;display:flex;align-items:center;justify-content:flex-end;gap:9px;flex:0 0 auto;min-height:48px;padding:5px 12px;border-bottom:1px solid var(--bfx-ui-line);background:var(--bfx-ui-surface);color:var(--bfx-ui-ink);font:600 11px/1.3 system-ui,sans-serif}
.bfx-view-bar>span{margin-right:auto;color:var(--bfx-ui-muted)}
.bfx-view-bar>div{display:flex;gap:3px;padding:3px;border:1px solid var(--bfx-ui-line);border-radius:9px;background:var(--bfx-ui-soft)}
.bfx-view-bar a,.bfx-view-bar>button{box-sizing:border-box;display:inline-flex;align-items:center;justify-content:center;gap:6px;min-height:36px;padding:7px 11px;border:0;border-radius:6px;background:transparent;color:var(--bfx-ui-ink);font:inherit;text-decoration:none;white-space:nowrap;touch-action:manipulation;cursor:pointer}
.bfx-view-bar a[aria-current]{background:var(--bfx-ui-active);color:var(--bfx-ui-accent);box-shadow:inset 0 0 0 1px var(--bfx-ui-line)}
.bfx-view-bar :is(a,button):focus-visible{outline:2px solid var(--bfx-ui-accent);outline-offset:2px}
.bfx-view-bar>button{border:1px solid var(--bfx-ui-line);min-width:36px}
.reference-side-footer .bfx-view-bar{padding:6px 0;margin-bottom:10px;justify-content:center;flex-wrap:wrap;border:0;background:transparent}
.reference-side-footer .bfx-view-bar>span{flex:1 0 100%;text-align:left}
.mobile-app .bfx-view-bar{margin:-3px 0 14px;border:1px solid var(--bfx-ui-line);border-radius:12px;padding:5px 8px}
@media(max-width:600px){.bfx-view-bar{gap:5px;padding-inline:7px}.bfx-view-bar>span{display:none}.bfx-view-bar a{min-height:40px;padding-inline:10px}.bfx-view-bar>button{min-height:44px}.bfx-view-bar>div{margin-right:auto}.page-dashboard .bfx-view-theme-label{display:none}}

/* A desktop terminal must remain functional when selected on a touch phone.
   Hide resize handles with greater specificity than the legacy desktop rules;
   the old full-height handle was pushing the entire chart below the viewport. */
@media(max-width:900px){
 html[data-theme] .page-dashboard .trade-workspace.active{display:block!important;position:relative!important;min-height:0!important;overflow:hidden!important}
 html[data-theme] .page-dashboard .trade-workspace :is(.terminal-column-resizer,.terminal-row-resizer,.market-row-resizer){display:none!important}
 html[data-theme] .page-dashboard .trade-workspace :is(.market-column-stack,.main-column-stack){display:none!important;width:100%!important;height:100%!important;margin:0!important;min-height:0!important}
 html[data-theme] .page-dashboard .trade-workspace[data-mobile-view="markets"] .market-column-stack,
 html[data-theme] .page-dashboard .trade-workspace:is([data-mobile-view="chart"],[data-mobile-view="trades"]) .main-column-stack{display:flex!important;flex-direction:column!important}
 html[data-theme] .page-dashboard .trade-workspace :is(.market-list,.chart-panel,.positions-panel){display:none!important;flex:1 1 0%!important;min-height:0!important;margin:0!important}
 html[data-theme] .page-dashboard .trade-workspace[data-mobile-view="chart"] .chart-panel,
 html[data-theme] .page-dashboard .trade-workspace[data-mobile-view="markets"] .market-list,
 html[data-theme] .page-dashboard .trade-workspace[data-mobile-view="trades"] .positions-panel{display:flex!important}
 html[data-theme] .page-dashboard .trade-workspace .calendar-panel{display:none!important}
 html[data-theme] .page-dashboard .terminal-navigation-toggle{min-height:44px!important;height:44px!important}
 html[data-theme] .page-dashboard .savexa-sidebar nav :is(a,button){min-height:44px!important;height:44px!important}
 html[data-theme] .page-dashboard .savexa-sidebar-foot :is(a,button){min-height:40px!important;height:40px!important}
 .page-dashboard .premium-mobile-nav{min-height:44px;flex-basis:44px}.page-dashboard .premium-mobile-nav button{min-height:34px}
}
/* Keep the expand control and navigation reachable on short landscape phones. */
@media(max-height:520px){html[data-theme] .page-dashboard .savexa-sidebar-head .workspace-rail-brand,html[data-theme] .page-dashboard .savexa-sidebar-mode{display:none!important}html[data-theme] .page-dashboard .savexa-sidebar-foot .savexa-language-chip{display:none!important}.page-dashboard .terminal-top{max-height:145px!important;overflow:auto!important}.page-dashboard .bfx-view-bar{min-height:42px;padding-block:1px}.page-dashboard .bfx-view-bar :is(a,button){min-height:32px}}

/* Cover form and utility surfaces that previously retained hardcoded white. */
html[data-theme="dark"] .mobile-app{--surface:var(--bfx-ui-soft);--surface-2:var(--bfx-ui-soft)}
html[data-theme="dark"] .mobile-app :is(.more-group,.analytics-note,.mobile-new-account,.mobile-payment-detail,.mobile-trade-metrics){background:transparent;color:var(--bfx-ui-ink)}
html[data-theme="dark"] .mobile-app :is(.more-group>a>span,.more-group>button>span,.profile-mini-card>button,.app-sheet>section>header>button,.app-sheet>section>header>a,.quick-actions span,.mobile-new-account button,.account-sheet-row button){background:var(--bfx-ui-soft)!important;color:var(--bfx-ui-accent)!important;border-color:var(--bfx-ui-line)!important}
html[data-theme="dark"] .mobile-app :is(.app-sheet input:not([type=checkbox]):not([type=radio]),.app-sheet select,.app-sheet textarea,.mobile-new-account select,.mobile-withdraw-form input:not([type=radio]),.mobile-withdraw-form select,.mobile-withdraw-form textarea){background:var(--bfx-ui-soft)!important;color:var(--bfx-ui-ink)!important;border-color:var(--bfx-ui-line)!important;color-scheme:dark}
html[data-theme="dark"] .mobile-app :is(input,textarea)::placeholder{color:var(--bfx-ui-muted);opacity:1}
html[data-theme="dark"] .mobile-app :is(.analytics-note,.mobile-payment-option,.mobile-support-card){background:var(--bfx-ui-surface)!important;border-color:var(--bfx-ui-line)!important;color:var(--bfx-ui-ink)!important}
html[data-theme="dark"] .mobile-app .quick-actions span{background:var(--bfx-ui-active)!important}
html[data-theme="dark"] .mobile-app :is(.mobile-trade-metrics small,.more-group h2,.mobile-documents-form input[type=file]){color:var(--bfx-ui-muted)!important;opacity:1}
html[data-theme="dark"] .page-dashboard :is(.savexa-profile-modal,.savexa-payment-modal,.savexa-accounts-modal,.savexa-statement-modal) :is(input:not([type=checkbox]):not([type=radio]),select,textarea){background:var(--bfx-ui-soft)!important;color:var(--bfx-ui-ink)!important;border-color:var(--bfx-ui-line)!important;color-scheme:dark}
html[data-theme="dark"] :is(.page-home,.page-info) :is(.bfx-date-filter input,.bfx-tool-card input,.bfx-tool-card select,.bfx-tool-card textarea){background:var(--bfx-ui-soft)!important;color:var(--bfx-ui-ink)!important;border-color:var(--bfx-ui-line)!important;color-scheme:dark}

.terminal-navigation-backdrop{position:fixed;inset:0;z-index:44;border:0;border-radius:0;background:#07111f66;touch-action:manipulation;cursor:pointer}.terminal-navigation-backdrop[hidden]{display:none!important}
html[data-theme="dark"] :is(.page-home,.page-info) .landing-nav-close{background:var(--bfx-ui-soft)!important;color:var(--bfx-ui-ink)!important;border:1px solid var(--bfx-ui-line)!important}
html[data-theme="dark"] .mobile-app .profile-mini-card>a{background:var(--bfx-ui-soft)!important;color:var(--bfx-ui-accent)!important}
@media(max-width:900px){
 html[data-theme] .page-dashboard .chart-panel>.chart-engine-switch{position:static!important;inset:auto!important;align-self:flex-start!important;flex:0 0 auto!important;max-width:calc(100% - 12px)!important;margin:6px!important;order:0!important;transform:none!important}
 html[data-theme] .page-dashboard .chart-panel>.chart-engine-switch button{min-height:34px!important;font-size:10px!important;padding:6px 10px!important}
 html[data-theme] .page-dashboard .chart-panel:not([data-chart-engine="tradingview-advanced"]) .chart-head{position:relative!important;display:grid!important;grid-template-columns:auto minmax(0,1fr)!important;gap:5px!important;flex:0 0 auto!important;height:auto!important;min-height:0!important;max-height:none!important;padding:5px 7px!important;overflow:visible!important;order:1!important}
 html[data-theme] .page-dashboard .chart-head .chart-symbol{grid-column:1/-1!important;min-width:0!important}
 html[data-theme] .page-dashboard .chart-head :is(.chart-source-badge,.chart-gesture,#chartHigh,#chartLow){display:none!important}
 html[data-theme] .page-dashboard .chart-head :is(.timeframes,.indicator-control,.chart-actions){position:relative!important;inset:auto!important;transform:none!important;margin:0!important;height:auto!important;min-height:0!important;align-self:center!important}
 html[data-theme] .page-dashboard .chart-head .timeframes{grid-column:1!important}
 html[data-theme] .page-dashboard .chart-head .indicator-control{grid-column:2!important;justify-self:start!important}
 html[data-theme] .page-dashboard .chart-head .timeframe-picker{width:auto!important;min-width:0!important}
 html[data-theme] .page-dashboard .chart-head :is(.timeframe-picker>summary,.indicator-toggle){height:32px!important;min-height:32px!important;padding:6px 9px!important;min-width:0!important}
 html[data-theme] .page-dashboard .chart-head .chart-actions{grid-column:1/-1!important;display:flex!important;gap:5px!important}
 html[data-theme] .page-dashboard .chart-head .chart-actions button{min-width:32px!important;height:28px!important;min-height:28px!important;padding:3px!important}
 html[data-theme] .page-dashboard .chart-stage{order:2!important;min-height:0!important;flex:1 1 0%!important}
 html[data-theme] .page-dashboard .chart-unit-note{order:1!important}
}
/* Public inner pages share the same drawer behavior as Home. */
html body:is(.page-home,.page-info) .landing-nav-backdrop{display:none;position:fixed;inset:0;width:100%;height:100dvh;margin:0;padding:0;border:0;border-radius:0;background:#09142273;backdrop-filter:blur(3px);z-index:94;touch-action:manipulation}
html body:is(.page-home,.page-info) .landing-nav-backdrop[hidden]{display:none!important;pointer-events:none!important}
@media(max-width:980px){html body:is(.page-home,.page-info) .landing-nav-backdrop:not([hidden]){display:block!important}html body:is(.page-home,.page-info).landing-drawer-open{overflow:hidden}html body:is(.page-home,.page-info) .reference-side-nav{max-height:100dvh!important}html body:is(.page-home,.page-info) .reference-side-scroll{min-height:0;overflow-y:auto;overscroll-behavior:contain}}
/* Chart controls have local z-indexes; none may cover the expanded navigation. */
html[data-theme] .page-dashboard .terminal{isolation:isolate;position:relative!important;z-index:0}
@media(min-width:901px){
 html[data-theme] .page-dashboard .chart-panel>.chart-engine-switch{position:static!important;inset:auto!important;align-self:flex-end!important;flex:0 0 auto!important;max-width:calc(100% - 12px)!important;margin:6px!important;transform:none!important}
}
