*, ::before, ::after {
    box-sizing: border-box !important;
    -webkit-tap-highlight-color: transparent !important;
    user-select: none !important;
    -webkit-user-select: none !important;
}
input, textarea, [contenteditable="true"] {
    user-select: text !important;
    -webkit-user-select: text !important;
}
html, body {
    width: 100% !important;
    height: 100% !important;
    max-height: 100vh !important;
    max-height: 100dvh !important;
    overflow: hidden !important;
    overscroll-behavior: none !important;
    touch-action: manipulation;
    margin: 0;
    padding: 0;
}
body { background-color: #0b0e11; color: #eaecef; font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }

.safe-area-top {
    padding-top: env(safe-area-inset-top, 0px) !important;
}
.safe-area-bottom {
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 4px) !important;
}
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

/* Range Slider Styling */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
    background: #2b3139;
    height: 6px;
    border-radius: 3px;
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    margin-top: -5px;
    background-color: #fcd535;
    height: 16px;
    width: 16px;
    border-radius: 50%;
    border: 2px solid #181a20;
    box-shadow: 0 0 6px rgba(252, 213, 53, 0.4);
}

.panel { background-color: #181a20; border: 1px solid #2b3139; }
.btn-green { background-color: #0ecb81; color: white; }
.btn-green:hover { background-color: #0ba86b; }
.btn-red { background-color: #f6465d; color: white; }
.btn-red:hover { background-color: #d9394e; }
input[type="number"]::-webkit-inner-spin-button, input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.flash-row { animation: flash 0.2s ease-out; }
@keyframes flash { 0% { background-color: rgba(255,255,255,0.15); } 100% { background-color: transparent; } }
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2b3139; border-radius: 2px; }

.depth-ask-bg { background-size: 100% 100%; transition: background-size 0.2s ease; }
.depth-bid-bg { background-size: 100% 100%; transition: background-size 0.2s ease; }

/* THEME: Neon Japan (Неоновая Япония) */
body.theme-neon-japan {
    background-color: #0c0714 !important;
    color: #f8f0ff !important;
}
body.theme-neon-japan .panel,
body.theme-neon-japan nav,
body.theme-neon-japan div[class*="bg-[#181a20]"] {
    background-color: #160d24 !important;
    border-color: rgba(255, 59, 148, 0.3) !important;
    box-shadow: 0 0 15px rgba(255, 59, 148, 0.08) !important;
}
body.theme-neon-japan div[class*="bg-[#0b0e11]"],
body.theme-neon-japan div[class*="bg-[#14161c]"] {
    background-color: #0d0617 !important;
    border-color: rgba(0, 242, 254, 0.25) !important;
}
body.theme-neon-japan .text-\[#fcd535\],
body.theme-neon-japan .text-yellow-500,
body.theme-neon-japan .text-yellow-400 {
    color: #ff3b94 !important;
}
body.theme-neon-japan .text-cyan-400,
body.theme-neon-japan .text-cyan-300 {
    color: #00f2fe !important;
}
body.theme-neon-japan .btn-green {
    background-color: #ff3b94 !important;
    color: white !important;
    box-shadow: 0 0 12px rgba(255, 59, 148, 0.4) !important;
}
body.theme-neon-japan .btn-red {
    background-color: #00f2fe !important;
    color: black !important;
    font-weight: bold !important;
    box-shadow: 0 0 12px rgba(0, 242, 254, 0.4) !important;
}

/* THEME: Cyberpunk 2077 */
body.theme-cyberpunk {
    background-color: #0c0c14 !important;
    color: #fce8ff !important;
}
body.theme-cyberpunk .panel,
body.theme-cyberpunk nav,
body.theme-cyberpunk div[class*="bg-[#181a20]"] {
    background-color: #151324 !important;
    border-color: rgba(252, 238, 10, 0.35) !important;
    box-shadow: 0 0 15px rgba(252, 238, 10, 0.1) !important;
}
body.theme-cyberpunk div[class*="bg-[#0b0e11]"],
body.theme-cyberpunk div[class*="bg-[#14161c]"] {
    background-color: #0d0b17 !important;
    border-color: rgba(162, 89, 255, 0.3) !important;
}
body.theme-cyberpunk .text-\[#fcd535\],
body.theme-cyberpunk .text-yellow-500,
body.theme-cyberpunk .text-yellow-400 {
    color: #fcee0a !important;
}
body.theme-cyberpunk .btn-green {
    background-color: #fcee0a !important;
    color: black !important;
    font-weight: bold !important;
    box-shadow: 0 0 12px rgba(252, 238, 10, 0.4) !important;
}
body.theme-cyberpunk .btn-red {
    background-color: #ff0055 !important;
    color: white !important;
    font-weight: bold !important;
    box-shadow: 0 0 12px rgba(255, 0, 85, 0.4) !important;
}

/* THEME: Emerald Matrix */
body.theme-emerald-matrix {
    background-color: #05100c !important;
    color: #e2ffed !important;
}
body.theme-emerald-matrix .panel,
body.theme-emerald-matrix nav,
body.theme-emerald-matrix div[class*="bg-[#181a20]"] {
    background-color: #0b1a15 !important;
    border-color: rgba(0, 255, 135, 0.3) !important;
    box-shadow: 0 0 15px rgba(0, 255, 135, 0.08) !important;
}
body.theme-emerald-matrix div[class*="bg-[#0b0e11]"],
body.theme-emerald-matrix div[class*="bg-[#14161c]"] {
    background-color: #040c09 !important;
    border-color: rgba(0, 229, 255, 0.25) !important;
}
body.theme-emerald-matrix .text-\[#fcd535\],
body.theme-emerald-matrix .text-yellow-500,
body.theme-emerald-matrix .text-yellow-400 {
    color: #00ff87 !important;
}
body.theme-emerald-matrix .btn-green {
    background-color: #00ff87 !important;
    color: black !important;
    font-weight: bold !important;
    box-shadow: 0 0 12px rgba(0, 255, 135, 0.4) !important;
}
body.theme-emerald-matrix .btn-red {
    background-color: #ff3366 !important;
    color: white !important;
    box-shadow: 0 0 12px rgba(255, 51, 102, 0.4) !important;
}

/* THEME: Nordic Ice */
body.theme-nordic-ice {
    background-color: #080f1e !important;
    color: #e6f6ff !important;
}
body.theme-nordic-ice .panel,
body.theme-nordic-ice nav,
body.theme-nordic-ice div[class*="bg-[#181a20]"] {
    background-color: #101b33 !important;
    border-color: rgba(76, 201, 240, 0.3) !important;
    box-shadow: 0 0 15px rgba(76, 201, 240, 0.08) !important;
}
body.theme-nordic-ice div[class*="bg-[#0b0e11]"],
body.theme-nordic-ice div[class*="bg-[#14161c]"] {
    background-color: #060b17 !important;
    border-color: rgba(114, 9, 183, 0.3) !important;
}
body.theme-nordic-ice .text-\[#fcd535\],
body.theme-nordic-ice .text-yellow-500,
body.theme-nordic-ice .text-yellow-400 {
    color: #4cc9f0 !important;
}
body.theme-nordic-ice .btn-green {
    background-color: #4cc9f0 !important;
    color: black !important;
    font-weight: bold !important;
    box-shadow: 0 0 12px rgba(76, 201, 240, 0.4) !important;
}
body.theme-nordic-ice .btn-red {
    background-color: #f72585 !important;
    color: white !important;
    box-shadow: 0 0 12px rgba(247, 37, 133, 0.4) !important;
}

/* Стиль выпадающего списка активов для устранения белого экрана */
#asset-selector {
    background-color: #181a20 !important;
    color: #ffffff !important;
}
#asset-selector optgroup {
    background-color: #0b0e11 !important;
    color: #fcd535 !important;
    font-weight: bold;
    font-style: normal;
}
#asset-selector option {
    background-color: #181a20 !important;
    color: #eaecef !important;
    padding: 8px 12px;
}

/* ── DYNAMIC THEME ADAPTATION FOR ALL ACTION BUTTONS & MODALS ── */

/* Cyberpunk 2077 Theme */
body.theme-cyberpunk #header-quick-deposit-btn,
body.theme-cyberpunk #btn-execute-swap {
    background: linear-gradient(to right, #fcee0a, #ff0055) !important;
    color: #000000 !important;
    box-shadow: 0 0 15px rgba(252, 238, 10, 0.4) !important;
}
body.theme-cyberpunk #col4-swap-btn,
body.theme-cyberpunk #open-swap-btn {
    background: rgba(252, 238, 10, 0.15) !important;
    color: #fcee0a !important;
    border-color: rgba(252, 238, 10, 0.4) !important;
}

/* Emerald Matrix Theme */
body.theme-emerald-matrix #header-quick-deposit-btn,
body.theme-emerald-matrix #btn-execute-swap {
    background: linear-gradient(to right, #00ff87, #60efff) !important;
    color: #000000 !important;
    box-shadow: 0 0 15px rgba(0, 255, 135, 0.4) !important;
}
body.theme-emerald-matrix #col4-swap-btn,
body.theme-emerald-matrix #open-swap-btn {
    background: rgba(0, 255, 135, 0.15) !important;
    color: #00ff87 !important;
    border-color: rgba(0, 255, 135, 0.4) !important;
}

/* Nordic Ice Theme */
body.theme-nordic-ice #header-quick-deposit-btn,
body.theme-nordic-ice #btn-execute-swap {
    background: linear-gradient(to right, #4cc9f0, #7209b7) !important;
    color: #ffffff !important;
    box-shadow: 0 0 15px rgba(76, 201, 240, 0.4) !important;
}
body.theme-nordic-ice #col4-swap-btn,
body.theme-nordic-ice #open-swap-btn {
    background: rgba(76, 201, 240, 0.15) !important;
    color: #4cc9f0 !important;
    border-color: rgba(76, 201, 240, 0.4) !important;
}

/* Tokyo Neon Theme */
body.theme-neon-japan #header-quick-deposit-btn,
body.theme-neon-japan #btn-execute-swap {
    background: linear-gradient(to right, #ff3b94, #00f2fe) !important;
    color: #ffffff !important;
    box-shadow: 0 0 15px rgba(255, 59, 148, 0.4) !important;
}
body.theme-neon-japan #col4-swap-btn,
body.theme-neon-japan #open-swap-btn {
    background: rgba(255, 59, 148, 0.15) !important;
    color: #ff3b94 !important;
    border-color: rgba(255, 59, 148, 0.4) !important;
}

/* THEME: Spring (Fresh Mint & Sakura Blossom - Not Violet!) */
body.theme-spring {
    background-color: #08140e !important;
    color: #e2fbe8 !important;
}
body.theme-spring .panel,
body.theme-spring nav,
body.theme-spring div[class*="bg-[#181a20]"] {
    background-color: #0f2219 !important;
    border-color: rgba(52, 211, 153, 0.25) !important;
    box-shadow: 0 0 15px rgba(52, 211, 153, 0.08) !important;
}
body.theme-spring div[class*="bg-[#0b0e11]"],
body.theme-spring div[class*="bg-[#14161c]"] {
    background-color: #060e0a !important;
    border-color: rgba(244, 114, 182, 0.25) !important;
}
body.theme-spring .text-\[#fcd535\],
body.theme-spring .text-yellow-500,
body.theme-spring .text-yellow-400 {
    color: #34d399 !important;
}
body.theme-spring #header-quick-deposit-btn,
body.theme-spring #btn-execute-swap {
    background: linear-gradient(to right, #34d399, #f472b6) !important;
    color: #000000 !important;
    box-shadow: 0 0 15px rgba(52, 211, 153, 0.4) !important;
}
body.theme-spring #col4-swap-btn,
body.theme-spring #open-swap-btn {
    background: rgba(52, 211, 153, 0.15) !important;
    color: #34d399 !important;
    border-color: rgba(52, 211, 153, 0.4) !important;
}
body.theme-spring #chart-parent-container,
body.theme-spring [class*="bg-[#131722]"] {
    background-color: #08140e !important;
}

/* THEME: Summer (Solar Gold & Tropical Lagoon) */
body.theme-summer {
    background-color: #041417 !important;
    color: #fef3c7 !important;
}
body.theme-summer .panel,
body.theme-summer nav,
body.theme-summer div[class*="bg-[#181a20]"] {
    background-color: #082026 !important;
    border-color: rgba(245, 158, 11, 0.28) !important;
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.08) !important;
}
body.theme-summer div[class*="bg-[#0b0e11]"],
body.theme-summer div[class*="bg-[#14161c]"] {
    background-color: #030d10 !important;
    border-color: rgba(20, 184, 166, 0.25) !important;
}
body.theme-summer .text-\[#fcd535\],
body.theme-summer .text-yellow-500,
body.theme-summer .text-yellow-400 {
    color: #fbbf24 !important;
}
body.theme-summer #header-quick-deposit-btn,
body.theme-summer #btn-execute-swap {
    background: linear-gradient(to right, #f59e0b, #14b8a6) !important;
    color: #000000 !important;
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.4) !important;
}
body.theme-summer #col4-swap-btn,
body.theme-summer #open-swap-btn {
    background: rgba(245, 158, 11, 0.15) !important;
    color: #fbbf24 !important;
    border-color: rgba(245, 158, 11, 0.4) !important;
}
body.theme-summer #chart-parent-container,
body.theme-summer [class*="bg-[#131722]"] {
    background-color: #041417 !important;
}

