:root {
	--blue: #3593ff;
	--black: #14151a;
	--bg: #24242e;
	--bg-dark: #1d1d25;
	--bg-light: #292a36;
	--bg-lighter: #333443;
	--bg-selected: #007bff;
	--bg-hover: #2d3940;
	--border-light: #37444b;
	--app-border: #37444b;
	--input-background: #16161c;
	--text-light: #698390;
	--text-lighter: #586174;
	--text-gray: #a9a9a9;
	--icon: #698390;
	--mobile-menu-height: 52px;
	--nav-width: 180px;
	--nav-pad: 16px;
	--text-strong: #f3f5f7;
	--text-value: #d5dbe4;
	--text-label: #8b97a8;
	--live: #2fd48a;
	--demo: #f5b74c;
	--test: #ff8591;
}

* {
	box-sizing: border-box;
	-moz-box-sizing: border-box;
	-webkit-box-sizing: border-box;
	outline: 0;
}

html, body {
	max-width: 100%;
	background-color: var(--bg);
	overflow-x: hidden;
}

body {
	margin: 0;
	padding: 0;
	font-family: "Arial", sans-serif;
	font-size: 12px;
	color: #fff;
}

form {
	margin: 0;
	padding: 0;
}

input, textarea {
	font: normal 12px "Arial", sans-serif;
	color: #fff;
}

input, textarea, img, svg, label {
	vertical-align: middle;
}

img {
	border: 0;
}

label {
	cursor: pointer;
}

a:hover {
	text-decoration: none;
}

div.o-h {
	width: 100%;
	overflow: hidden;
}

div.c-b {
	clear: both;
	font-size: 0;
}

/* Theme */
.nohl {
	-webkit-touch-callout: none;
	-webkit-user-select: none;
	-khtml-user-select: none;
	-moz-user-select: none;
	-ms-user-select: none;
	user-select: none;
}

/* Mobile */
#d-nav {
	display: none;
}

#board {
	position: absolute;
	width: 100%;
	height: 100%;
}

#mt-platform {
	position: relative;
	width: 100%;
	height: 100%;
}

#webterminal {
	position: absolute;
	width: 100%;
	height: 100%;
}

/* Footer Mobile Menu */
#m-menu {
	display: block;
	position: fixed;
	left: 0;
	bottom: 0;
	z-index: 10;
	width: 100%;
	height: var(--mobile-menu-height);
	background-color: var(--bg-dark);
}

#m-menu > ul {
	display: flex;
	margin: 0;
	padding: 0;
	width: 100%;
	list-style: none;
	overflow: hidden;
}

#m-menu > ul > li {
	flex: 1 1 0;
	min-width: 0;
}

#m-menu > ul > li > a {
	display: block;
	padding: 5px 0;
	text-align: center;
	text-decoration: none;
	font-size: 10px;
	line-height: 10px;
	color: #fff;
	cursor: pointer;
}

#m-menu > ul > li > a > .icon {
	position: relative;
	margin-bottom: 6px;
	font-size: 0;
	line-height: 26px;
}

#m-menu > ul > li > a > .icon > svg {
	display: inline-block;
}

/*----------- Account identity card --------------*/
/* Rendered inside #d-nav, the mobile sheet and the desktop-app popover; each host only
   changes the frame, the card itself stays one thing. */
.nav-account {
	display: flex;
	flex-direction: column;
	align-items: center;
	width: 100%;
	padding: 16px 12px 10px;
	text-align: center;
	background-color: rgba(255, 255, 255, 0.03);
	border: 1px solid rgba(255, 255, 255, 0.06);
	border-radius: 14px;
}

.nav-account ::selection {
	background-color: var(--brand-color);
	color: #fff;
}

.nav-account__avatar {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: none;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	background-color: var(--brand-color);
	color: #fff;
	font-size: 15px;
	font-weight: bold;
	letter-spacing: 0.04em;
	line-height: 1;
	box-shadow: 0 6px 14px -6px rgba(0, 0, 0, 0.6);
}

.nav-account__avatar--sm {
	width: 26px;
	height: 26px;
	font-size: 10px;
	letter-spacing: 0.02em;
	box-shadow: none;
}

.nav-account__name {
	max-width: 100%;
	margin-top: 10px;
	font-size: 13px;
	font-weight: bold;
	line-height: 1.3;
	color: var(--text-strong);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	unicode-bidi: plaintext; /* a Latin name in an RTL page still clips at its end */
}

.nav-account__nickname {
	max-width: 100%;
	margin-top: 2px;
	font-size: 11px;
	line-height: 1.3;
	color: var(--text-label);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	unicode-bidi: plaintext;
}

