/* Macrolyx Terminal — glass shell. All colors come from :root tokens injected by Settings. */

.mlx-body {
	margin: 0;
	min-height: 100vh;
	background: linear-gradient(160deg, var(--mlx-bg1), var(--mlx-bg2)) fixed;
	color: var(--mlx-text);
	font-family: Vazirmatn, -apple-system, "Segoe UI", Tahoma, sans-serif;
	font-size: 15px;
	line-height: 1.8;
	-webkit-font-smoothing: antialiased;
}

.mlx-app {
	max-width: 1400px;
	margin: 0 auto;
	padding: 16px;
	display: flex;
	flex-direction: column;
	min-height: 100vh;
	gap: 16px;
	box-sizing: border-box;
}

.mlx-glass {
	background: var(--mlx-glass);
	-webkit-backdrop-filter: blur(var(--mlx-blur));
	backdrop-filter: blur(var(--mlx-blur));
	border: 1px solid var(--mlx-border);
	border-radius: 14px;
}

/* ---------- Header ---------- */

.mlx-header {
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 12px 20px;
	position: sticky;
	top: 12px;
	z-index: 50;
}

.mlx-brand { display: flex; align-items: center; gap: 12px; order: 1; }
/* Header order: brand then the menu at the inline-start; the last-update
   badge and the profile block are pushed together to the inline-end. */
.mlx-nav { order: 2; }
.mlx-sync { order: 3; margin-inline-start: auto; }
.mlx-user { order: 4; }
.mlx-brand + .mlx-user { margin-inline-start: auto; } /* Logged out: no sync badge. */
.mlx-nav-toggle { order: 99; }
.mlx-logo { height: 36px; width: auto; display: block; }
.mlx-brand-name { font-weight: 700; font-size: 17px; letter-spacing: .3px; }
.mlx-brand-tagline { font-size: 11.5px; color: var(--mlx-muted); line-height: 1.4; }

.mlx-menu {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	gap: 4px;
}
.mlx-menu a {
	display: block;
	padding: 6px 14px;
	border-radius: 8px;
	color: var(--mlx-muted);
	text-decoration: none;
	font-size: 13.5px;
	transition: color .15s, background .15s;
}
.mlx-menu a:hover,
.mlx-menu .current-menu-item a {
	color: var(--mlx-accent);
	background: rgba(255, 255, 255, .05);
}

.mlx-user { display: flex; align-items: center; gap: 10px; }
.mlx-user-name { font-size: 13px; color: var(--mlx-muted); }

.mlx-btn {
	display: inline-block;
	background: var(--mlx-accent);
	color: var(--mlx-bg1);
	border: 0;
	border-radius: 9px;
	padding: 8px 20px;
	font-family: inherit;
	font-size: 13.5px;
	font-weight: 600;
	text-decoration: none;
	cursor: pointer;
	transition: opacity .15s;
}
.mlx-btn:hover { opacity: .88; color: var(--mlx-bg1); }
.mlx-btn-ghost {
	background: transparent;
	color: var(--mlx-muted);
	border: 1px solid var(--mlx-border);
}
.mlx-btn-ghost:hover { color: var(--mlx-text); }
.mlx-btn-full { width: 100%; }

.mlx-nav-toggle {
	display: none;
	background: transparent;
	border: 1px solid var(--mlx-border);
	color: var(--mlx-text);
	border-radius: 8px;
	padding: 4px 10px;
	font-size: 16px;
	cursor: pointer;
}

/* ---------- Dashboard ---------- */

.mlx-main { flex: 1; }

.mlx-placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--mlx-muted);
	font-size: 13px;
	text-align: center;
	min-height: 120px;
}

/* ---------- Login ---------- */

