@media (max-width:720px),(orientation:landscape) and (max-height:600px) and (max-width:1100px) and (any-pointer:coarse){
 html dialog.pp-dialog,html dialog.pro-dialog{--pp-text:#f5f5f5;--pp-muted:#b3b3b3;background:#000!important;color:#f5f5f5!important;border-color:#333!important;scrollbar-color:#505050 #000}
 html dialog.pp-dialog :is(input:not([type=checkbox],[type=color],[type=range],[type=radio]),select,textarea){background:#101010!important;border-color:#414141!important;color:#fafafa!important}
 html dialog.pp-dialog .pp-title-icon{background:#181818;border-color:#363636;color:#eee}
 #proChartDialog.pro-dialog{box-sizing:border-box;width:min(100%,520px)!important;max-width:100%!important;margin-inline:auto!important;padding:20px max(16px,env(safe-area-inset-right)) calc(16px + env(safe-area-inset-bottom)) max(16px,env(safe-area-inset-left))!important;max-height:calc(var(--mr-view-height,100dvh) - 8px)!important;overflow:auto;overscroll-behavior:contain}
 #proChartDialog .pro-dialog-head{display:grid;grid-template-columns:minmax(0,1fr) 44px;align-items:center;gap:12px}
 #proChartDialog .pro-dialog-head>button{position:static;display:grid;place-items:center;width:44px;height:44px;min-height:44px;padding:0;border:1px solid #353535;background:#151515;border-radius:50%;color:white}
 #proChartDialog .pro-dialog-head>button svg{width:20px;height:20px}
 #proChartDialog .pro-dialog-head h2{font-size:22px!important;margin:4px 0;line-height:1.2;color:#fff}
 #proChartDialog :is(.pro-eyebrow,.muted,.pro-help){color:#b5b5b5}
 #proChartDialog>.muted,#proChartDialog .pro-help{font-size:13px;line-height:1.5;margin:12px 0}
 #proChartDialog #proIndicatorForm .pro-form-grid{display:grid;grid-template-columns:minmax(0,1fr)!important;gap:0}
 #proChartDialog .pro-form-grid label{display:flex;flex-flow:row nowrap;align-items:center;justify-content:space-between;gap:12px;margin:0;padding:8px 0;min-height:44px;border-bottom:1px solid #252525;font-size:14px;color:#ebebeb;box-sizing:border-box}
 #proChartDialog .pro-form-grid label.check{font-weight:600}
 #proChartDialog label.check input{order:1;margin:0;flex-shrink:0}
 #proChartDialog .pro-form-grid input[type=number]{width:84px;min-height:44px!important;height:44px;text-align:center;margin:0;font-variant-numeric:tabular-nums}
 #proChartDialog :is(.primary,.pro-shortcuts button){display:flex;align-items:center;justify-content:center;box-sizing:border-box;min-height:48px;width:100%;padding:8px 12px;text-align:center;line-height:1.3;border-radius:10px;white-space:normal}
 #proChartDialog #proIndicatorForm .primary{background:#fafafa!important;border:1px solid #fafafa!important;color:#101010!important;font-weight:650;box-shadow:none!important}
 #proChartDialog .pro-shortcuts{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,144px),1fr));gap:8px;margin-top:16px;padding-top:16px;border-top:1px solid #303030}
 #proChartDialog .pro-shortcuts button{background:#151515;color:#eee;border:1px solid #363636}
 #proChartDialog .pro-shortcuts button:last-child:nth-child(odd){grid-column:1/-1}
 #proChartDialog button:active{filter:brightness(.84)}
}

@media (max-width:720px), (pointer:coarse) and (orientation:landscape) and (max-height:600px) {
  html body dialog#profileDialog.pd-profile[open] {
    --paper:#000; --card:#101010; --edge:#303030; --ink:#f5f5f5;
    display:block!important; box-sizing:border-box!important; background:var(--paper)!important;
    color:var(--ink); width:min(100%,36rem)!important; min-width:0!important;
    height:auto!important; max-height:calc(100dvh - env(safe-area-inset-top) - 8px)!important;
    margin:auto auto 0!important; padding:0!important; overflow:auto!important;
    overscroll-behavior:contain; border:1px solid var(--edge)!important; border-radius:20px 20px 0 0!important;
  }
  html body #profileDialog.pd-profile :is(.rf-profile-head,.rf-profile-body,.rf-profile-actions) {
    position:static!important; background:var(--paper)!important; box-sizing:border-box;
    height:auto!important; max-height:none!important; min-height:0!important; overflow:visible!important;
    padding:16px!important; box-shadow:none!important;
  }
  html body #profileDialog.pd-profile .rf-profile-body {display:grid!important;gap:12px!important}
  html body #profileDialog.pd-profile :is(.pd-identity-card,.rf-session-info,.rf-profile-stats>div,.rf-profile-details,.rf-profile-row) {
    background:var(--card)!important;border-color:var(--edge)!important;min-width:0!important;box-shadow:none!important;
  }
  html body #profileDialog.pd-profile .pd-section-label {display:none!important}
  html body #profileDialog.pd-profile .rf-identity {display:grid!important;grid-template-columns:auto minmax(0,1fr)!important;align-items:center;gap:12px}
  html body #profileDialog.pd-profile .ws-edit-profile {grid-column:1/-1;justify-self:stretch;width:100%!important}
  html body #profileDialog.pd-profile .rf-profile-stats {display:grid!important;grid-template-columns:repeat(auto-fit,minmax(min(100%,128px),1fr))!important;gap:8px}
  html body #profileDialog.pd-profile .rf-profile-row {flex-wrap:wrap;overflow-wrap:anywhere}
  html body #profileDialog.pd-profile :is(.rf-profile-details,.rf-profile-row>div) {height:auto!important;max-height:none!important;overflow:visible!important}
  html body #profileDialog.pd-profile .rf-profile-actions {padding-bottom:max(16px,env(safe-area-inset-bottom))!important}
  html body #profileDialog.pd-profile :is(.ws-edit-profile,#closeProfile,.rf-profile-actions button,.rf-profile-actions a) {min-height:44px!important;display:inline-flex;align-items:center;justify-content:center}
  html body #profileDialog.pd-profile #closeProfile {min-width:44px;background:#171717!important}
}