.nav-account__status {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 6px;
	max-width: 100%;
	margin-top: 8px;
}

.nav-account__badge {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	padding: 3px 8px;
	border-radius: 999px;
	font-size: 9px;
	font-weight: bold;
	letter-spacing: 0.1em;
	line-height: 1.2;
	text-transform: uppercase;
}

.nav-account__badge::before {
	content: "";
	width: 5px;
	height: 5px;
	border-radius: 50%;
	background-color: currentColor;
}

.nav-account__badge.is-live {
	color: var(--live);
	background-color: rgba(47, 212, 138, 0.12);
}

.nav-account__badge.is-demo {
	color: var(--demo);
	background-color: rgba(245, 183, 76, 0.12);
}

.nav-account__badge.is-test {
	color: var(--test);
	background-color: rgba(255, 133, 145, 0.12);
}

.nav-account__platform {
	max-width: 100%;
	font-size: 11px;
	color: var(--text-label);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	unicode-bidi: plaintext;
}

.nav-account__meta {
	width: 100%;
	margin: 12px 0 0;
}

.nav-account__row {
	padding: 7px 0 6px;
	border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.nav-account__row dt {
	font-size: 9px;
	font-weight: bold;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--text-label);
}

.nav-account__row dd {
	margin: 2px 0 0;
}

.nav-account__value {
	font-size: 13px;
	color: var(--text-value);
	font-variant-numeric: tabular-nums;
}

/* the login id is a real button (copy to clipboard), reset to read as plain text until hovered */
.nav-account__copy {
	all: unset;
	display: inline-flex;
	align-items: center;
	gap: 5px;
	max-width: 100%;
	margin: -2px -7px;
	padding: 2px 7px;
	border-radius: 6px;
	cursor: pointer;
	transition: background-color 150ms ease;
}

.nav-account__copy:hover {
	background-color: rgba(255, 255, 255, 0.06);
}

.nav-account__copy:focus-visible {
	outline: 2px solid var(--brand-color);
	outline-offset: 2px;
}

.nav-account__glyph {
	flex: none;
	fill: var(--text-label);
	transition: fill 150ms ease;
}

.nav-account__copy:hover .nav-account__glyph {
	fill: var(--text-strong);
}

.nav-account__copy.is-copied .nav-account__glyph {
	fill: var(--live);
}

.nav-account__copied {
	font-size: 10px;
	color: var(--live);
}

.nav-account__copied:empty {
	display: none;
}

/* Mobile account sheet: a <details> in the bar; the open summary's ::before is the backdrop */
.m-account > summary {
	display: block;
	padding: 5px 4px;
	text-align: center;
	font-size: 10px;
	line-height: 10px;
	color: #fff;
	cursor: pointer;
	list-style: none;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.m-account > summary::-webkit-details-marker {
	display: none;
}

.m-account > summary > .icon {
	position: relative;
	margin-bottom: 6px;
	font-size: 0;
	line-height: 26px;
}

.m-account[open] > summary::before {
	content: "";
	position: fixed;
	inset: 0 0 var(--mobile-menu-height) 0;
	z-index: 11;
	background-color: rgba(0, 0, 0, 0.55);
}

.m-account__sheet {
	position: fixed;
	inset-inline: 0;
	bottom: var(--mobile-menu-height);
	z-index: 12;
	padding: 16px 16px 20px;
	text-align: center;
	background-color: var(--bg-dark);
	border-top: 1px solid rgba(255, 255, 255, 0.08);
	border-radius: 18px 18px 0 0;
	box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.45);
}

.m-account__sheet .nav-account {
	max-width: 360px;
	margin: 0 auto;
	background-color: rgba(255, 255, 255, 0.04);
}

.m-account__portal {
	display: inline-block;
	min-width: 160px;
	margin-top: 14px;
	padding: 12px 18px;
	text-align: center;
	font-size: 13px;
	font-weight: bold;
	color: #a8b3c1;
	background: rgba(255, 255, 255, 0.04);
	border: 1px solid rgba(255, 255, 255, 0.12);
	border-radius: 10px;
	transition: color 0.15s ease, border-color 0.15s ease;
}

.m-account__portal:hover,
.m-account__portal:focus-visible {
	color: #fff;
	border-color: var(--brand-color);
}

@media (prefers-reduced-motion: no-preference) {
	.m-account[open] > .m-account__sheet {
		animation: sheetRise 220ms cubic-bezier(0.16, 1, 0.3, 1);
	}
}

@keyframes sheetRise {
	from {
		transform: translateY(16px);
		opacity: 0;
	}
}