.mlx-login-wrap {
	display: flex;
	justify-content: center;
	align-items: center;
	min-height: 55vh;
	padding: 24px 0;
}
.mlx-login {
	width: 100%;
	max-width: 380px;
	padding: 28px 30px;
}
.mlx-login h2 { margin: 0 0 18px; font-size: 17px; }
.mlx-login label { display: block; font-size: 13px; color: var(--mlx-muted); margin: 12px 0 5px; }
.mlx-login input[type="text"],
.mlx-login input[type="password"] {
	width: 100%;
	box-sizing: border-box;
	background: rgba(255, 255, 255, .05);
	border: 1px solid var(--mlx-border);
	border-radius: 9px;
	color: var(--mlx-text);
	padding: 9px 13px;
	font-family: inherit;
	font-size: 14px;
	outline: none;
	transition: border-color .15s;
}
.mlx-login input:focus { border-color: var(--mlx-accent); }
.mlx-remember { display: flex; align-items: center; gap: 7px; margin: 14px 0 18px !important; }
.mlx-error {
	background: rgba(255, 80, 80, .1);
	border: 1px solid rgba(255, 80, 80, .35);
	color: #ff9c9c;
	border-radius: 9px;
	padding: 8px 14px;
	font-size: 13px;
	margin-bottom: 6px;
}

/* ---------- Footer ---------- */

.mlx-footer { padding: 16px 22px; font-size: 13px; }
.mlx-menu-footer { flex-wrap: wrap; margin-bottom: 8px; }
.mlx-footer-row {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 14px;
	flex-wrap: wrap;
}
.mlx-footer-contact,
.mlx-footer-social { display: flex; gap: 16px; flex-wrap: wrap; color: var(--mlx-muted); }
.mlx-footer a { color: var(--mlx-muted); text-decoration: none; }
.mlx-footer a:hover { color: var(--mlx-accent); }
.mlx-copyright {
	margin-top: 10px;
	padding-top: 10px;
	border-top: 1px solid var(--mlx-border);
	color: var(--mlx-muted);
	font-size: 12px;
	text-align: center;
}

/* ---------- Responsive ---------- */

@media (max-width: 860px) {
	.mlx-nav {
		display: none;
		position: absolute;
		top: calc(100% + 8px);
		inset-inline: 0;
		background: var(--mlx-bg2);
		border: 1px solid var(--mlx-border);
		border-radius: 12px;
		padding: 8px;
	}
	.mlx-header { position: relative; top: 0; }
	.mlx-nav.is-open { display: block; }
	.mlx-menu { flex-direction: column; }
	.mlx-nav-toggle { display: inline-block; }
	.mlx-user-name { display: none; }
}

/* ---------- Header: data last-updated badge ---------- */

.mlx-sync {
	display: flex;
	align-items: center;
	gap: 6px;
	color: var(--mlx-muted);
	font-size: 12px;
	white-space: nowrap;
	font-variant-numeric: tabular-nums;
}
.mlx-sync-icon { color: var(--mlx-accent); }

/* ---------- Widget card anatomy (minimal head / fading lines / foot) ---------- */

.mlx-card {
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

.mlx-w-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 10px 16px;
}
.mlx-w-title { margin: 0; font-size: 14px; font-weight: 600; }

.mlx-w-actions { display: flex; gap: 4px; }
.mlx-w-btn {
	background: transparent;
	border: 0;
	color: var(--mlx-muted);
	font-size: 14px;
	line-height: 1;
	padding: 5px 7px;
	border-radius: 7px;
	cursor: pointer;
	transition: color .15s, background .15s;
}
.mlx-w-btn:hover { color: var(--mlx-accent); background: rgba(255, 255, 255, .06); }
.mlx-w-btn.is-busy { opacity: .4; pointer-events: none; }
.mlx-w-drag { cursor: grab; }
.mlx-w-drag:active { cursor: grabbing; }

/* Simple line fading at the edges, before and after the content. */
.mlx-w-line {
	height: 1px;
	flex: 0 0 1px;
	background: linear-gradient(90deg, transparent, var(--mlx-border) 18%, var(--mlx-border) 82%, transparent);
}