/* Account surfaces: brand colour belongs to the mark and focus, not the canvas. */
html body #authScreen.auth-minimal.auth-detailed,
html body #authScreen.auth-minimal.auth-detailed :is(.auth-top,.auth-layout,.auth-card,.auth-bottom,.ad-brand-emblem,.auth-tabs,.auth-tabs button,.ap-country-button,.auth-password,input:not([type=checkbox]),.auth-guest,.auth-submit,.ap-language-button),
html body dialog#profileDialog.pd-profile,
html body dialog#profileDialog.pd-profile :is(.rf-profile-head,.rf-profile-body,.rf-profile-actions,.pd-identity-card,.rf-identity,.rf-session-info,.rf-profile-stats>div,.rf-profile-details,.rf-profile-row,.pd-stat-icon,#rfProfileAvatar,.ws-edit-profile,button,a,.demo-badge) {
  background:#000!important;box-shadow:none!important;border-color:#393939!important;
}
html body #authScreen.auth-minimal.auth-detailed .auth-card:before {display:none}
html body #authScreen.auth-minimal.auth-detailed :is(.auth-submit,.auth-tabs button[aria-selected=true]) {border:1px solid #aaa!important;color:white!important}
html body #authScreen.auth-minimal.auth-detailed :focus-visible,
html body dialog#profileDialog.pd-profile :focus-visible {outline:2px solid #91bfff!important;outline-offset:2px}
html body dialog#profileDialog.pd-profile #rfProfileAvatar:not(:has(img)) {font-size:0!important;background:#000 url("assets/ibroker-icon.svg") center/52% no-repeat!important}
html body dialog#profileDialog.pd-profile #rfProfileAvatar img {width:100%;height:100%;object-fit:cover;border-radius:inherit}
html body #authScreen.auth-minimal.auth-detailed .ma-top-actions {display:flex;align-items:center;gap:12px}
#profileDialog .sheet-photo-button {--account-symbol:url("assets/account-icons/camera-photo.svg")}
#profileDialog .ws-edit-profile {--account-symbol:url("assets/account-icons/document-edit.svg")}
#authScreen .ad-field-icon {--account-symbol:url("assets/account-icons/mail-unread.svg")}
#authScreen label:has(#registerName) .ad-field-icon {--account-symbol:url("assets/account-icons/avatar-default.svg")}
#authScreen .auth-password .ad-field-icon {--account-symbol:url("assets/account-icons/system-lock-screen.svg")}
#profileDialog :is(.sheet-photo-button,.ws-edit-profile) svg,#authScreen .ad-field-icon svg {display:none!important}
#profileDialog :is(.sheet-photo-button,.ws-edit-profile)::before,#authScreen .ad-field-icon::before {content:"";display:inline-block;width:16px;height:16px;flex:none;background:currentColor;-webkit-mask:var(--account-symbol) center/contain no-repeat;mask:var(--account-symbol) center/contain no-repeat}