/* THEME: Autumn (Warm Amber Fall) */
body.theme-autumn {
    background-color: #140c06 !important;
    color: #fed7aa !important;
}
body.theme-autumn .panel,
body.theme-autumn nav,
body.theme-autumn div[class*="bg-[#181a20]"] {
    background-color: #1f140b !important;
    border-color: rgba(249, 115, 22, 0.25) !important;
    box-shadow: 0 0 15px rgba(249, 115, 22, 0.08) !important;
}
body.theme-autumn div[class*="bg-[#0b0e11]"],
body.theme-autumn div[class*="bg-[#14161c]"] {
    background-color: #0c0703 !important;
    border-color: rgba(249, 115, 22, 0.2) !important;
}
body.theme-autumn .text-\[#fcd535\],
body.theme-autumn .text-yellow-500,
body.theme-autumn .text-yellow-400 {
    color: #f97316 !important;
}
body.theme-autumn #header-quick-deposit-btn,
body.theme-autumn #btn-execute-swap {
    background: linear-gradient(to right, #f97316, #d97706) !important;
    color: #000000 !important;
    box-shadow: 0 0 15px rgba(249, 115, 22, 0.4) !important;
}
body.theme-autumn #col4-swap-btn,
body.theme-autumn #open-swap-btn {
    background: rgba(249, 115, 22, 0.15) !important;
    color: #fb923c !important;
    border-color: rgba(249, 115, 22, 0.4) !important;
}
body.theme-autumn #chart-parent-container,
body.theme-autumn [class*="bg-[#131722]"] {
    background-color: #140c06 !important;
}