.mlx-w-body {
	flex: 1;
	min-height: 0;
	padding: 14px 16px;
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

/* Full-screen (expand) card: pinned above everything, transform neutralized
   (gridstack items carry CSS transforms which would break position:fixed). */
.grid-stack-item.mlx-w-max {
	position: fixed !important;
	inset: 14px !important;
	width: auto !important;
	height: auto !important;
	transform: none !important;
	margin: 0 !important;
	z-index: 6000;
}
.grid-stack-item.mlx-w-max > .grid-stack-item-content {
	inset: 0 !important;
	box-shadow: 0 30px 90px rgba(0, 0, 0, .65);
}
body.mlx-has-max::after {
	content: '';
	position: fixed;
	inset: 0;
	background: rgba(4, 8, 16, .72);
	backdrop-filter: blur(2px);
	z-index: 5990;
}

/* Thin, chrome-free scrollbars matching the card surface. */
.mlx-card *::-webkit-scrollbar,
.mlx-w-body *::-webkit-scrollbar { width: 8px; height: 8px; }
.mlx-card *::-webkit-scrollbar-track,
.mlx-w-body *::-webkit-scrollbar-track { background: transparent; }
.mlx-card *::-webkit-scrollbar-thumb,
.mlx-w-body *::-webkit-scrollbar-thumb {
	background: rgba(255, 255, 255, .16);
	border-radius: 999px;
	border: 2px solid transparent;
	background-clip: padding-box;
}
.mlx-card *::-webkit-scrollbar-thumb:hover,
.mlx-w-body *::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, .28); background-clip: padding-box; }
.mlx-card *::-webkit-scrollbar-button { display: none; height: 0; width: 0; } /* No up/down arrows. */
.mlx-card *::-webkit-scrollbar-corner { background: transparent; }
/* Firefox */
.mlx-card *, .mlx-w-body * { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.16) transparent; }

/* Shared filter chips — used by every module card (news, cbank, cot, …).
   Scoped module copies used to leave the border uncolored on non-COT cards. */
.mlx-chip {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	background: rgba(255, 255, 255, .05);
	border: 1px solid var(--mlx-border);
	color: var(--mlx-muted);
	border-radius: 7px;
	padding: 2px 8px;
	font-family: inherit;
	font-size: 10px;
	line-height: 1.5;
	cursor: pointer;
	transition: color .15s, border-color .15s, background .15s;
}
.mlx-chip:hover { color: var(--mlx-text); }
.mlx-chip.is-on {
	color: var(--mlx-text);
	border-color: var(--mlx-accent);
	background: rgba(var(--mlx-accent-rgb), .14);
}

/* Slim chrome (ticker-style cards): no footer, compact paddings. */
.mlx-card.mlx-w-slim .mlx-w-foot,
.mlx-card.mlx-w-slim .mlx-w-line { display: none; }

/* Locked cards: title stays, body is replaced by an upgrade prompt. */
.mlx-card.mlx-w-locked .mlx-w-title { opacity: .7; }
.mlx-w-lock {
	height: 100%;
	min-height: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	text-align: center;
	gap: 10px;
	padding: 12px;
}
.mlx-w-lock-icon { font-size: 26px; opacity: .8; }
.mlx-w-lock-text { color: var(--mlx-muted); font-size: 13px; margin: 0; max-width: 280px; }
.mlx-w-lock-cta { margin-top: 2px; }
/* Slim ticker: no header/footer chrome — the body fills the card and is
   vertically centered; only a small drag grip floats in the corner. */
.mlx-card.mlx-w-slim {
	display: flex;
	flex-direction: column;
	justify-content: center;
	padding: 0 14px;
}
.mlx-card.mlx-w-slim .mlx-w-head {
	position: absolute;
	top: 0;
	inset-inline-end: 6px;
	height: 100%;
	padding: 0;
	background: transparent;
	pointer-events: none;
}
.mlx-card.mlx-w-slim .mlx-w-title { display: none; }
.mlx-card.mlx-w-slim .mlx-w-actions { height: 100%; align-items: center; }
/* Drop everything in the header except the drag grip. */
.mlx-card.mlx-w-slim .mlx-w-btn:not(.mlx-w-drag) { display: none; }
.mlx-card.mlx-w-slim .mlx-w-drag { pointer-events: auto; opacity: .35; }
.mlx-card.mlx-w-slim .mlx-w-drag:hover { opacity: .8; }
.mlx-card.mlx-w-slim .mlx-w-body { padding: 0; height: 100%; display: flex; align-items: center; justify-content: stretch; }
.mlx-card.mlx-w-slim .mlx-w-body > * { width: 100%; }