@media (max-width:720px),(orientation:landscape) and (max-height:600px) and (max-width:1100px) and (any-pointer:coarse) {
  :is(#walletView,#copyView,#proChartDialog) {--surface-mobile:#000;--control-border:#383838;--text-mobile:#f5f5f5;color-scheme:dark}
  html body :is(#walletView,#copyView),
  html body :is(#walletView,#copyView) :is(.panel,.copy-toolbar,.trader-card,input,select),
  html body #proChartDialog.pro-dialog :is(input[type=number],.pro-shortcuts button) {
    background:var(--surface-mobile)!important;border-color:var(--control-border)!important;box-shadow:none!important;
  }
  html body :is(#walletView,#copyView) :is(input,select,button) {min-height:44px;max-width:100%}
  html body :is(#walletView,#copyView,#proChartDialog) :is(input:not([type=checkbox]),select) {font-size:16px!important;color:var(--text-mobile);box-sizing:border-box;min-width:0}
  html body :is(#walletView,#copyView,#proChartDialog) :focus-visible {outline:2px solid #91bfff;outline-offset:2px}
  html body #copyView .copy-toolbar {display:grid;grid-template-columns:minmax(0,1fr)!important;gap:16px;padding:16px}
  html body #copyView .copy-toolbar :is(label,.invite-search) {min-width:0}
  html body #copyView .copy-toolbar :is(input,select) {width:100%}
  html body #copyView .invite-search>div {display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px}
  html body #walletView .wallet-methods {gap:12px}
  html body #walletView .wallet-grid {gap:16px}
  html body #walletView :is(.wallet-grid,.wallet-methods)>* {min-width:0}
  html body #proChartDialog.pro-dialog {scroll-padding-block:20px;max-height:calc(var(--mr-view-height,100dvh) - 16px)!important}
  html.mr-keyboard body #proChartDialog.pro-dialog[open] {inset:auto 0 var(--mr-keyboard-inset) !important;margin:0 auto!important}
  html body #proChartDialog .pro-form-grid input[type=number] {appearance:textfield}
  #proChartDialog input[type=number]::-webkit-inner-spin-button {appearance:none}
}

#trade .mobile-market-row .chart-picker-source{display:none!important}
#trade .mobile-market-row .chart-picker-trigger{display:flex;align-items:center;justify-content:space-between;gap:6px;min-width:0;width:100%;min-height:44px;padding:0 8px;border:1px solid #363636;border-radius:10px;background:#000;color:#f5f5f5;font:600 13px system-ui}
.chart-picker-trigger::after{content:"";width:6px;height:6px;border-right:1.5px solid #aaa;border-bottom:1.5px solid #aaa;transform:rotate(45deg) translateY(-2px);flex:none}
dialog.chart-mobile-picker{box-sizing:border-box;position:fixed;inset:auto 0 0;margin:0 auto;width:min(100%,420px);max-width:100%;max-height:calc(100dvh - 12px);overflow:auto;background:#000;color:#f5f5f5;border:1px solid #383838;border-radius:20px 20px 0 0;padding:12px 16px max(16px,env(safe-area-inset-bottom));overscroll-behavior:contain}
.chart-mobile-picker::backdrop{background:#0009}
.chart-mobile-picker header{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px}
.chart-mobile-picker h2{font:650 18px system-ui;margin:0}
.chart-mobile-picker button{min-height:44px;background:#000;color:inherit;border:1px solid #363636;border-radius:10px;padding:0 12px;text-align:left}
.chart-mobile-picker header button{min-width:44px;text-align:center;font-size:22px}
.chart-picker-options{display:grid;gap:6px}
.chart-picker-options button[aria-pressed=true]{border-color:#8bbcff;color:#b9d7ff}
.chart-picker-options button[aria-pressed=true]::after{content:"✓";float:right}
.chart-mobile-picker button:focus-visible,.chart-picker-trigger:focus-visible{outline:2px solid #8bbcff;outline-offset:2px}

/* Center sheets inside the visible viewport in either phone orientation. */
@media (max-width:720px),(orientation:landscape) and (max-height:600px) and (max-width:1100px) {
  html body dialog[open]:not(#unused-modal-a):not(#unused-modal-b):not(#unused-modal-c),
  html body.mobile-assets-open #terminalApp #trade #watchlist {
    box-sizing:border-box!important;
    position:fixed!important;
    inset:calc(var(--modal-top,0px) + max(8px,env(safe-area-inset-top))) max(12px,env(safe-area-inset-right)) calc(var(--modal-bottom,0px) + max(8px,env(safe-area-inset-bottom))) max(12px,env(safe-area-inset-left))!important;
    margin:auto!important;
    transform:none!important;
    translate:none!important;
    width:min(30rem,calc(100% - max(12px,env(safe-area-inset-left)) - max(12px,env(safe-area-inset-right))))!important;
    height:max-content!important;
    min-width:0!important;min-height:0!important;
    max-height:calc(var(--modal-height,100dvh) - max(8px,env(safe-area-inset-top)) - max(8px,env(safe-area-inset-bottom)))!important;
    overflow:auto!important;overscroll-behavior:contain;
    background:#000!important;border:1px solid #383838!important;border-radius:16px!important;
    color-scheme:dark;
  }
  html body.mobile-assets-open #terminalApp #trade #watchlist {display:block!important}
  html body.mobile-assets-open #watchlist :is(input,.categories button,#assets>*) {background:#000!important;border-color:#383838;color:#eee}
  html body.mobile-assets-open #watchlist :is(.selected,[aria-selected=true]) {border-color:#419fff!important;color:#9ecbff}
  html body.mobile-assets-open #watchlist :is(#closeAssets,.categories button),#expiryPicker :is(button,.ep-close) {min-height:44px}
  html body.mobile-assets-open #watchlist #search {font-size:16px;min-height:44px}
  html body #expiryPicker.ep-dialog :is(.ep-preview,.ep-groups button:not([aria-pressed=true]),.ep-close) {background:#000!important;box-shadow:none!important;border-color:#383838}
}

@media (orientation:landscape) and (max-height:520px) and (max-width:1100px) {
  html body dialog#expiryPicker.ep-dialog[open] {
    display:grid;
    grid-template-columns:minmax(0,1fr) minmax(0,1fr);
    gap:12px 16px;
    width:min(42rem,calc(100% - max(16px,env(safe-area-inset-left)) - max(16px,env(safe-area-inset-right))))!important;
    padding:12px 16px!important;
  }
  #expiryPicker :is(.ep-head,.ep-groups) {grid-column:1/-1;margin:0}
  #expiryPicker .ep-head h2 {font-size:clamp(18px,3vw,22px);line-height:1.15}
  #expiryPicker .ep-head p {margin:4px 0 0}
  #expiryPicker .ep-groups {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px 16px}
  #expiryPicker .ep-group {margin:0;min-width:0}
  #expiryPicker .ep-grid {gap:6px}
  #expiryPicker .ep-grid button {padding:4px;min-height:44px;font-size:13px;gap:4px}
  #expiryPicker .ep-check svg {width:12px;height:12px}
  #expiryPicker .ep-preview {margin:0;padding:4px 10px;gap:8px;min-width:0}
  #expiryPicker .ep-preview>div {padding-left:8px}
  #expiryPicker .ep-preview small {margin:0}
  #expiryPicker .ep-confirm {min-height:44px}
}

/* Desktop authentication: editorial image and an independently sized form. */
@media (min-width:1000px) and (min-height:601px) {
 html body #authScreen.auth-minimal.auth-detailed .auth-layout {
   display:grid!important;grid-template-columns:minmax(0,1.25fr) minmax(420px,1fr);
   flex:none;width:min(calc(100% - 64px),1320px)!important;max-width:1320px!important;
   align-items:stretch;margin:auto!important;padding:0!important;overflow:hidden!important;
   border:1px solid #333!important;border-radius:22px!important;
 }
 html body #authScreen.auth-minimal.auth-detailed .auth-intro {
   display:flex!important;align-items:flex-end;position:relative;isolation:isolate;min-height:600px;overflow:hidden;
   padding:clamp(32px,4vw,64px);border-right:1px solid #333;
 }
 #authScreen .auth-editorial-image,#authScreen .auth-editorial-overlay {position:absolute;inset:0;width:100%;height:100%;z-index:-1}
 #authScreen .auth-editorial-image {object-fit:cover;object-position:50% 43%}
 #authScreen .auth-editorial-overlay {background:linear-gradient(180deg,#0001 15%,#0007 48%,#000 100%)}
 #authScreen .auth-editorial-copy {position:relative;max-width:28rem;color:#fff}
 #authScreen .auth-editorial-copy h1 {font-size:clamp(36px,4vw,60px);line-height:1.04;letter-spacing:-.045em;margin:16px 0}
 #authScreen .auth-editorial-copy p {font-size:16px;line-height:1.55;color:#ddd}
 html body #authScreen.auth-minimal.auth-detailed .auth-card {width:100%!important;max-width:480px!important;padding:32px 28px!important;margin:auto!important}
 html body #authScreen.auth-minimal.auth-detailed .auth-card :is(input:not([type=checkbox]),.ap-country-button,.auth-submit,.auth-guest) {min-height:46px}
 html body #authScreen.auth-minimal.auth-detailed .auth-submit {background:#1674ec!important;border-color:#1674ec!important;color:white!important}
 html body #authScreen.auth-minimal.auth-detailed .auth-submit:hover:not(:disabled) {background:#2466c7!important}
 html body #authScreen.auth-minimal.auth-detailed .auth-tabs button[aria-selected=true] {background:#181818!important}
 html body #authScreen.auth-minimal.auth-detailed .auth-top {margin-bottom:24px!important}
 html body #authScreen.auth-minimal.auth-detailed .auth-bottom {margin-top:24px!important}
}

@media (min-width:1000px) and (min-height:601px) {
 html body #authScreen.auth-minimal.auth-detailed .auth-card {
   border:0!important;border-radius:0!important;
   padding:clamp(24px,4vh,40px) clamp(24px,3vw,40px)!important;
 }
 #authScreen.auth-minimal.auth-detailed .auth-card .ad-brand-emblem {display:none}
 #authScreen.auth-minimal.auth-detailed #authTitle {
   font-size:clamp(28px,2.3vw,36px)!important;text-align:left;
 }
 #authScreen.auth-minimal.auth-detailed #authSubtitle {text-align:left;color:#b5b5b5}
 #authScreen.auth-minimal.auth-detailed .auth-card .auth-tabs {margin-bottom:20px!important}
 #authScreen.auth-minimal.auth-detailed .auth-editorial-copy h1 {text-wrap:balance}
 #authScreen.auth-minimal.auth-detailed .auth-editorial-copy small {color:#b5b5b5}
 html body #authScreen.auth-minimal.auth-detailed .auth-card :is(input,.ap-country-button) {font-size:15px}
}

/* History drawer: one gutter and one scroll region. */
html body #terminalApp .th-drawer {
 --history-gutter:16px;
 background:#000!important;border-color:#303030!important;
 box-sizing:border-box;height:auto;min-height:0;
}
html body #terminalApp .th-drawer :is(.th-head,.th-filters,.ws-history-filters,.th-empty,.th-full,.th-more,.th-detail) {
 background:#000;border-color:#303030;padding-inline:var(--history-gutter);
}
html body #terminalApp .th-drawer .th-head h2 {font-size:clamp(15px,1.2vw,18px);line-height:1.25;margin:0}
html body #terminalApp .th-drawer .th-head button {flex:0 0 32px}
html body #terminalApp .th-drawer .ws-history-filters {display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;padding-block:10px}
html body #terminalApp .th-drawer .ws-history-filters button {min-width:0;min-height:36px;padding-inline:4px}
html body #terminalApp .th-drawer :is(.ws-history-filters button:not(.selected),.th-filters select,.th-full,.th-more) {background:#000;border-color:#303030;color:#ddd}
html body #terminalApp .th-drawer .th-list {min-height:0;overflow:auto}
html body #terminalApp .th-drawer .th-empty {padding-block:20px;color:#b5b5b5;line-height:1.55}
@media (min-width:1000px) and (min-height:601px) {
 #terminalApp.room-trading {--history-width:clamp(256px,19vw,320px);--history-gap:8px}
 html body #terminalApp.room-trading .th-drawer {width:var(--history-width);bottom:31px}
 html body #terminalApp.room-trading #trade.history-drawer-open {
   margin-left:calc(var(--history-width) + var(--history-gap));
   width:calc(100% - var(--history-width) - var(--history-gap));
 }
}

/* Compact wallet, including landscape phones. */
@media (max-width:720px),(orientation:landscape) and (max-width:1100px) and (max-height:600px) {
 html body #terminalApp #walletView {
   --wallet-gap:12px;--wallet-border:#2d2d2d;
   background:#000!important;min-width:0;box-sizing:border-box;
   padding-inline:max(12px,env(safe-area-inset-left),env(safe-area-inset-right))!important;
 }
 html body #walletView .page-heading{margin:0 0 var(--wallet-gap)!important}
 html body #walletView .page-heading h1{font-size:23px;line-height:1.15;margin:0}
 html body #walletView :is(.stat-grid,.wallet-grid,.wallet-actionbar,.mobile-deposits,.wallet-methods,.pro-section){margin-block:0 var(--wallet-gap)!important}
 html body #walletView :is(.panel,.wallet-actionbar) {
   background:#000!important;border:1px solid var(--wallet-border)!important;
   border-radius:12px!important;padding:12px!important;min-width:0;box-shadow:none!important;
 }
 html body #walletView .stat-grid{gap:8px}
 html body #walletView :is(.stat>strong,#proWalletComposition strong){font-size:clamp(14px,4vw,19px);line-height:1.2;margin:4px 0 0;font-variant-numeric:tabular-nums;overflow-wrap:anywhere}
 html body #walletView :is(h2,.wallet-actionbar strong){font-size:15px;line-height:1.25;margin:0 0 6px}
 html body #walletView :is(.wallet-actionbar small,.demo-funds p,.pro-help,#balanceHint){font-size:12px;line-height:1.45}
 html body #walletView .wallet-actionbar>div:last-child{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
 html body #walletView #walletCredit{grid-column:1/-1}
 html body #walletView :is(.wallet-actionbar button,#walletAdd,#mobileWalletMore){min-height:44px;width:100%;margin:0;border-radius:8px}
 html body #walletView .wallet-methods {display:none!important}
 html body #walletView #proWalletComposition{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin:10px 0}
 html body #walletView #proWalletComposition>div{border:0;border-top:1px solid var(--wallet-border);padding:8px 0 0;min-width:0}
 html body #walletView .pro-help{margin:8px 0 0}
 html body #walletView .table-wrap{max-width:100%;overflow:auto}
 html body #walletView #balanceChart{height:clamp(120px,34vh,190px)!important;width:100%;max-width:100%}
}
@media (orientation:landscape) and (min-width:560px) and (max-width:1100px) and (max-height:600px) {
 html body #walletView .wallet-grid{display:grid!important;grid-template-columns:minmax(0,1.45fr) minmax(0,1fr);align-items:stretch}
 html body #walletView .wallet-actionbar>div:last-child{grid-template-columns:1.4fr 1fr 1fr}
 html body #walletView #walletCredit{grid-column:auto}
 html body #walletView .stat-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
 html body #walletView .stat-grid .stat:last-child{display:block}
}

html body #terminalApp #walletView:not([hidden]){
 --wd-gap:16px;--wd-line:#303030;
 display:grid!important;grid-template-columns:minmax(0,1.15fr) minmax(0,1fr);
 gap:var(--wd-gap);align-content:start;align-items:stretch;background:#000;
}
html body #walletView>:is(.page-heading,.stat-grid){grid-column:1/-1;margin:0!important}
html body #walletView>:is(.wallet-actionbar,.wallet-grid,.mobile-deposits,.wallet-methods,.withdrawal-history,.pro-section){display:none!important}
html body #walletView .stat-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
html body #walletView .stat-grid .stat:last-child{display:block}
html body #walletView .stat-grid .stat{padding:12px!important;min-width:0;background:#0b0b0b!important;border:1px solid var(--wd-line);border-radius:12px}
html body #walletView .stat>strong{display:block;font-size:clamp(13px,2.2vw,22px);font-variant-numeric:tabular-nums;overflow-wrap:anywhere}
html body #walletView :is(.wallet-deposit-redesign,.ledger){display:block!important;min-width:0;margin:0!important;padding:clamp(12px,2.2vw,24px)!important;border:1px solid var(--wd-line);border-radius:12px;background:#0b0b0b!important}
#walletView .wallet-deposit-redesign h2,#walletView .ledger h2{font-size:18px;margin:0 0 6px}
.wallet-deposit-redesign p,.wallet-deposit-redesign small{color:#b2b2b2;font-size:12px;line-height:1.45;margin:0}
.wallet-deposit-redesign fieldset{border:0;padding:0;margin:14px 0;min-width:0}
.wallet-deposit-redesign legend,.wd-amount{font-size:13px;font-weight:600;margin-bottom:6px;display:block}
.wd-methods{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
.wd-methods label{position:relative;display:flex;align-items:center;gap:6px;min-height:46px;padding:8px;border:1px solid var(--wd-line);border-radius:8px;font-size:clamp(11px,1.8vw,14px);cursor:pointer}
.wd-methods label:has(input:checked){border-color:#438fff;background:#101925}
.wd-methods label:has(input:focus-visible){outline:2px solid #91bfff;outline-offset:2px}
.wd-methods :is(svg,img){width:18px;height:18px;flex:none}
.wd-methods input{order:1;margin:0 0 0 auto;accent-color:#438fff;width:14px;height:14px;min-height:0!important;flex:none}
#walletDepositValue,.wd-continue{width:100%;box-sizing:border-box;min-height:44px;border-radius:8px}
#walletDepositValue{padding:8px 12px;border:1px solid var(--wd-line);background:#000;color:white;font-size:16px}
.wallet-deposit-redesign .wd-continue{margin:10px 0 6px;background:#17417a;color:#e5edff;opacity:1;cursor:not-allowed}
#walletView .ledger .table-wrap{overflow:auto}
@media(max-width:720px) {
 html body #terminalApp #walletView:not([hidden]){grid-template-columns:minmax(0,1fr);--wd-gap:12px}
 html body #walletView .stat-grid .stat{padding:8px!important}
}
@media(orientation:landscape) and (min-width:560px) and (max-width:1100px) and (max-height:600px){
 html body #terminalApp #walletView:not([hidden]){grid-template-columns:minmax(0,1fr) minmax(0,1fr);--wd-gap:10px}
 html body #walletView .page-heading{grid-column:1/-1}
 html body #walletView .stat-grid{grid-column:1;grid-row:2}
 html body #walletView .ledger{grid-column:1;grid-row:3}
 html body #walletView .wallet-deposit-redesign{grid-column:2;grid-row:2/span 2}
}

/* Keep document width stable while wide data stays reachable inside its table. */
html body #terminalApp {max-inline-size:100%;overflow-x:clip}
#terminalApp :is(.shell,.workspace,.chart-panel,.table-wrap) {min-inline-size:0;max-inline-size:100%}
#terminalApp :is(.table-wrap,.toolbar,.room-tabs,.draw-tools) {
 scrollbar-width:none;
}
#terminalApp :is(.table-wrap,.toolbar,.room-tabs,.draw-tools)::-webkit-scrollbar {display:none}
#terminalApp :is(.table-wrap,.toolbar):focus-visible {outline:2px solid #91bfff;outline-offset:-2px}
#terminalApp .page-heading h1 {letter-spacing:-.025em;line-height:1.15}
#terminalApp .page-heading .muted {line-height:1.5}
html body #terminalApp.room-trading #trade .draw-tools {box-shadow:none;backdrop-filter:none;background:#0d0e10!important}
html body #terminalApp #mobileBottomNav button.selected {
 background:#161616!important;box-shadow:none!important;
}

/* Profile: neutral surfaces, consistent spacing and distinct action roles. */
html body dialog#profileDialog.pd-profile[open] {
 --profile-line:#333;--profile-muted:#b5b5b5;
 padding:0!important;color:#f4f4f4;
}
html body dialog#profileDialog.pd-profile :is(.rf-profile-head,.rf-profile-body,.rf-profile-actions) {
 padding-inline:20px!important;
}
html body dialog#profileDialog.pd-profile .rf-profile-head {
 border-bottom:1px solid var(--profile-line);padding-block:12px!important;
}
#profileDialog.pd-profile .rf-profile-head h2 {
 font-size:clamp(20px,3vw,26px);line-height:1.15;letter-spacing:-.025em;
}
html body dialog#profileDialog.pd-profile .rf-profile-body {gap:12px!important}
html body dialog#profileDialog.pd-profile .rf-profile-stats>div {padding:12px!important}
#profileDialog.pd-profile :is(.rf-profile-stats small,.rf-session-info p,.rf-profile-row small) {
 color:var(--profile-muted);line-height:1.45;
}
#profileDialog.pd-profile .rf-profile-stats strong {
 font-variant-numeric:tabular-nums;font-size:clamp(14px,3.8vw,18px);overflow-wrap:anywhere;
}
#profileDialog.pd-profile .rf-profile-row>div {min-width:0;overflow-wrap:anywhere}
html body dialog#profileDialog.pd-profile :is(.ws-edit-profile,.rf-logout,#closeProfile) {
 min-height:44px!important;transition:background-color 160ms ease,border-color 160ms ease;
}
html body dialog#profileDialog.pd-profile .ws-edit-profile {color:#b9d6ff;border-color:#466690!important}
html body dialog#profileDialog.pd-profile .rf-logout {color:#ffb4b9;border-color:#684348!important}
html body dialog#profileDialog.pd-profile :is(.ws-edit-profile,.rf-logout,#closeProfile):hover {background:#171717!important}
html body dialog#profileDialog.pd-profile :is(.ws-edit-profile,.rf-logout,#closeProfile):active {background:#222!important}
@media (prefers-reduced-motion:reduce) {
 #profileDialog.pd-profile,#profileDialog.pd-profile button {transition:none!important;animation:none!important}
}
@media (orientation:landscape) and (max-height:600px) and (max-width:1100px) {
 html body dialog#profileDialog.pd-profile[open] {width:min(650px,calc(100% - 32px))!important}
 html body dialog#profileDialog.pd-profile .rf-profile-body {
   display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr));align-items:start;
 }
 #profileDialog.pd-profile .rf-profile-details {grid-column:2;grid-row:1/span 2}
}