/* THEME: Winter (Frost Glacier Blizzard) */
body.theme-winter {
    background-color: #060b16 !important;
    color: #e0f2fe !important;
}
body.theme-winter .panel,
body.theme-winter nav,
body.theme-winter div[class*="bg-[#181a20]"] {
    background-color: #0c1527 !important;
    border-color: rgba(56, 189, 248, 0.25) !important;
    box-shadow: 0 0 15px rgba(56, 189, 248, 0.08) !important;
}
body.theme-winter div[class*="bg-[#0b0e11]"],
body.theme-winter div[class*="bg-[#14161c]"] {
    background-color: #040810 !important;
    border-color: rgba(56, 189, 248, 0.2) !important;
}
body.theme-winter .text-\[#fcd535\],
body.theme-winter .text-yellow-500,
body.theme-winter .text-yellow-400 {
    color: #38bdf8 !important;
}
body.theme-winter #header-quick-deposit-btn,
body.theme-winter #btn-execute-swap {
    background: linear-gradient(to right, #38bdf8, #6366f1) !important;
    color: #ffffff !important;
    box-shadow: 0 0 15px rgba(56, 189, 248, 0.4) !important;
}
body.theme-winter #col4-swap-btn,
body.theme-winter #open-swap-btn {
    background: rgba(56, 189, 248, 0.15) !important;
    color: #38bdf8 !important;
    border-color: rgba(56, 189, 248, 0.4) !important;
}
body.theme-winter #chart-parent-container,
body.theme-winter [class*="bg-[#131722]"] {
    background-color: #060b16 !important;
}