#iframe {
	height: calc(100% - var(--mobile-menu-height));
}

/* no nav means no #m-menu below it, so nothing to reserve room for */
#board.no-nav #iframe {
	height: 100%;
}

/* Desktops; >= md */
@media only screen and (min-width: 992px) {
	/* Scrollbar */
	::-webkit-scrollbar {
		width: 17px;
	}

	::-webkit-scrollbar-track {
		background-color: transparent;
	}

	::-webkit-scrollbar-thumb {
		background-color: #d6dee1;
		background-clip: content-box;
		border: 6px solid transparent;
		border-radius: 17px;
	}

	::-webkit-scrollbar-thumb:hover {
		background-color: #a8bbbf;
	}

	#d-nav {
		display: flex;
		flex-direction: column;
		position: fixed;
		top: 0;
		left: 0;
		z-index: 10;
		width: var(--nav-width);
		height: 100%;
		background-color: var(--bg);
		padding: 24px var(--nav-pad) 10px;
		border-right: 10px solid var(--bg-dark);
		overflow-y: auto;
		scrollbar-width: thin;
		scrollbar-color: var(--bg-lighter) transparent;
	}

	/* the rail only scrolls on short viewports; keep its bar a sliver, not the 17px page one */
	#d-nav::-webkit-scrollbar {
		width: 6px;
	}

	#d-nav::-webkit-scrollbar-thumb {
		background-color: var(--bg-lighter);
		border: 0;
		border-radius: 6px;
	}

	#d-nav::-webkit-scrollbar-button {
		display: none;
	}

	#logo {
		display: block;
		text-align: center;
		padding: 10px 0;
		width: 100%;
	}

	#logo img {
		max-width: 80px;
		max-height: 100px;
	}

	#d-nav > .nav-account {
		flex: none;
		margin: 8px 0 4px;
	}

	#d-menu {
		display: block;
		position: relative;
		margin: 16px 0 0 0;
		padding: 0;
		list-style: none;
	}

	#d-menu > li > a {
		display: block;
		padding: 15px 0;
		text-align: center;
		text-decoration: none;
		font-weight: bold;
		font-size: 12px;
		color: #586174;
		-webkit-transition: all 150ms ease;
		-moz-transition: all 150ms ease;
		-o-transition: all 150ms ease;
		-ms-transition: "all 150ms ease";
		transition: all 150ms ease;
	}

	#d-menu > li > a:hover {
		color: #fff;
	}

	#d-menu > li > a > .icon {
		display: block;
		height: 30px;
		margin-bottom: 5px;
		font-size: 0;
		line-height: 30px;
	}

	#d-menu > li > a:hover > .icon svg path {
		fill: #fff;
		-webkit-transition: all 150ms ease;
		-moz-transition: all 150ms ease;
		-o-transition: all 150ms ease;
		-ms-transition: "all 150ms ease";
		transition: all 150ms ease;
	}

	#board {
		position: fixed;
		top: 0;
		left: var(--nav-width);
		width: calc(100% - var(--nav-width));
		height: 100%;
	}

	#board.no-nav {
		left: 0;
		width: 100%;
	}

	#m-menu {
		display: none;
	}

	#iframe {
		height: 100%;
	}
}

/*----------- Login screen --------------*/
.login-screen {
	position: relative;
	display: flex;
	height: 100%;
	overflow-y: auto;
	overflow-x: hidden;
	padding: 24px 16px;
}

/* Ambient brand glow */
.login-screen::before,
.login-screen::after {
	content: "";
	position: absolute;
	border-radius: 50%;
	background: radial-gradient(closest-side, var(--brand-color), transparent 72%);
	filter: blur(70px);
	pointer-events: none;
	z-index: 0;
}

.login-screen::before {
	width: 480px;
	height: 480px;
	top: 6%;
	inset-inline-start: 8%;
	opacity: 0.16;
}

.login-screen::after {
	width: 380px;
	height: 380px;
	bottom: 4%;
	inset-inline-end: 6%;
	opacity: 0.12;
}

@media (prefers-reduced-motion: no-preference) {
	.login-screen::before {
		animation: loginGlowDrift 16s ease-in-out infinite alternate;
	}

	.login-screen::after {
		animation: loginGlowDrift 22s ease-in-out infinite alternate-reverse;
	}
}

@keyframes loginGlowDrift {
	from {
		transform: translate3d(-24px, -14px, 0) scale(1);
	}
	to {
		transform: translate3d(24px, 18px, 0) scale(1.1);
	}
}

/* margin:auto centers AND stays scrollable on short viewports
   (flex align-items:center would clip the card top) */