/* Per-card documentation icon: tiny accent dot with the same soft glow. */
.mlx-w-info {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 11px;
	height: 11px;
	margin-inline-end: 6px;
	border-radius: 50%;
	background: var(--mlx-accent);
	color: var(--mlx-bg1);
	font-size: 8px;
	font-weight: 700;
	font-style: italic;
	line-height: 1;
	text-decoration: none;
	box-shadow: 0 1px 4px rgba(0, 0, 0, .55); /* Plain shadow — no glow, no pulse. */
	flex: 0 0 11px;
}
.mlx-w-info:hover { filter: brightness(1.3); }

@keyframes mlx-glow {
	0%, 100% { filter: brightness(1); }
	50%      { filter: brightness(1.45); }
}

.mlx-w-foot {
	display: flex;
	justify-content: flex-start; /* "i" + description on the left. */
	align-items: center;
	gap: 8px;
	padding: 7px 16px;
	font-size: 11px;
	color: var(--mlx-muted);
}
.mlx-w-foot-title { text-align: start; }
.mlx-w-foot-note { margin-inline-start: auto; white-space: nowrap; } /* Updated time on the right. */

/* ---------- GridStack integration ---------- */

.grid-stack .grid-stack-placeholder > .placeholder-content {
	background: rgba(255, 255, 255, .04);
	border: 1px dashed var(--mlx-accent);
	border-radius: 14px;
}
.mlx-dash-toolbar {
	display: flex;
	justify-content: flex-end;
	margin-bottom: 10px;
}
.mlx-placeholder-card { padding: 30px; }

/* ---------- Admin: Telegram screenshot modal ---------- */

.mlx-modal {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, .55);
	display: none;
	align-items: center;
	justify-content: center;
	z-index: 999;
	padding: 16px;
}
.mlx-modal.is-open { display: flex; }
/* Guard against theme CSS forcing a display value on divs/classes. */
#mlx-shot-modal:not(.is-open) { display: none !important; }
#mlx-shot-modal.is-open { display: flex !important; }
.mlx-modal-card {
	width: 100%;
	max-width: 460px;
	max-height: 92vh;
	overflow-y: auto;
	padding: 20px 22px;
	background: var(--mlx-bg2);
}
.mlx-modal-card h3 { margin: 0 0 12px; font-size: 15px; }
#mlx-shot-preview {
	width: 100%;
	border-radius: 10px;
	border: 1px solid var(--mlx-border);
	display: block;
}
.mlx-modal-label { display: block; font-size: 12px; color: var(--mlx-muted); margin: 12px 0 5px; }
#mlx-shot-caption {
	width: 100%;
	box-sizing: border-box;
	background: rgba(255, 255, 255, .05);
	border: 1px solid var(--mlx-border);
	border-radius: 9px;
	color: var(--mlx-text);
	padding: 9px 13px;
	font-family: inherit;
	font-size: 13.5px;
	resize: vertical;
}
#mlx-shot-caption:focus { outline: none; border-color: var(--mlx-accent); }
.mlx-shot-ch { display: block; font-size: 13px; margin-bottom: 5px; color: var(--mlx-text); }
.mlx-modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* Resize handles: keep the function and cursor, hide the corner icons. */
.grid-stack-item > .ui-resizable-handle {
	background: none !important;
	opacity: 0;
}

/* Auth links under the terminal login form. */
.mlx-login-links {
	display: flex;
	justify-content: space-between;
	gap: 12px;
	flex-wrap: wrap;
	margin-top: 14px;
}
.mlx-login-links a {
	font-size: 13px;
	color: var(--mlx-accent);
	text-decoration: none;
}
.mlx-login-links a:hover { text-decoration: underline; }

/* Success notice inside the terminal login card. */
.mlx-login .mlx-ok {
	background: rgba(var(--mlx-long-rgb, 46, 158, 91), .12);
	border: 1px solid rgba(var(--mlx-long-rgb, 46, 158, 91), .4);
	color: #bfe6cd;
	border-radius: 10px;
	padding: 10px 13px;
	font-size: 13px;
	margin-bottom: 14px;
}

/* ---------- Chart tooltips ---------- */
/* ECharts tooltips are appended to <body> (appendToBody) so tall value lists
   are never clipped by the card's overflow; restore the terminal font there
   (!important: ECharts inlines a font shorthand on the element). */
.mlx-tip { font-family: Vazirmatn, ui-sans-serif, system-ui, sans-serif !important; }