/* Non-seasonal themes chart container backdrops */
body.theme-cyberpunk #chart-parent-container,
body.theme-cyberpunk [class*="bg-[#131722]"] {
    background-color: #151324 !important;
}
body.theme-emerald-matrix #chart-parent-container,
body.theme-emerald-matrix [class*="bg-[#131722]"] {
    background-color: #0b1a15 !important;
}
body.theme-nordic-ice #chart-parent-container,
body.theme-nordic-ice [class*="bg-[#131722]"] {
    background-color: #101b33 !important;
}
body.theme-neon-japan #chart-parent-container,
body.theme-neon-japan [class*="bg-[#131722]"] {
    background-color: #16091e !important;
}

/* ── 100% FLAWLESS BINANCE PRO LIGHT THEME OVERRIDE ── */
body.light,
body.theme-light {
    background-color: #f5f7fa !important;
    color: #1e2329 !important;
}

body.light nav,
body.light header,
body.light footer,
body.light .panel,
body.light main,
body.light section,
body.light div,
body.light aside,
body.light table,
body.light tr,
body.light th,
body.light td,
body.theme-light nav,
body.theme-light header,
body.theme-light footer,
body.theme-light .panel,
body.theme-light main,
body.theme-light section,
body.theme-light div,
body.theme-light aside,
body.theme-light table,
body.theme-light tr,
body.theme-light th,
body.theme-light td {
    border-color: #eaecef !important;
}

/* All Dark Container Overrides */
body.light [class*="bg-[#181a20]"],
body.light [class*="bg-[#0b0e11]"],
body.light [class*="bg-[#14161c]"],
body.light [class*="bg-[#1e2329]"],
body.light [class*="bg-[#131722]"],
body.light [class*="bg-[#0f1118]"],
body.light [class*="bg-[#0a0d14]"],
body.light .bg-black,
body.light .bg-gray-900,
body.light .bg-gray-950,
body.theme-light [class*="bg-[#181a20]"],
body.theme-light [class*="bg-[#0b0e11]"],
body.theme-light [class*="bg-[#14161c]"],
body.theme-light [class*="bg-[#1e2329]"],
body.theme-light [class*="bg-[#131722]"],
body.theme-light [class*="bg-[#0f1118]"],
body.theme-light [class*="bg-[#0a0d14]"],
body.theme-light .bg-black,
body.theme-light .bg-gray-900,
body.theme-light .bg-gray-950 {
    background-color: #ffffff !important;
    color: #1e2329 !important;
}

/* Inner Sub-cards & Secondary Panels */
body.light [class*="bg-[#2b3139]"],
body.light .bg-gray-800,
body.theme-light [class*="bg-[#2b3139]"],
body.theme-light .bg-gray-800 {
    background-color: #f8f9fa !important;
    color: #1e2329 !important;
}

/* Universal Text Contrast */
body.light [class*="text-white"],
body.light [class*="text-gray-100"],
body.light [class*="text-gray-200"],
body.light [class*="text-gray-300"],
body.light [class*="text-slate-100"],
body.light [class*="text-slate-200"],
body.theme-light [class*="text-white"],
body.theme-light [class*="text-gray-100"],
body.theme-light [class*="text-gray-200"],
body.theme-light [class*="text-gray-300"],
body.theme-light [class*="text-slate-100"],
body.theme-light [class*="text-slate-200"] {
    color: #1e2329 !important;
}

body.light [class*="text-gray-400"],
body.light [class*="text-gray-500"],
body.light [class*="text-gray-600"],
body.light [class*="text-slate-400"],
body.light [class*="text-slate-500"],
body.theme-light [class*="text-gray-400"],
body.theme-light [class*="text-gray-500"],
body.theme-light [class*="text-gray-600"],
body.theme-light [class*="text-slate-400"],
body.theme-light [class*="text-slate-500"] {
    color: #707a8a !important;
}

/* Brand Yellow Highlights */
body.light .text-\[#fcd535\],
body.theme-light .text-\[#fcd535\] {
    color: #d99b00 !important;
}

/* Inputs, Selects & Forms */
body.light input,
body.light select,
body.light textarea,
body.theme-light input,
body.theme-light select,
body.theme-light textarea {
    background-color: #f8f9fa !important;
    color: #1e2329 !important;
    border-color: #d0d5dd !important;
}

body.light select option,
body.theme-light select option {
    background-color: #ffffff !important;
    color: #1e2329 !important;
}

/* Modals & Overlay Cards */
body.light #swap-modal .panel,
body.light #deposit-modal .panel,
body.light #transfer-modal .panel,
body.light #settings-modal .panel,
body.light #auth-modal .panel,
body.theme-light #swap-modal .panel,
body.theme-light #deposit-modal .panel,
body.theme-light #transfer-modal .panel,
body.theme-light #settings-modal .panel,
body.theme-light #auth-modal .panel {
    background-color: #ffffff !important;
    border-color: #eaecef !important;
    color: #1e2329 !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1) !important;
}

/* Header Quick Deposit & Swap Buttons */
body.light #header-quick-deposit-btn,
body.light #btn-execute-swap,
body.theme-light #header-quick-deposit-btn,
body.theme-light #btn-execute-swap {
    background: linear-gradient(to right, #fcd535, #f0b90b) !important;
    color: #1e2329 !important;
    box-shadow: 0 4px 12px rgba(240, 185, 11, 0.25) !important;
}

body.light #col4-swap-btn,
body.light #open-swap-btn,
body.theme-light #col4-swap-btn,
body.theme-light #open-swap-btn {
    background: rgba(240, 185, 11, 0.12) !important;
    color: #d99b00 !important;
    border-color: rgba(240, 185, 11, 0.4) !important;
}

body.light #trading-session-badge,
body.light #toggle-weekend-sim-btn,
body.light #reset-demo-bal-btn,
body.theme-light #trading-session-badge,
body.theme-light #toggle-weekend-sim-btn,
body.theme-light #reset-demo-bal-btn {
    background-color: #f0f3f8 !important;
    color: #1e2329 !important;
    border-color: #eaecef !important;
}