#terminalApp .pw-bar select[hidden],dialog.pw-choice input[hidden]{display:none!important}
#terminalApp.phone-wide .pw-bar .pw-choice-trigger{white-space:nowrap;display:inline-flex;align-items:center;gap:8px;background:#101010}
.pw-choice-trigger::after{content:'';width:6px;height:6px;border:solid #aaa;border-width:0 1px 1px 0;transform:rotate(45deg);margin-top:-3px}
html body dialog.pw-choice[open]{padding:12px 16px!important;color:#f0f0f0;max-width:480px}
.pw-choice header{position:static;display:flex;align-items:center;justify-content:space-between;background:#000;padding:0;margin:0 0 8px;border:0;height:auto;gap:8px}
.pw-choice h2{font-size:18px;line-height:1.2;margin:0}
.pw-choice :is(button,input){min-height:44px;box-sizing:border-box;border:1px solid #393939;border-radius:8px;background:#101010;color:#eee}
.pw-choice header button{width:44px;font-size:22px}
.pw-choice input{width:100%;padding-inline:12px;font-size:16px;margin-bottom:8px}
.pw-choice-list{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px}
.pw-choice-list.pw-intervals{grid-template-columns:repeat(auto-fit,minmax(60px,1fr))}
.pw-choice-list button{display:flex;align-items:center;justify-content:center;gap:6px;padding:4px;font-size:13px}
.pw-choice-list button[aria-pressed=true]{border-color:#659eea;color:#bbd8ff;background:#111e30}
.pw-choice-list button[aria-pressed=true]::after{content:'✓'}
.pw-choice-list .market-icon{width:18px;height:18px}
.pw-choice :focus-visible{outline:2px solid #92bfff;outline-offset:2px}
.pw-choice::backdrop{background:#0009}

/* Landscape terminal: one outline per control, neutral black surfaces. */
html body #terminalApp.phone-wide.room-trading {--pw-neutral-edge:#383838;background:#000!important}
html body #terminalApp.phone-wide.room-trading :is(header,.pw-pair,.pw-bar>button,#mobileMenuButton,#dockMore),
html body #terminalApp.phone-wide.room-trading #trade :is(.ticket,.ticket .order,.amount,.amount input,.ep-trigger) {
 background:#000!important;border-color:var(--pw-neutral-edge)!important;box-shadow:none!important;
}
html body #terminalApp.phone-wide.room-trading .pw-pair {position:relative;padding:0;gap:0}
html body #terminalApp.phone-wide.room-trading .pw-pair>span {position:absolute;inset-inline-start:8px;pointer-events:none}
html body #terminalApp.phone-wide.room-trading .pw-pair .pw-choice-trigger {
 border:0!important;background:transparent!important;width:100%;height:100%;padding-inline:36px 10px;
}
@media(max-width:660px){
 html body #terminalApp.phone-wide.room-trading .pw-pair .pw-choice-trigger {padding-inline:10px}
}
html body #terminalApp.phone-wide.room-trading :is(.pw-choice-trigger,.pw-bar>button,#mobileMenuButton,.ep-trigger,#dockMore):hover {background-color:#141414!important}
html body #terminalApp.phone-wide.room-trading :is(.pw-choice-trigger,.pw-bar>button,#mobileMenuButton,.ep-trigger,#dockMore):focus-visible {outline:2px solid #aaa;outline-offset:2px}
html body #terminalApp.phone-wide.room-trading #trade .ep-trigger>svg {color:#b5b5b5}
html body #terminalApp.phone-wide.room-trading #trade .order::before {font-size:14px;line-height:20px}
html body dialog.pw-choice .pw-choice-list button[aria-pressed=true] {background:#151515;border-color:#8a8a8a;color:#fff}

html body dialog#mobileMenuDialog[open] {
 --mn-edge:#343434;
 width:min(560px,calc(100% - 32px))!important;
 padding:16px!important;background:#000!important;color:#eee;
}
#mobileMenuDialog .mn-heading {display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:12px}
#mobileMenuDialog .mn-heading h2{font-size:18px;line-height:1.2;margin:0;letter-spacing:-.02em}
#mobileMenuDialog .pp-title-icon{display:none!important}
html body #mobileMenuDialog #closeMobileMenu{position:static!important;inset:auto!important;flex:0 0 44px;height:44px;background:#000!important;color:#ddd;border:1px solid var(--mn-edge);border-radius:8px}
html body #mobileMenuDialog .mobile-menu-links{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
html body #mobileMenuDialog :is(.mobile-menu-links button,.mn-account){display:flex;align-items:center;justify-content:flex-start;gap:8px;min-height:44px;text-align:left;min-width:0;white-space:normal;padding:8px 12px;border:1px solid var(--mn-edge);border-radius:8px;background:#0d0d0d!important;color:#eee;font-size:13px;box-shadow:none!important}
#mobileMenuDialog .mobile-menu-links svg{width:16px;height:16px;color:#aaa}
html body #mobileMenuDialog .mn-account{justify-content:space-between;width:100%;margin-top:12px;background:#000!important}
#mobileMenuDialog .mn-account small{color:#b5b5b5}
html body #mobileMenuDialog button:hover{background:#1b1b1b!important}
#mobileMenuDialog button:focus-visible{outline:2px solid #aaa;outline-offset:2px}
@media(orientation:landscape) and (min-width:610px) and (max-height:600px){
 html body #mobileMenuDialog .mobile-menu-links{grid-template-columns:repeat(4,minmax(0,1fr))}
 html body dialog#mobileMenuDialog[open]{width:min(640px,calc(100% - 48px))!important}
}

html body dialog.pw-menu[open],html body dialog.pw-choice[open]:has(.pw-intervals){display:block!important;background:#000!important;width:min(400px,calc(100vw - 32px))!important;max-height:calc(100dvh - 24px)!important;overflow:auto;padding:16px!important;border:1px solid #393939;border-radius:16px;color:#eee;box-sizing:border-box}
.pw-menu .chart-head,html body .pw-choice:has(.pw-intervals) header{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:0 0 12px;padding:0 0 8px;border-bottom:1px solid #292929}
.pw-menu .chart-head h2,.pw-choice h2{margin:0;font:600 17px/1.25 system-ui;letter-spacing:-.025em;outline:none}
html body .pw-menu .chart-head button,html body .pw-choice header button{width:44px;height:44px;min-height:44px;padding:0;background:#000;color:#bbb;border:0;text-align:center;font-size:22px}
.chart-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
html body .pw-menu .chart-actions button{display:flex;gap:8px;align-items:center;padding:8px 12px;min-height:44px;background:#000;color:#eee;border:1px solid #383838;border-radius:8px;font:500 14px/1.3 system-ui}
.chart-actions svg{width:17px;height:17px;flex:none;color:#bbb}.chart-actions button:last-child{grid-column:1/-1;justify-content:center}
html body .pw-choice-list.pw-intervals{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:4px}
html body .pw-choice-list.pw-intervals button{background:#000;min-width:0;font-variant-numeric:tabular-nums}
html body .pw-choice-list.pw-intervals button[aria-pressed=true]{background:#e4e4e4!important;color:#111!important;border-color:#e4e4e4}
html body .pw-choice-list.pw-intervals button[aria-pressed=true]::after{content:none}
:is(.pw-menu,.pw-choice) button:focus-visible{outline:2px solid #ccc;outline-offset:1px}
@media(orientation:landscape) and (max-height:600px){html body #resultCards{width:min(312px,calc(100vw - 32px))!important}html body #resultCards .rn-card{background:#000!important;min-height:44px;padding:4px 8px;gap:8px}html body #resultCards .rn-icon{width:20px;height:20px;font-size:12px}html body #resultCards .rn-value{font-size:15px;font-variant-numeric:tabular-nums}html body #resultCards .rn-progress{height:1px}}

html body #terminalApp.phone-wide.room-trading.pw-expanded #trade:not([hidden]){grid-template-columns:minmax(0,1fr)!important}
html body #terminalApp.phone-wide.room-trading.pw-expanded #trade .ticket{display:none!important}
html body #terminalApp.phone-wide .pw-bar .pw-focus-toggle{width:auto!important;font-size:12px;padding:0 8px;white-space:normal;line-height:1.1;max-width:92px}
html body #terminalApp.room-trading #trade .ticket .returns{display:block!important}
html body #terminalApp.room-trading #trade .ticket .returns>div:first-child{display:none!important}
html body #terminalApp.room-trading #trade .ticket .returns>div+div{display:flex!important;align-items:center;justify-content:space-between;gap:4px;flex-wrap:wrap}
html body #terminalApp.room-trading #trade .ticket .returns small{font-size:12px}
html body #terminalApp.room-trading #trade .ticket .returns strong{font-size:16px}
#resultCards .rn-card .rn-detail{position:absolute;inset:0;border:0;border-radius:inherit;background:transparent!important;box-shadow:none;padding:0;cursor:pointer}
#resultCards .rn-close{position:relative;z-index:2}
.terminal-prefs{grid-column:1/-1;background:#000;color:#eee;border-block:1px solid #333;padding:0 12px}
.terminal-prefs summary{cursor:pointer;padding:14px 0;font-weight:600}.terminal-prefs label{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:44px}.terminal-prefs select{background:#000;color:#eee;padding:8px}.terminal-prefs small{display:block;color:#bbb;margin:8px 0}