.login-box {
	position: relative;
	z-index: 1;
	width: 100%;
	max-width: 420px;
	margin: auto;
}

.login-card {
	padding: 36px 28px 24px;
	background: var(--bg-dark); /* fallback for no backdrop-filter */
	border: 1px solid rgba(255, 255, 255, 0.08);
	border-radius: 16px;
	box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
	text-align: center;
}

@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
	.login-card {
		background: rgba(29, 29, 37, 0.62);
		-webkit-backdrop-filter: blur(20px);
		backdrop-filter: blur(20px);
	}
}

/* a wordmark needs more width than the square icon this used to be; both caps
   apply, so tall/square logos are still bounded by max-height */
.login-logo {
	display: block;
	margin: 0 auto 20px;
	max-width: 200px;
	max-height: 64px;
}

.login-heading {
	margin: 0 0 28px;
	font-size: 16px;
	font-weight: bold;
	line-height: 1.5;
	color: #fff;
}

/* Floating-label field */
.login-field {
	position: relative;
	margin-bottom: 18px;
	text-align: start;
}

.login-field input {
	width: 100%;
	height: 58px;
	padding: 26px 16px 10px;
	font-size: 16px; /* >=16px: no iOS focus zoom */
	color: #fff;
	background: rgba(0, 0, 0, 0.28);
	border: 1px solid var(--border-light);
	border-radius: 10px;
	transition: border-color 0.2s ease;
}

.login-field input::placeholder {
	color: transparent; /* label is the visible text; placeholder only feeds :placeholder-shown */
}

.login-field input:focus {
	border-color: var(--brand-color);
}

@supports (color: color-mix(in srgb, red 50%, transparent)) {
	.login-field input:focus {
		box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-color) 30%, transparent);
	}
}

.login-field label {
	position: absolute;
	top: 50%;
	inset-inline-start: 16px;
	transform: translateY(-50%);
	margin: 0;
	font-size: 16px;
	color: #a8b3c1;
	pointer-events: none;
	transition: top 0.18s ease, font-size 0.18s ease, transform 0.18s ease, color 0.18s ease;
}

.login-field input:focus ~ label,
.login-field input:not(:placeholder-shown) ~ label {
	top: 9px;
	transform: none;
	font-size: 11px;
	color: #c3ccd8;
}

/* Separate rule: an unsupported selector in a list invalidates the whole list */
.login-field input:-webkit-autofill ~ label {
	top: 9px;
	transform: none;
	font-size: 11px;
	color: #c3ccd8;
}

/* Dark autofill (Chrome/Safari paint white otherwise) */
.login-field input:-webkit-autofill,
.login-field input:-webkit-autofill:hover,
.login-field input:-webkit-autofill:focus {
	-webkit-box-shadow: 0 0 0 1000px var(--input-background) inset;
	-webkit-text-fill-color: #fff;
	caret-color: #fff;
}

/* Password eye toggle: a real button, logical positioning = free RTL */
#togglePassword {
	position: absolute;
	top: 50%;
	inset-inline-end: 6px;
	transform: translateY(-50%);
	width: 44px;
	height: 44px;
	padding: 0;
	background: none;
	border: 0;
	font-size: 18px;
	color: var(--text-gray);
	cursor: pointer;
	z-index: 2;
}

#togglePassword:hover {
	color: #fff;
}

#togglePassword:focus-visible {
	outline: 2px solid #fff;
	outline-offset: -4px;
	border-radius: 8px;
}

.login-field input#password {
	padding-inline-end: 56px; /* keep text clear of the toggle */
}

/* Submit: solid brand color; brightness() derives hover/press for any hex */
.login-submit {
	display: block;
	width: 100%;
	min-height: 48px;
	margin-top: 22px;
	padding: 14px 16px;
	background: var(--brand-color);
	color: #fff;
	border: 0;
	border-radius: 10px;
	font-size: 16px;
	font-weight: bold;
	letter-spacing: 0.02em;
	cursor: pointer;
	transition: filter 0.15s ease, transform 0.1s ease;
}

.login-submit:hover {
	filter: brightness(1.12);
}

.login-submit:active {
	filter: brightness(0.9);
	transform: translateY(1px);
}

.login-submit:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 3px;
}

.login-error {
	margin: 14px 0 0;
	font-size: 13px;
	color: #ff8591; /* >=4.5:1 on the card, unlike Bootstrap's #dc3545 */
}

.login-links {
	margin-top: 16px;
}

.login-forgot {
	display: inline-block;
	padding: 10px 8px; /* ~44px touch target */
	font-size: 14px;
	font-weight: bold;
	color: #fff;
}