/* ── CUSTOM USER THEME PALETTE ── */
body.theme-custom {
    background-color: var(--custom-bg, #131722) !important;
    color: var(--custom-text, #ffffff) !important;
}
body.theme-custom .panel,
body.theme-custom nav,
body.theme-custom [class*="bg-[#181a20]"],
body.theme-custom [class*="bg-[#0b0e11]"],
body.theme-custom [class*="bg-[#14161c]"],
body.theme-custom [class*="bg-[#131722]"] {
    background-color: var(--custom-panel, #181a20) !important;
    color: var(--custom-text, #ffffff) !important;
}
/* ── PERFECT CENTERING FOR ALL MODAL WINDOWS ON ALL SCREENS ── */
div[id*="modal"]:not(.hidden):not(#kyc-error-modal) {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    position: fixed !important;
    inset: 0 !important;
}

/* Карточка ошибки KYC внутри оверлея — всегда центрированная карточка, а не full-screen оверлей */
#kyc-error-modal {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    position: relative !important;
    inset: auto !important;
    width: 100% !important;
    max-width: 28rem !important; /* max-w-md */
    height: auto !important;
    min-height: auto !important;
    margin: auto !important;
}

/* Hide balance quick bar in mobile trade form wrapper */
@media (max-width: 1023px) {
    #col4-balance-bar { display: none !important; }

    /* ── ORDERBOOK MOBILE FIX: prevent price/size overlap on any screen ── */
    .depth-ask-bg,
    .depth-bid-bg {
        font-size: 8px !important;
        gap: 4px !important;
    }
    .depth-ask-bg > span:first-child,
    .depth-bid-bg > span:first-child {
        width: 58% !important;
        flex: none !important;
        overflow: hidden !important;
        white-space: nowrap !important;
        text-overflow: ellipsis !important;
    }
    .depth-ask-bg > span:nth-child(2),
    .depth-bid-bg > span:nth-child(2) {
        width: 40% !important;
        flex: none !important;
        overflow: hidden !important;
        white-space: nowrap !important;
        text-overflow: ellipsis !important;
    }
    /* Force-hide Total column on ALL mobile screens (not just <640px) */
    .depth-ask-bg > span:nth-child(3),
    .depth-bid-bg > span:nth-child(3) {
        display: none !important;
    }

    /* ── CHAT PANEL MOBILE FIX: full height + messages at bottom ── */
    #support-chat-panel {
        height: calc(100dvh - 140px) !important;
        max-height: calc(100dvh - 140px) !important;
    }
    #support-msg-list {
        display: flex !important;
        flex-direction: column !important;
    }
    /* Push messages to the bottom when few, scroll normally when many */
    #support-msg-list::before {
        content: '' !important;
        flex: 1 1 auto !important;
    }

    /* ── MOBILE LAYOUT ENGINE: flex-базированная высота ─────────────────────────────────
     *  body = h-dvh flex flex-col | главная сетка = flex-1 min-h-0
     *  mobile-main-panel = flex-1 min-h-0 + padding-bottom:58px (док)
     *  Стакан и форма занимают h-full родителя, не вылезают за экран
     * ─────────────────────────────────────────────────────────────────── */
    #mobile-main-panel {
        flex: 1 1 0% !important;
        min-height: 0 !important;
        overflow: hidden !important;
        /* padding-bottom через style="" на элементе */
    }

    /* Торговый вид (форма + стакан) растягивается на всю доступную высоту */
    #mobile-trade-view {
        height: 100% !important;
        overflow: hidden !important;
    }
    #mobile-trade-view > div {
        height: 100% !important;
        overflow: hidden !important;
    }

    /* Форма торговли: скроллится внутри, но не растягивает родителя */
    #mobile-trade-form-wrapper {
        width: 52% !important;
        height: 100% !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch !important;
    }

    /* Стакан: строго занимает высоту родителя, не скроллится вниз */
    #mobile-orderbook-wrapper {
        width: 48% !important;
        height: 100% !important;
        overflow: hidden !important;
        display: flex !important;
        flex-direction: column !important;
    }

    /* Мобильная шапка стакана: гарантированное вмещение селектора шага цены */
    #mobile-orderbook-wrapper > div:first-child {
        padding-left: 6px !important;
        padding-right: 6px !important;
    }
    #mobile-orderbook-wrapper #col2-tab-ob-btn,
    #mobile-orderbook-wrapper #col2-tab-trades-btn {
        padding-left: 6px !important;
        padding-right: 6px !important;
    }

    /* Вид позиций/аналитики: скроллится внутри своей высоты */
    #mobile-tables-view {
        height: 100% !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch !important;
    }

    /* Основная сетка терминала — не скроллится, держит всё в экране */
    .flex.flex-col.lg\\:flex-row.flex-1.overflow-hidden {
        overflow: hidden !important;
    }

    /* ── МОБИЛЬНАЯ ФОРМА ТОРГОВЛИ: растягиваем на всю высоту панели ── */
    #mobile-trade-form-wrapper {
        display: flex !important;
        flex-direction: column !important;
    }
    /* active-trade-controls занимает всё доступное место */
    #mobile-trade-form-wrapper > #active-trade-controls {
        flex: 1 1 0% !important;
        min-height: 0 !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: flex-start !important;
    }
    /* guest-trade-lock тоже растягивается */
    #mobile-trade-form-wrapper > #guest-trade-lock {
        flex: 1 1 0% !important;
        margin: 0 !important;
    }

    /* Гарантия полного скрытия при наличии класса hidden */
    #mobile-trade-form-wrapper > #active-trade-controls.hidden,
    #mobile-trade-form-wrapper > #guest-trade-lock.hidden {
        display: none !important;
    }
    /* Кнопки Buy/Sell естественно следуют за формой и подтягиваются вверх (как на ПК) */
    #mobile-trade-form-wrapper #active-trade-controls > .flex.gap-2.mt-auto {
        margin-top: 8px !important;
        flex-shrink: 0 !important;
    }
    /* Кнопки на мобайле чуть поменьше */
    #mobile-trade-form-wrapper #btn-long,
    #mobile-trade-form-wrapper #btn-short {
        padding-top: 10px !important;
        padding-bottom: 10px !important;
        font-size: 11px !important;
    }

    /* Dock-bar: safe area для iPhone с Home indicator */
    #mobile-bottom-dock {
        height: calc(58px + env(safe-area-inset-bottom, 0px)) !important;
        padding-bottom: env(safe-area-inset-bottom, 0px) !important;
    }

    /* Header & Mobile Chart Drawer: safe area для iPhone с Notch / Dynamic Island */
    #mobile-chart-header {
        height: calc(44px + env(safe-area-inset-top, 0px)) !important;
        padding-top: env(safe-area-inset-top, 0px) !important;
        box-sizing: border-box !important;
    }

    #mobile-full-chart-drawer {
        padding-bottom: calc(58px + env(safe-area-inset-bottom, 0px)) !important;
    }

    nav.global-nav {
        height: calc(56px + env(safe-area-inset-top, 0px)) !important;
        padding-top: env(safe-area-inset-top, 0px) !important;
        box-sizing: border-box !important;
    }

    /* На мобильных экранах скрываем кнопку установки из навигации (доступна в Настройках) */
    #pwa-install-header-btn {
        display: none !important;
    }
}

/* ── SUPPORT WIDGET TAB BUTTONS FLEX CENTERING ── */
#tab-support-chat,
#tab-support-faq {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.375rem !important;
}
#tab-support-chat svg,
#tab-support-faq svg {
    display: block !important;
    flex-shrink: 0 !important;
}
#tab-support-chat span,
#tab-support-faq span {
    display: inline-flex !important;
    align-items: center !important;
    line-height: 1 !important;
}

/* ── RESPONSIVE LAPTOP & TABLET (< 1536px) vs ULTRA-WIDE DESKTOP (>= 1536px) ── */
@media (min-width: 1536px) {
    /* На широких мониторах (Full HD / 2K / 4K) сделки выносятся в отдельную 3-ю колонку */
    #desktop-col3 { display: flex !important; }
    .col2-tab-trades-btn { display: none !important; }
    #col2-trades-content { display: none !important; }
    #col2-ob-content { display: flex !important; }
}

@media (max-width: 1535px) {
    /* На ноутбуках (включая MacBook Air 13" 1440px) и планшетах 3-я колонка скрыта, сделки переключаются табом в колонке 2 */
    #desktop-col3 { display: none !important; }
    .col2-tab-trades-btn { display: flex !important; }
}

/* Компактный вид кнопки Info в шапке графика на небольших экранах */
@media (max-width: 1200px) {
    #open-asset-info-btn span[data-i18n="chart.info"] {
        display: none !important;
    }
}

/* Компактная кнопка поддержки, не перекрывающая торговые кнопки */
@media (max-width: 1439px) {
    #btn-toggle-support-chat {
        bottom: 0.75rem !important;
        right: 0.75rem !important;
        padding: 0.375rem 0.75rem !important;
        font-size: 11px !important;
    }
}

#btn-toggle-support-chat.hidden {
    display: none !important;
}

/* ЖЕЛЕЗНОЕ ПРАВИЛО: когда панель саппорта открыта — кнопка ВСЕГДА скрыта на всех экранах */
body:has(#support-chat-panel:not(.hidden)) #btn-toggle-support-chat,
#btn-toggle-support-chat.chat-open {
    display: none !important;
}

/* Аккуратная кнопка поддержки для гостей на экранах мобилок */
@media (max-width: 1023px) {
    #btn-toggle-support-chat {
        bottom: 68px !important; /* прямо над нижним док-баром (58px + 10px отступ) */
        right: 12px !important;
        padding: 6px 12px !important;
        font-size: 11px !important;
        border-radius: 9999px !important;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.7) !important;
    }
    #btn-toggle-support-chat.max-lg\:flex {
        display: flex !important;
    }
    #btn-toggle-support-chat.max-lg\:hidden {
        display: none !important;
    }
}

/* ── GPU COMPOSITING OPTIMIZATIONS FOR LIGHTWEIGHT CHARTS ── */
#tradingview_chart,
#tradingview_chart canvas {
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    will-change: transform;
    contain: layout paint;
}

/* ── GUEST TRADE LOCK ACTION BUTTONS FLEX CENTERING ── */
#guest-btn-login,
#guest-btn-register {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.5rem !important;
}
#guest-btn-login svg,
#guest-btn-register svg {
    display: block !important;
    flex-shrink: 0 !important;
    margin: 0 !important;
}
#guest-btn-login span,
#guest-btn-register span {
    display: inline-flex !important;
    align-items: center !important;
    line-height: 1 !important;
}

/* ══════════════════════════════════════════════════════════════
   WHITE-LABEL & DYNAMIC THEME ACCENT TOKENS
   ══════════════════════════════════════════════════════════════ */
:root {
    --brand-accent: #00f2fe;
    --brand-accent-glow: rgba(0, 242, 254, 0.35);
    --brand-accent-bg: rgba(0, 242, 254, 0.12);
    --brand-accent-border: rgba(0, 242, 254, 0.35);
    --brand-accent-contrast: #000000;

    /* Base theme accent defaults to brand accent */
    --theme-accent: var(--brand-accent);
    --theme-accent-glow: var(--brand-accent-glow);
    --theme-accent-bg: var(--brand-accent-bg);
    --theme-accent-border: var(--brand-accent-border);
    --theme-accent-contrast: var(--brand-accent-contrast);
}