.login-forgot:hover,
.login-forgot:focus-visible {
	text-decoration: underline;
	color: #fff;
}

/* Language selector restyled only inside the card (nav instances untouched) */
.login-card .lang-select-wrapper {
	margin-top: 20px;
	padding: 0;
}

.login-card .lang-select-wrapper select {
	max-width: 200px;
	min-height: 44px;
	padding: 10px 12px;
	font-size: 16px;
	background-color: rgba(0, 0, 0, 0.28);
	border-radius: 10px;
}

.login-card .lang-select-wrapper select:focus-visible {
	border-color: var(--brand-color);
}

/* Guest nav: Home / My Account ghost buttons under the card */
.login-nav {
	display: flex;
	justify-content: center;
	gap: 12px;
	margin-top: 18px;
}

.login-nav a {
	display: inline-block;
	min-width: 130px;
	padding: 12px 18px;
	text-align: center;
	font-size: 13px;
	font-weight: bold;
	color: #a8b3c1;
	background: rgba(255, 255, 255, 0.04);
	border: 1px solid rgba(255, 255, 255, 0.12);
	border-radius: 10px;
	transition: color 0.15s ease, border-color 0.15s ease;
}

.login-nav a:hover,
.login-nav a:focus-visible {
	color: #fff;
	border-color: var(--brand-color);
}

/* Desktop (must come after the base rule ג€” equal specificity, source order decides) */
@media only screen and (min-width: 992px) {
	.login-screen {
		padding: 32px 24px;
	}
}

/*----------- End Login screen --------------*/

/*----------- WebTrader Language selector --------------*/
.lang-select-wrapper {
	padding: 10px 0;
	text-align: center;
}

.lang-select-wrapper select {
	width: 100%;
	max-width: 160px;
	padding: 4px 6px;
	background-color: var(--input-background);
	color: #fff;
	border: 1px solid var(--border-light);
	border-radius: 4px;
	font-size: 12px;
	cursor: pointer;
}

#m-menu .lang-select-wrapper {
	padding: 8px 4px;
}

#app-controls .lang-select-wrapper {
	padding: 0;
}

/*----------- Desktop app controls --------------*/
/* The desktop app renders no nav, so logout and language float over the
   platform instead. Held back to a low opacity so they don't compete with the
   platform's own toolbar until reached for. */
#app-controls {
	display: flex;
	align-items: center;
	gap: 8px;
	position: fixed;
	top: 10px;
	right: 10px;
	z-index: 20;
	padding: 6px 10px;
	background-color: var(--bg-dark);
	border-radius: 999px;
	opacity: .6;
	transition: opacity 150ms ease;
}

#app-controls:hover,
#app-controls:focus-within {
	opacity: 1;
}

#app-controls > a {
	display: flex;
	align-items: center;
	cursor: pointer;
}

#app-controls > a > svg {
	fill: var(--icon);
	transition: fill 150ms ease;
}

#app-controls > a:hover > svg,
#app-controls > a:focus-visible > svg {
	fill: var(--brand-color);
}

/* account popover: an avatar in the pill that unfolds the same card */
#app-controls > .app-account {
	position: relative;
}

#app-controls > .app-account > summary {
	display: flex;
	align-items: center;
	list-style: none;
	border-radius: 50%;
	cursor: pointer;
}

#app-controls > .app-account > summary::-webkit-details-marker {
	display: none;
}

#app-controls > .app-account > summary:focus-visible {
	outline: 2px solid var(--brand-color);
	outline-offset: 2px;
}

#app-controls > .app-account > summary > .nav-account__avatar--sm {
	width: 24px;
	height: 24px;
	font-size: 9px;
}

.app-account__panel {
	position: absolute;
	top: calc(100% + 10px);
	inset-inline-end: 0;
	z-index: 21;
	width: 232px;
	padding: 8px;
	background-color: var(--bg-dark);
	border: 1px solid rgba(255, 255, 255, 0.08);
	border-radius: 18px;
	box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
}

#app-controls:has(details[open]) {
	opacity: 1;
}

/*----------- RTL (Arabic) --------------*/
html[dir="rtl"] #app-controls {
	right: auto;
	left: 10px;
}

@media only screen and (min-width: 992px) {
	html[dir="rtl"] #d-nav {
		left: auto;
		right: 0;
		border-right: 0;
		border-left: 10px solid var(--bg-dark);
	}

	html[dir="rtl"] #board {
		left: auto;
		right: var(--nav-width);
	}

	html[dir="rtl"] #board.no-nav {
		right: 0;
	}
}