/* Theme-specific accent overrides */
body.theme-spring {
    --theme-accent: #34d399;
    --theme-accent-glow: rgba(52, 211, 153, 0.4);
    --theme-accent-bg: rgba(52, 211, 153, 0.15);
    --theme-accent-border: rgba(52, 211, 153, 0.4);
    --theme-accent-contrast: #000000;
}
body.theme-summer {
    --theme-accent: #f59e0b;
    --theme-accent-glow: rgba(245, 158, 11, 0.4);
    --theme-accent-bg: rgba(245, 158, 11, 0.15);
    --theme-accent-border: rgba(245, 158, 11, 0.4);
    --theme-accent-contrast: #000000;
}
body.theme-autumn {
    --theme-accent: #f97316;
    --theme-accent-glow: rgba(249, 115, 22, 0.4);
    --theme-accent-bg: rgba(249, 115, 22, 0.15);
    --theme-accent-border: rgba(249, 115, 22, 0.4);
    --theme-accent-contrast: #000000;
}
body.theme-winter {
    --theme-accent: #38bdf8;
    --theme-accent-glow: rgba(56, 189, 248, 0.4);
    --theme-accent-bg: rgba(56, 189, 248, 0.15);
    --theme-accent-border: rgba(56, 189, 248, 0.4);
    --theme-accent-contrast: #000000;
}
body.theme-neon-japan {
    --theme-accent: #ff3b94;
    --theme-accent-glow: rgba(255, 59, 148, 0.4);
    --theme-accent-bg: rgba(255, 59, 148, 0.15);
    --theme-accent-border: rgba(255, 59, 148, 0.4);
    --theme-accent-contrast: #ffffff;
}
body.theme-cyberpunk {
    --theme-accent: #fcee0a;
    --theme-accent-glow: rgba(252, 238, 10, 0.4);
    --theme-accent-bg: rgba(252, 238, 10, 0.15);
    --theme-accent-border: rgba(252, 238, 10, 0.4);
    --theme-accent-contrast: #000000;
}
body.theme-emerald-matrix {
    --theme-accent: #00ff87;
    --theme-accent-glow: rgba(0, 255, 135, 0.4);
    --theme-accent-bg: rgba(0, 255, 135, 0.15);
    --theme-accent-border: rgba(0, 255, 135, 0.4);
    --theme-accent-contrast: #000000;
}
body.theme-nordic-ice {
    --theme-accent: #4cc9f0;
    --theme-accent-glow: rgba(76, 201, 240, 0.4);
    --theme-accent-bg: rgba(76, 201, 240, 0.15);
    --theme-accent-border: rgba(76, 201, 240, 0.4);
    --theme-accent-contrast: #000000;
}
body.theme-light {
    --theme-accent: #f59e0b;
    --theme-accent-glow: rgba(245, 158, 11, 0.35);
    --theme-accent-bg: rgba(245, 158, 11, 0.12);
    --theme-accent-border: rgba(245, 158, 11, 0.35);
    --theme-accent-contrast: #000000;
}
body.theme-custom {
    --theme-accent: var(--custom-accent, #fcd535);
    --theme-accent-glow: color-mix(in srgb, var(--custom-accent, #fcd535) 40%, transparent);
    --theme-accent-bg: color-mix(in srgb, var(--custom-accent, #fcd535) 15%, transparent);
    --theme-accent-border: color-mix(in srgb, var(--custom-accent, #fcd535) 35%, transparent);
    --theme-accent-contrast: #000000;
}

/* Dynamic Accent Text & Highlight Colors */
.brand-accent-color,
.brand-name,
#market-type-margin,
#header-leverage-badge,
#legend-symbol,
#leverage-display,
#col2-tab-ob-btn,
#ob-grouping-trigger,
.position-mode-btn[data-mode="MERGE"].active-mode,
.position-mode-btn.bg-yellow-500\/20,
body .position-mode-btn.bg-yellow-500\/20,
body [class*="theme-"] .position-mode-btn.bg-yellow-500\/20,
body .position-mode-btn[data-mode="MERGE"].active-mode,
body [class*="theme-"] .position-mode-btn[data-mode="MERGE"].active-mode,
.dock-btn.text-\[\#fcd535\],
body .dock-btn.text-\[\#fcd535\],
body [class*="theme-"] .dock-btn.text-\[\#fcd535\],
#settings-account-badge,
body #settings-account-badge,
#settings-modal-header-icon,
body #settings-modal-header-icon,
#custom-picker-header,
body #custom-picker-header,
#settings-admin-title,
body #settings-admin-title,
.theme-check-icon,
body .theme-check-icon {
    color: var(--theme-accent) !important;
}

/* Badges with background & border */
#header-leverage-badge,
.brand-badge,
.position-mode-btn[data-mode="MERGE"].active-mode,
.position-mode-btn.bg-yellow-500\/20,
body .position-mode-btn[data-mode="MERGE"].active-mode,
body .position-mode-btn.bg-yellow-500\/20,
body [class*="theme-"] .position-mode-btn[data-mode="MERGE"].active-mode,
body [class*="theme-"] .position-mode-btn.bg-yellow-500\/20,
#settings-admin-badge,
body #settings-admin-badge {
    color: var(--theme-accent) !important;
    background-color: var(--theme-accent-bg) !important;
    border-color: var(--theme-accent-border) !important;
}

/* Card Borders */
#settings-account-card,
body #settings-account-card {
    border-color: var(--theme-accent-border) !important;
}

/* Main Action Buttons: Save Settings, PnL Download, KYC understand, etc. */
#close-settings-btn,
body #close-settings-btn,
#btn-download-pnl-action,
body #btn-download-pnl-action,
#kyc-restriction-action-btn,
body #kyc-restriction-action-btn,
#apply-ind-settings-btn,
body #apply-ind-settings-btn {
    background: var(--theme-accent) !important;
    color: var(--theme-accent-contrast, #000000) !important;
    box-shadow: 0 4px 15px var(--theme-accent-glow) !important;
    border-color: var(--theme-accent-border, transparent) !important;
}
#close-settings-btn:hover,
body #close-settings-btn:hover,
#btn-download-pnl-action:hover,
body #btn-download-pnl-action:hover,
#kyc-restriction-action-btn:hover,
body #kyc-restriction-action-btn:hover,
#apply-ind-settings-btn:hover,
body #apply-ind-settings-btn:hover {
    filter: brightness(1.12);
}

/* Quick Deposit & Swap Buttons in Default Brand & Custom Theme */
body:not([class*="theme-"]) #header-quick-deposit-btn,
body:not([class*="theme-"]) #btn-execute-swap,
body:not([class*="theme-"]) #faq-open-deposit-btn,
body.theme-custom #header-quick-deposit-btn,
body.theme-custom #btn-execute-swap,
body.theme-custom #faq-open-deposit-btn {
    background: var(--theme-accent) !important;
    color: var(--theme-accent-contrast, #000000) !important;
    box-shadow: 0 4px 15px var(--theme-accent-glow) !important;
    border-color: var(--theme-accent-border, transparent) !important;
}

body:not([class*="theme-"]) #col4-swap-btn,
body:not([class*="theme-"]) #open-swap-btn,
body.theme-custom #col4-swap-btn,
body.theme-custom #open-swap-btn {
    background: var(--theme-accent-bg) !important;
    color: var(--theme-accent) !important;
    border-color: var(--theme-accent-border) !important;
}

/* Bordered Action Buttons */
#btn-apply-custom-colors,
body #btn-apply-custom-colors,
#settings-admin-btn,
body #settings-admin-btn {
    color: var(--theme-accent) !important;
    border-color: var(--theme-accent-border) !important;
}
#btn-apply-custom-colors:hover,
body #btn-apply-custom-colors:hover,
#settings-admin-btn:hover,
body #settings-admin-btn:hover {
    background-color: var(--theme-accent-bg) !important;
}

/* Reset Chart View Button */
#reset-chart-view-btn,
body #reset-chart-view-btn,
body [class*="theme-"] #reset-chart-view-btn {
    background-color: var(--theme-accent) !important;
    color: var(--theme-accent-contrast, #000000) !important;
    box-shadow: 0 4px 15px var(--theme-accent-glow) !important;
}

/* Active Bottom Borders on Navigation & Trade Tabs */
#tab-positions-view:not(.border-transparent),
#tab-positions-view.border-\[\#fcd535\],
#tab-orders-view.border-\[\#fcd535\],
#tab-history-view.border-\[\#fcd535\],
#tab-spot-view.border-\[\#fcd535\],
#tab-analytics-view.border-\[\#fcd535\],
.border-\[\#fcd535\],
body #tab-positions-view:not(.border-transparent),
body #tab-positions-view.border-\[\#fcd535\],
body #tab-orders-view.border-\[\#fcd535\],
body #tab-history-view.border-\[\#fcd535\],
body #tab-spot-view.border-\[\#fcd535\],
body #tab-analytics-view.border-\[\#fcd535\],
body [class*="theme-"] #tab-positions-view:not(.border-transparent),
body [class*="theme-"] #tab-positions-view.border-\[\#fcd535\],
body [class*="theme-"] #tab-orders-view.border-\[\#fcd535\],
body [class*="theme-"] #tab-history-view.border-\[\#fcd535\],
body [class*="theme-"] #tab-spot-view.border-\[\#fcd535\],
body [class*="theme-"] #tab-analytics-view.border-\[\#fcd535\] {
    border-bottom-color: var(--theme-accent) !important;
}

/* Form Controls */
#leverage-input,
#size-slider,
#toggle-confirm,
#toggle-hotkeys,
input.accent-yellow-500,
body input.accent-yellow-500,
body #leverage-input,
body #size-slider {
    accent-color: var(--theme-accent) !important;
}

input[type="range"]::-webkit-slider-thumb {
    background-color: var(--theme-accent) !important;
    box-shadow: 0 0 6px var(--theme-accent-glow) !important;
}

.peer:checked ~ div[class*="peer-checked:bg-yellow-500"] {
    background-color: var(--theme-accent) !important;
}

/* Category Pills */
.futuristic-cat-pill.active,
.futuristic-cat-pill[data-cat="all"]:first-child {
    color: var(--theme-accent) !important;
    border-color: var(--theme-accent-border) !important;
}

/* General Text & Border Accents for Custom & Default Brand */
body.theme-custom .text-\[#fcd535\],
body.theme-custom .text-yellow-500,
body.theme-custom .text-yellow-400,
body:not([class*="theme-"]) .text-\[#fcd535\],
body:not([class*="theme-"]) .text-yellow-500,
body:not([class*="theme-"]) .text-yellow-400 {
    color: var(--theme-accent) !important;
}

body.theme-custom .border-\[#fcd535\],
body.theme-custom .border-yellow-500,
body.theme-custom .border-yellow-700\/30,
body:not([class*="theme-"]) .border-\[#fcd535\],
body:not([class*="theme-"]) .border-yellow-500,
body:not([class*="theme-"]) .border-yellow-700\/30 {
    border-color: var(--theme-accent-border) !important;
}