/*
 * MDS Sidebar — fixed left icon navigation
 * Bridges from theme palette tokens, never hardcodes colors.
 */

/* ---- CSS custom properties ---- */
:root {
	--mds-sidebar-w:         64px;
	--mds-sidebar-w-open:    220px;
	--mds-sidebar-radius:    10px;
	--mds-mobile-tabbar-h:   56px;
	/* Above the TRX fixed header (z ~1000) but below the WP admin bar (99999). */
	--mds-sidebar-z:         9990;
	--mds-sidebar-bg:        var(--theme-color-bg_color,        #0e0e14);
	--mds-sidebar-bd:        var(--theme-color-bd_color,        rgba(255,255,255,.08));
	--mds-sidebar-text:      var(--theme-color-text,            #b0b0c0);
	--mds-sidebar-text-act:  var(--theme-color-text_dark,       #ffffff);
	--mds-sidebar-accent:    var(--theme-color-text_link,       #8866ff);
	--mds-sidebar-hover-bg:  var(--theme-color-alter_bg_hover,  rgba(136,102,255,.12));
	--mds-sidebar-act-bg:    rgba(136,102,255,.18);
	--mds-sidebar-logo-h:    20px;
	--mds-sidebar-top-h:     60px;
	--mds-sidebar-legal-bar-h: 48px;
	--mds-sidebar-row-h:       48px;
	--mds-sidebar-pad-x:       12px;
	--mds-sidebar-icon-col:    40px;
	--mds-sidebar-transition: 380ms cubic-bezier(0.33, 1, 0.68, 1);
	--mds-sidebar-fade: 220ms ease;
	--mds-app-header-h: 56px;
	--mds-cms-gutter: var(--mds-content-gutter, 24px);
	--mds-cms-gutter-open: 32px;
}

/* ---- Sidebar sits below the full-width app header ---- */
body.has-mds-app-header .mds-sidebar {
	top: var(--mds-app-header-h);
	height: calc(100vh - var(--mds-app-header-h));
	height: calc(100dvh - var(--mds-app-header-h));
}

/* ---- Sidebar shell ---- */
.mds-sidebar {
	position: fixed;
	top: 0;
	left: 0;
	height: 100vh;
	width: var(--mds-sidebar-w);
	z-index: var(--mds-sidebar-z);
	background: var(--mds-sidebar-bg);
	border-right: 1px solid var(--mds-sidebar-bd);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	transition: width var(--mds-sidebar-transition);
}

/* Expanded state */
.mds-sidebar.is-open {
	width: var(--mds-sidebar-w-open);
}

/* ---- Inner scrollable column ---- */
.mds-sidebar__inner {
	display: flex;
	flex-direction: column;
	height: 100%;
	width: var(--mds-sidebar-w-open);
	min-width: var(--mds-sidebar-w-open);
	overflow: hidden;
}

/* ---- Top: pin toggle + brand ---- */
.mds-sidebar__top {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 0 var(--mds-sidebar-pad-x);
	min-height: var(--mds-sidebar-top-h);
	height: var(--mds-sidebar-top-h);
	box-sizing: border-box;
	border-bottom: 1px solid var(--mds-sidebar-bd);
	flex-shrink: 0;
}

.mds-sidebar__toggle {
	flex-shrink: 0;
	width: 40px;
	height: 40px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: transparent;
	border: none;
	border-radius: 8px;
	color: var(--mds-sidebar-text);
	cursor: pointer;
	transition: background var(--mds-sidebar-transition), color var(--mds-sidebar-transition);
}

.mds-sidebar.is-open .mds-sidebar__toggle,
.mds-sidebar.is-mobile-open .mds-sidebar__toggle {
	color: var(--mds-sidebar-text-act);
}

.mds-sidebar__toggle:hover {
	background: var(--mds-sidebar-hover-bg);
	color: var(--mds-sidebar-text-act);
}

.mds-sidebar__toggle-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 20px;
	height: 20px;
}

.mds-sidebar__toggle-icon[hidden] {
	display: none !important;
}

.mds-sidebar__brand {
	white-space: nowrap;
	overflow: hidden;
	opacity: 0;
	width: 0;
	max-width: 0;
	font-size: 15px;
	font-weight: 600;
	letter-spacing: .02em;
	color: var(--mds-sidebar-text-act);
	text-decoration: none;
	transition: opacity var(--mds-sidebar-fade), max-width var(--mds-sidebar-fade);
	flex: 1 1 auto;
	min-width: 0;
	pointer-events: none;
}

.mds-sidebar__brand--image {
	line-height: 0;
}

.mds-sidebar__logo {
	display: block;
	height: var(--mds-sidebar-logo-h);
	max-height: var(--mds-sidebar-logo-h);
	width: auto;
	max-width: 100%;
	object-fit: contain;
	object-position: left center;
}

/* Dual logo: dark MY on dark sidebar, light MY on light sidebar / mds-light theme */
.mds-sidebar__logo--on-light {
	display: none;
}

body.mds-sidebar--light .mds-sidebar__logo--on-dark,
html.mds-light body.mds-theme-page .mds-sidebar__logo--on-dark {
	display: none;
}

body.mds-sidebar--light .mds-sidebar__logo--on-light,
html.mds-light body.mds-theme-page .mds-sidebar__logo--on-light {
	display: block;
}

.mds-sidebar__brand-text {
	display: block;
	overflow: hidden;
	text-overflow: ellipsis;
}

.mds-sidebar.is-open .mds-sidebar__brand {
	opacity: 1;
	width: auto;
	max-width: 100%;
	pointer-events: auto;
	transition-delay: 100ms;
}

/* Mobile drawer only — hidden on desktop (logo lives in app header) */
.mds-sidebar__mobile-head,
.mds-sidebar__mobile-profile {
	display: none;
}

.mds-sidebar:not(.is-open) .mds-sidebar__brand {
	transition-delay: 0ms;
}

.mds-sidebar__brand.is-active {
	filter: brightness(1.12);
}

/* ---- Middle zone (nav + secondary + legal overlay) ---- */
.mds-sidebar__middle {
	flex: 1;
	min-height: 0;
	display: flex;
	flex-direction: column;
	position: relative;
	overflow: visible;
}

.mds-sidebar__middle-pane {
	flex: 1;
	min-height: 0;
	display: flex;
	flex-direction: column;
	overflow-y: auto;
	overflow-x: hidden;
	scrollbar-width: thin;
	scrollbar-color: var(--mds-sidebar-bd) transparent;
}

.mds-sidebar__middle-pane::-webkit-scrollbar {
	width: 4px;
}

.mds-sidebar__middle-pane::-webkit-scrollbar-thumb {
	background: var(--mds-sidebar-bd);
	border-radius: 4px;
}

/* ---- Nav list ---- */
.mds-sidebar__nav {
	flex: 0 0 auto;
	list-style: none;
	margin: 0;
	padding: 8px 0;
	overflow: visible;
}

.mds-sidebar__middle-bottom {
	flex-shrink: 0;
	margin-top: auto;
	padding-top: 4px;
	border-top: 1px solid var(--mds-sidebar-bd);
}

.mds-sidebar__secondary {
	list-style: none;
	margin: 0;
	padding: 4px 0 6px;
}

/* ---- Legal bar + full-zone overlay ---- */
.mds-sidebar__legal-bar {
	flex-shrink: 0;
	min-height: var(--mds-sidebar-legal-bar-h);
	border-top: 1px solid var(--mds-sidebar-bd);
	padding: 6px 0 2px;
	overflow: visible;
	position: relative;
	z-index: 3;
}

.mds-sidebar__accordion-toggle {
	width: 100%;
	min-height: var(--mds-sidebar-row-h);
	height: var(--mds-sidebar-row-h);
	padding: 0 var(--mds-sidebar-pad-x);
	box-sizing: border-box;
	background: transparent;
	border: none;
	cursor: pointer;
	text-align: left;
	font-family: inherit;
	font-size: inherit;
	color: inherit;
}

.mds-sidebar__accordion-toggle:hover {
	text-decoration: none;
}

.mds-sidebar__accordion-chevron {
	margin-left: auto;
	flex-shrink: 0;
	display: flex;
	align-items: center;
	opacity: 0;
	transition: transform var(--mds-sidebar-transition), opacity var(--mds-sidebar-fade);
}

.mds-sidebar.is-open .mds-sidebar__accordion-chevron {
	opacity: 1;
	transition-delay: 100ms;
}

.mds-sidebar__middle.is-legal-open .mds-sidebar__accordion-chevron {
	transform: rotate(180deg);
}

.mds-sidebar__legal-overlay {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: var(--mds-sidebar-legal-bar-h);
	z-index: 2;
	display: flex;
	flex-direction: column;
	min-height: 0;
	background: var(--mds-sidebar-bg);
}

.mds-sidebar__legal-overlay[hidden] {
	display: none !important;
}

.mds-sidebar__legal-scroll {
	flex: 1;
	min-height: 0;
	overflow-y: auto;
	overflow-x: hidden;
	padding: 8px 0;
	scrollbar-width: thin;
	scrollbar-color: var(--mds-sidebar-bd) transparent;
	-webkit-overflow-scrolling: touch;
}

.mds-sidebar__legal-scroll::-webkit-scrollbar {
	width: 4px;
}

.mds-sidebar__legal-scroll::-webkit-scrollbar-thumb {
	background: var(--mds-sidebar-bd);
	border-radius: 4px;
}

.mds-sidebar__legal-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.mds-sidebar__legal-list .mds-sidebar__item {
	margin: 2px 0;
}

.mds-sidebar__link--no-icon {
	gap: 0;
}

.mds-sidebar__legal-list .mds-sidebar__link--no-icon .mds-sidebar__label {
	opacity: 1;
}

.mds-sidebar__middle.is-legal-open .mds-sidebar__middle-pane {
	visibility: hidden;
	pointer-events: none;
}

/* Collapsed sidebar: fade labels (layout stays fixed — clipped by sidebar width) */
.mds-sidebar:not(.is-open) .mds-sidebar__middle-pane .mds-sidebar__label,
.mds-sidebar:not(.is-open) .mds-sidebar__legal-bar .mds-sidebar__label,
.mds-sidebar:not(.is-open) .mds-sidebar__bottom .mds-sidebar__label {
	opacity: 0;
	flex: 0 0 0;
	max-width: 0;
	width: 0;
	min-width: 0;
	padding: 0;
	margin: 0;
	transition-delay: 0ms;
}

.mds-sidebar:not(.is-open) .mds-sidebar__link,
.mds-sidebar:not(.is-open) .mds-sidebar__accordion-toggle {
	width: 100%;
	max-width: 100%;
}

.mds-sidebar:not(.is-open) .mds-sidebar__accordion-chevron {
	opacity: 0;
	pointer-events: none;
}

.mds-sidebar:not(.is-open) .mds-sidebar__brand {
	opacity: 0;
	width: 0;
	max-width: 0;
	flex: 0 0 0;
	min-width: 0;
	pointer-events: none;
	transition-delay: 0ms;
}

.mds-sidebar:not(.is-open) .mds-sidebar__item.is-active > .mds-sidebar__link::before,
.mds-sidebar:not(.is-open) .mds-sidebar__item.is-active > .mds-sidebar__accordion-toggle::before {
	display: none;
}

/* Legal overlay labels always visible when panel is open */
.mds-sidebar__legal-overlay .mds-sidebar__link--no-icon .mds-sidebar__label {
	opacity: 1;
	flex: 1;
	width: auto;
	min-width: 0;
	max-width: none;
	padding: 0;
	margin: 0;
}

.mds-sidebar__item {
	margin: 2px 0;
}

/* ---- Links — fixed row height prevents vertical jump on expand/collapse ---- */
.mds-sidebar__link {
	display: flex;
	align-items: center;
	gap: 12px;
	min-height: var(--mds-sidebar-row-h);
	height: var(--mds-sidebar-row-h);
	padding: 0 var(--mds-sidebar-pad-x);
	box-sizing: border-box;
	border-radius: var(--mds-sidebar-radius);
	color: var(--mds-sidebar-text);
	text-decoration: none;
	white-space: nowrap;
	transition: background var(--mds-sidebar-transition), color var(--mds-sidebar-transition);
	overflow: hidden;
}

.mds-sidebar__link:hover {
	background: var(--mds-sidebar-hover-bg);
	color: var(--mds-sidebar-text-act);
	text-decoration: none;
}

.mds-sidebar__item.is-active > .mds-sidebar__link,
.mds-sidebar__item.is-active > .mds-sidebar__accordion-toggle {
	position: relative;
	background: var(--mds-sidebar-act-bg);
	color: var(--mds-sidebar-text-act);
	font-weight: 600;
}
.mds-sidebar__item.is-active > .mds-sidebar__link .mds-sidebar__icon,
.mds-sidebar__item.is-active > .mds-sidebar__link .mds-sidebar__label,
.mds-sidebar__item.is-active > .mds-sidebar__accordion-toggle .mds-sidebar__icon,
.mds-sidebar__item.is-active > .mds-sidebar__accordion-toggle .mds-sidebar__label {
	color: var(--mds-sidebar-text-act);
}
/* Accent indicator bar on the left edge of the active item */
.mds-sidebar__item.is-active > .mds-sidebar__link::before,
.mds-sidebar__item.is-active > .mds-sidebar__accordion-toggle::before {
	content: "";
	position: absolute;
	left: 0;
	top: 50%;
	transform: translateY(-50%);
	width: 3px;
	height: 22px;
	border-radius: 0 3px 3px 0;
	background: var(--mds-sidebar-accent);
}

/* Expanded sidebar — full-width row highlight (nav + secondary links) */
.mds-sidebar.is-open .mds-sidebar__link,
.mds-sidebar.is-open .mds-sidebar__accordion-toggle {
	width: 100%;
	border-radius: 0;
	box-sizing: border-box;
}

.mds-sidebar.is-open .mds-sidebar__item.is-active > .mds-sidebar__link::before,
.mds-sidebar.is-open .mds-sidebar__item.is-active > .mds-sidebar__accordion-toggle::before {
	border-radius: 0;
}

/* ---- Icon ---- */
.mds-sidebar__icon {
	flex: 0 0 var(--mds-sidebar-icon-col);
	width: var(--mds-sidebar-icon-col);
	height: var(--mds-sidebar-icon-col);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 18px;
	line-height: 1;
}

.mds-sidebar__icon svg {
	display: block;
}

/* Iconly: outline by default, bold when parent .is-active */
.mds-sidebar__icon--iconly {
	position: relative;
}

.mds-sidebar__icon-outline,
.mds-sidebar__icon-bold,
.mds-sidebar__icon-single {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
}

.mds-sidebar__icon-bold {
	display: none;
}

.mds-sidebar__item.is-active .mds-sidebar__icon--iconly .mds-sidebar__icon-bold,
.mds-mobile-tabbar__item.is-active .mds-sidebar__icon--iconly .mds-sidebar__icon-bold {
	display: flex;
}

.mds-sidebar__item.is-active .mds-sidebar__icon--iconly .mds-sidebar__icon-outline,
.mds-mobile-tabbar__item.is-active .mds-sidebar__icon--iconly .mds-sidebar__icon-outline {
	display: none;
}

.mds-sidebar__icon--iconly svg {
	width: 22px;
	height: 22px;
}

.mds-sidebar__toggle-icon svg,
.mds-sidebar__accordion-chevron svg {
	width: 20px;
	height: 20px;
	display: block;
}

.mds-sidebar__accordion-chevron svg {
	width: 16px;
	height: 16px;
}

.mds-sidebar__icon--balance .mds-ai-star {
	width: 18px;
	height: auto;
	color: var(--mds-sidebar-text-act);
}
body.mds-sidebar--dark .mds-sidebar__balance .mds-ai-star,
body.mds-sidebar--dark .mds-sidebar__icon--balance .mds-ai-star {
	color: var(--mds-sidebar-text-act);
}
body.mds-sidebar--light .mds-sidebar__balance .mds-ai-star {
	color: var(--mds-sidebar-accent);
}

html.mds-light body.mds-theme-page .mds-sidebar__balance .mds-ai-star,
html.mds-light body.mds-theme-page .mds-sidebar__icon--balance .mds-ai-star,
body.mds-light.mds-theme-page .mds-sidebar__balance .mds-ai-star,
body.mds-light.mds-theme-page .mds-sidebar__icon--balance .mds-ai-star {
	color: var(--theme-color-text_link, var(--mds-sidebar-accent));
}

.mds-sidebar__icon .mds-sidebar__avatar {
	display: block;
	flex-shrink: 0;
	width: 24px;
	height: 24px;
	border-radius: 50%;
	object-fit: cover;
	margin: 0;
}

/* ---- Label — hidden until open ---- */
.mds-sidebar__label {
	font-size: 13.5px;
	font-weight: 500;
	opacity: 0;
	transition: opacity var(--mds-sidebar-fade);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	flex: 1 1 auto;
	min-width: 0;
	max-width: 0;
}

.mds-sidebar.is-open .mds-sidebar__label {
	opacity: 1;
	max-width: none;
	transition-delay: 100ms;
}

/* ---- Bottom: balance + account ---- */
.mds-sidebar__bottom {
	padding: 8px 0 14px;
	border-top: 1px solid var(--mds-sidebar-bd);
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.mds-sidebar__balance {
	display: flex;
	align-items: center;
	gap: 12px;
	min-height: var(--mds-sidebar-row-h);
	height: var(--mds-sidebar-row-h);
	padding: 0 var(--mds-sidebar-pad-x);
	box-sizing: border-box;
	border-radius: var(--mds-sidebar-radius);
	color: var(--mds-sidebar-accent);
	font-weight: 700;
	text-decoration: none;
	overflow: hidden;
	white-space: nowrap;
	transition: background var(--mds-sidebar-transition);
	width: 100%;
}

.mds-sidebar__balance:hover {
	background: var(--mds-sidebar-hover-bg);
	text-decoration: none;
}

.mds-sidebar__balance-val {
	font-size: 15px;
	font-weight: 700;
	color: var(--mds-sidebar-accent);
}

/* Dark sidebar: balance reads better in white, not purple */
body.mds-sidebar--dark .mds-sidebar__balance,
body.mds-sidebar--dark .mds-sidebar__balance .mds-sidebar__icon,
body.mds-sidebar--dark .mds-sidebar__balance-val {
	color: var(--mds-sidebar-text-act);
}

/* ---- Mobile tab bar (separate from sidebar drawer) ---- */
.mds-mobile-tabbar {
	display: none;
}

/* ---- Page offset — push main content right ---- */
/* Only target the outermost wrapper to avoid double-padding on nested .body_wrap */
.has-mds-sidebar .page_wrap {
	padding-left: var(--mds-sidebar-w) !important;
	transition: padding-left var(--mds-sidebar-transition);
	box-sizing: border-box;
}

/* When sidebar is manually pinned open */
.has-mds-sidebar.sidebar-pinned .page_wrap {
	padding-left: var(--mds-sidebar-w-open) !important;
}

/* Full-width tool pages: sidebar width only. CMS / Elementor pages get an extra gutter. */
@media (min-width: 768px) {
	html.mds-sidebar-pref-open .mds-sidebar {
		width: var(--mds-sidebar-w-open);
	}

	html.mds-sidebar-pref-open body.has-mds-sidebar .page_wrap {
		padding-left: var(--mds-sidebar-w-open) !important;
	}

	body.has-mds-sidebar:not(.mds-tool-page):not(.mds-chat-page):not(.mds-login-page):not(.mds-content-narrow):not(:has(.mds-seo-landing)) .page_content_wrap {
		padding-left: var(--mds-cms-gutter);
		padding-right: var(--mds-cms-gutter);
		box-sizing: border-box;
	}

	body.has-mds-sidebar.sidebar-pinned:not(.mds-tool-page):not(.mds-chat-page):not(.mds-login-page):not(.mds-content-narrow):not(:has(.mds-seo-landing)) .page_content_wrap,
	html.mds-sidebar-pref-open body.has-mds-sidebar:not(.mds-tool-page):not(.mds-chat-page):not(.mds-login-page):not(.mds-content-narrow):not(:has(.mds-seo-landing)) .page_content_wrap {
		padding-left: var(--mds-cms-gutter-open);
		padding-right: var(--mds-cms-gutter-open);
	}
}

/* ---- Mobile: off-screen drawer + bottom tab bar ---- */
@media (max-width: 767px) {
	.mds-mobile-tabbar__item {
		flex: 1;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		gap: 3px;
		padding: 6px 4px 8px;
		color: var(--mds-sidebar-text);
		text-decoration: none;
		background: transparent;
		border: none;
		cursor: pointer;
		font-family: inherit;
		position: relative;
		min-width: 0;
	}

	.mds-mobile-tabbar__item.is-active {
		color: var(--mds-sidebar-accent);
	}

	.mds-mobile-tabbar__item.is-active::before {
		content: "";
		position: absolute;
		top: 0;
		left: 50%;
		transform: translateX(-50%);
		width: 28px;
		height: 3px;
		border-radius: 0 0 3px 3px;
		background: var(--mds-sidebar-accent);
	}

	.mds-mobile-tabbar__icon,
	.mds-mobile-tabbar__item .mds-sidebar__icon {
		display: flex;
		align-items: center;
		justify-content: center;
		flex: 0 0 24px;
		width: 24px;
		height: 24px;
		min-width: 24px;
		max-width: 24px;
		min-height: 24px;
		max-height: 24px;
	}

	.mds-mobile-tabbar__icon .mds-sidebar__icon-outline,
	.mds-mobile-tabbar__icon .mds-sidebar__icon-bold,
	.mds-mobile-tabbar__item .mds-sidebar__icon .mds-sidebar__icon-outline,
	.mds-mobile-tabbar__item .mds-sidebar__icon .mds-sidebar__icon-bold {
		width: 24px;
		height: 24px;
	}

	.mds-mobile-tabbar__icon svg,
	.mds-mobile-tabbar__icon.mds-sidebar__icon--iconly svg {
		width: 20px;
		height: 20px;
	}

	.mds-mobile-tabbar__label {
		flex: 0 0 auto;
		font-size: 10px;
		font-weight: 500;
		line-height: 1.2;
		text-align: center;
		overflow: hidden;
		text-overflow: ellipsis;
		max-width: 100%;
		white-space: nowrap;
	}

	.mds-mobile-tabbar__menu.is-active {
		color: var(--mds-sidebar-accent);
	}

	/* Sidebar: full-viewport drawer over header + tab bar */
	.mds-sidebar {
		position: fixed !important;
		top: 0 !important;
		left: 0 !important;
		right: auto;
		bottom: 0 !important;
		width: min(100%, 300px) !important;
		max-width: 100%;
		height: 100dvh !important;
		max-height: 100dvh;
		flex-direction: column;
		border-right: 1px solid var(--mds-sidebar-bd);
		border-top: none;
		transform: translateX(-100%);
		transition: transform var(--mds-sidebar-transition);
		will-change: transform;
		box-sizing: border-box;
		padding-bottom: env(safe-area-inset-bottom, 0px);
	}

	/* Logo row — same height as app header */
	.mds-sidebar__mobile-head {
		display: flex;
		align-items: center;
		flex-shrink: 0;
		min-height: var(--mds-app-header-h);
		height: var(--mds-app-header-h);
		padding: 0 12px;
		box-sizing: border-box;
		border-bottom: 1px solid var(--mds-sidebar-bd);
	}

	.mds-sidebar__brand--drawer {
		opacity: 1 !important;
		width: auto !important;
		max-width: 100% !important;
		pointer-events: auto;
	}

	.mds-sidebar__brand--drawer .mds-sidebar__logo {
		height: var(--mds-sidebar-logo-h);
		max-height: var(--mds-sidebar-logo-h);
	}

	/* Profile / Sign In — card, no divider; extra space before nav */
	.mds-sidebar__mobile-profile {
		display: flex;
		align-items: center;
		gap: 12px;
		flex-shrink: 0;
		margin: 20px 12px 36px;
		padding: 14px 16px;
		border: 1px solid color-mix(in srgb, var(--mds-sidebar-accent) 22%, var(--mds-sidebar-bd));
		border-radius: var(--mds-sidebar-radius);
		background: var(--mds-sidebar-act-bg);
		box-shadow: 0 2px 12px color-mix(in srgb, var(--mds-sidebar-bg) 40%, transparent);
		color: var(--mds-sidebar-text-act);
		text-decoration: none;
		transition: background var(--mds-sidebar-transition), border-color var(--mds-sidebar-transition), transform 0.12s ease;
	}

	.mds-sidebar__mobile-profile:hover,
	.mds-sidebar__mobile-profile:focus-visible {
		background: var(--mds-sidebar-hover-bg);
		border-color: color-mix(in srgb, var(--mds-sidebar-accent) 40%, var(--mds-sidebar-bd));
		text-decoration: none;
	}

	.mds-sidebar__mobile-profile:active {
		transform: scale(0.99);
	}

	.mds-sidebar__mobile-profile-avatar {
		width: 44px;
		height: 44px;
		display: flex;
		align-items: center;
		justify-content: center;
		border-radius: 50%;
		overflow: hidden;
		flex-shrink: 0;
		color: var(--mds-sidebar-text);
		background: color-mix(in srgb, var(--mds-sidebar-accent) 18%, var(--mds-sidebar-hover-bg));
		border: 1px solid color-mix(in srgb, var(--mds-sidebar-accent) 30%, transparent);
	}

	.mds-sidebar__mobile-profile-img {
		width: 100%;
		height: 100%;
		object-fit: cover;
		border-radius: 50%;
	}

	.mds-sidebar__mobile-profile-avatar svg {
		width: 24px;
		height: 24px;
	}

	.mds-sidebar__mobile-profile-name {
		font-size: 16px;
		font-weight: 700;
		color: var(--mds-sidebar-text-act);
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
		min-width: 0;
	}

	.mds-sidebar.is-mobile-open {
		transform: translateX(0);
	}

	/* Beat collapsed :not(.is-open) width:0 — Magnific skip can leave is-mobile-open without is-open. */
	.mds-sidebar.is-mobile-open .mds-sidebar__middle-pane .mds-sidebar__label,
	.mds-sidebar.is-mobile-open .mds-sidebar__legal-bar .mds-sidebar__label,
	.mds-sidebar.is-mobile-open .mds-sidebar__bottom .mds-sidebar__label,
	.mds-sidebar.is-mobile-open .mds-sidebar__label,
	.mds-sidebar.is-mobile-open .mds-sidebar__brand {
		opacity: 1;
		flex: 1 1 auto;
		width: auto;
		max-width: none;
		min-width: 0;
		padding: 0;
		margin: 0;
		pointer-events: auto;
	}

	.mds-sidebar.is-mobile-open .mds-sidebar__accordion-chevron {
		opacity: 1;
		pointer-events: auto;
	}

	.mds-sidebar__inner {
		width: 100%;
		min-width: 0;
		max-width: 100%;
		height: 100%;
	}

	.mds-sidebar.is-mobile-open .mds-sidebar__inner {
		overflow: hidden;
		flex-direction: column;
		width: 100%;
		height: 100%;
	}

	.mds-sidebar__middle {
		flex: 1 1 auto;
		min-height: 0;
		overflow: hidden;
	}

	.mds-sidebar__middle-pane {
		flex: 1 1 auto;
		min-height: 0;
		overflow-y: auto;
		overflow-x: hidden;
		-webkit-overflow-scrolling: touch;
	}

	/* Nav rows — full-width active highlight in drawer */
	.mds-sidebar.is-mobile-open .mds-sidebar__nav .mds-sidebar__item,
	.mds-sidebar.is-mobile-open .mds-sidebar__secondary .mds-sidebar__item,
	.mds-sidebar.is-mobile-open .mds-sidebar__middle-bottom .mds-sidebar__item,
	.mds-sidebar.is-mobile-open .mds-sidebar__legal-bar .mds-sidebar__item {
		margin: 0;
	}

	.mds-sidebar.is-mobile-open .mds-sidebar__nav .mds-sidebar__link,
	.mds-sidebar.is-mobile-open .mds-sidebar__secondary .mds-sidebar__link,
	.mds-sidebar.is-mobile-open .mds-sidebar__middle-bottom .mds-sidebar__link,
	.mds-sidebar.is-mobile-open .mds-sidebar__accordion-toggle {
		width: 100%;
		max-width: none;
		border-radius: 0;
		padding-left: 16px;
		padding-right: 16px;
		box-sizing: border-box;
	}

	.mds-sidebar.is-mobile-open .mds-sidebar__middle-bottom,
	.mds-sidebar.is-mobile-open .mds-sidebar__secondary {
		width: 100%;
		box-sizing: border-box;
	}

	.mds-sidebar.is-mobile-open .mds-sidebar__item.is-active > .mds-sidebar__link,
	.mds-sidebar.is-mobile-open .mds-sidebar__item.is-active > .mds-sidebar__accordion-toggle {
		background: var(--mds-sidebar-act-bg);
	}

	.mds-sidebar.is-mobile-open .mds-sidebar__item.is-active > .mds-sidebar__link::before,
	.mds-sidebar.is-mobile-open .mds-sidebar__item.is-active > .mds-sidebar__accordion-toggle::before {
		display: block;
		left: 0;
		top: 0;
		bottom: 0;
		transform: none;
		width: 3px;
		height: 100%;
		border-radius: 0;
	}

	.mds-mobile-tabbar {
		display: flex;
		position: fixed !important;
		bottom: 0 !important;
		left: 0 !important;
		right: 0 !important;
		top: auto !important;
		width: 100%;
		height: calc(var(--mds-mobile-tabbar-h) + env(safe-area-inset-bottom, 0px));
		min-height: var(--mds-mobile-tabbar-h);
		z-index: var(--mds-sidebar-z);
		background: var(--mds-sidebar-bg);
		border-top: 1px solid var(--mds-sidebar-bd);
		align-items: stretch;
		justify-content: space-around;
		padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
		box-sizing: border-box;
	}

	body.sidebar-drawer-open {
		overflow: hidden;
		touch-action: none;
	}

	.has-mds-sidebar .page_wrap {
		padding-left: 0 !important;
		padding-bottom: calc(var(--mds-mobile-tabbar-h) + env(safe-area-inset-bottom, 0px));
	}

	.mds-sidebar__top,
	.mds-sidebar__bottom,
	.mds-sidebar__middle {
		display: flex;
	}

	.mds-sidebar__nav {
		display: block;
		flex: 0 0 auto;
		padding: 0;
	}

	.mds-sidebar:not(.is-mobile-open) .mds-sidebar__item {
		margin: 2px 0;
	}

	.mds-sidebar:not(.is-mobile-open) .mds-sidebar__link {
		flex-direction: row;
		align-items: center;
		justify-content: flex-start;
		gap: 12px;
		min-height: var(--mds-sidebar-row-h);
		height: var(--mds-sidebar-row-h);
		padding: 0 var(--mds-sidebar-pad-x);
		border-radius: var(--mds-sidebar-radius);
	}

	.mds-sidebar .mds-sidebar__label,
	.mds-sidebar .mds-sidebar__brand {
		opacity: 1;
	}

	.mds-sidebar .mds-sidebar__brand {
		width: auto;
	}

	.mds-sidebar .mds-sidebar__middle-bottom,
	.mds-sidebar .mds-sidebar__accordion-toggle .mds-sidebar__label,
	.mds-sidebar .mds-sidebar__accordion-chevron {
		display: flex;
	}

	.mds-sidebar .mds-sidebar__accordion-toggle .mds-sidebar__label {
		display: inline;
	}

	.mds-sidebar__accordion-chevron {
		opacity: 1;
	}

	.mds-sidebar:not(.is-mobile-open) .mds-sidebar__item.is-active > .mds-sidebar__link::before {
		left: 0;
		top: 50%;
		transform: translateY(-50%);
		width: 3px;
		height: 22px;
		border-radius: 0 3px 3px 0;
	}

	.mds-sidebar:not(.is-mobile-open) .mds-sidebar__item.is-active > .mds-sidebar__link {
		background: var(--mds-sidebar-act-bg);
	}

	.mds-sidebar__item.is-active > .mds-sidebar__link .mds-sidebar__icon,
	.mds-sidebar__item.is-active > .mds-sidebar__link .mds-sidebar__label {
		color: var(--mds-sidebar-text-act);
	}

	/* Scrim behind drawer — covers full screen including tab bar */
	.mds-sidebar-scrim {
		display: none;
		position: fixed;
		inset: 0;
		z-index: calc(var(--mds-sidebar-z) - 1);
		background: rgba(0, 0, 0, 0.55);
		backdrop-filter: blur(2px);
	}

	body.sidebar-drawer-open .mds-sidebar-scrim {
		display: block;
	}

	/* Drawer open: sidebar + scrim above app header and bottom tab bar */
	body.sidebar-drawer-open .mds-mobile-tabbar,
	body.sidebar-drawer-open .mds-app-header {
		z-index: calc(var(--mds-sidebar-z) - 2);
		pointer-events: none;
	}

	body.sidebar-drawer-open .mds-sidebar-scrim {
		z-index: calc(var(--mds-sidebar-z) + 1);
	}

	/* Keep drawer above header/scrim for the full slide-out (not only while .is-mobile-open) */
	body.sidebar-drawer-open .mds-sidebar {
		z-index: calc(var(--mds-sidebar-z) + 2);
	}

	.mds-sidebar.is-swiping {
		transition: none;
	}

	body.has-mds-app-header.admin-bar .mds-sidebar {
		top: 46px !important;
		height: calc(100dvh - 46px) !important;
		max-height: calc(100dvh - 46px);
	}
}

/* ---- Tablet: icon-only until burger opens ---- */
@media (min-width: 768px) and (max-width: 1023px) {
	.mds-sidebar.is-open {
		width: var(--mds-sidebar-w-open);
	}
	.mds-sidebar.is-open .mds-sidebar__label,
	.mds-sidebar.is-open .mds-sidebar__brand {
		opacity: 1;
		width: auto;
	}
}

/* ---- Collapsed sidebar: floating label tooltip (icon-only mode) ---- */
.mds-sidebar-tip {
	position: fixed;
	z-index: calc(var(--mds-sidebar-z) + 5);
	pointer-events: none;
	padding: 7px 12px;
	border-radius: 8px;
	font-size: 13px;
	font-weight: 500;
	line-height: 1.25;
	white-space: nowrap;
	color: var(--theme-color-text_dark, #fff);
	background: var(--theme-color-alter_bg_color, #2c2c34);
	border: 1px solid var(--mds-sidebar-bd);
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.28);
	opacity: 0;
	transform: translateY(-50%) translateX(-4px);
	transition: opacity 120ms ease, transform 120ms ease;
}

.mds-sidebar-tip.is-visible {
	opacity: 1;
	transform: translateY(-50%) translateX(0);
}

.mds-sidebar-tip::before {
	content: "";
	position: absolute;
	left: -5px;
	top: 50%;
	width: 10px;
	height: 10px;
	background: var(--theme-color-alter_bg_color, #2c2c34);
	border-left: 1px solid var(--mds-sidebar-bd);
	border-bottom: 1px solid var(--mds-sidebar-bd);
	transform: translateY(-50%) rotate(45deg);
}

html.mds-light body.mds-theme-page .mds-sidebar-tip,
body.mds-light.mds-theme-page .mds-sidebar-tip {
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

@media (prefers-reduced-motion: reduce) {
	.mds-sidebar-tip {
		transition: none;
	}
}

/* ---- Admin bar compensation (desktop) ---- */
@media (min-width: 768px) {
	body.has-mds-app-header.admin-bar .mds-sidebar {
		top: calc(32px + var(--mds-app-header-h));
		height: calc(100vh - 32px - var(--mds-app-header-h));
	}
}

@media (min-width: 768px) and (max-width: 782px) {
	body.has-mds-app-header.admin-bar .mds-sidebar {
		top: calc(46px + var(--mds-app-header-h));
		height: calc(100vh - 46px - var(--mds-app-header-h));
	}
}

/* ---- Hide footer when Theme Options toggle is on ---- */
body.mds-footer-hidden .footer_wrap,
body.mds-footer-hidden footer.footer_wrap,
.mds-tool-page.mds-footer-hidden .footer_wrap {
	display: none !important;
}

/* ---- Hide TRX/Ann top header when Theme Options toggle is on ---- */
body.mds-header-hidden .top_panel,
body.mds-header-hidden header.top_panel,
body.mds-header-hidden .top_panel_wrap,
body.mds-header-hidden .top_panel_fixed_wrap,
body.mds-header-hidden .sc_layouts_row_fixed_on,
body.mds-header-hidden .sc_layouts_row.sc_layouts_row_fixed_on,
body.mds-header-hidden .top_panel_custom {
	display: none !important;
	height: 0 !important;
	min-height: 0 !important;
	overflow: hidden !important;
	visibility: hidden !important;
	pointer-events: none !important;
}

/* Reserve former header height so content stays in place when header is hidden */
body.mds-header-hidden {
	--mds-header-spacer: 5.25rem;
}

body.has-mds-app-header.mds-header-hidden {
	--mds-header-spacer: 0;
}

body.mds-header-hidden .mds-header-spacer {
	display: block;
	height: var(--mds-header-spacer);
	width: 100%;
	flex-shrink: 0;
	pointer-events: none;
}

body.has-mds-app-header.mds-header-hidden .mds-header-spacer {
	display: none !important;
	height: 0 !important;
	min-height: 0 !important;
}

body.mds-header-hidden.mds-header-padding-mode .page_content_wrap,
body.mds-header-hidden.mds-header-padding-mode .page_content_wrap_custom_header_margin {
	padding-top: var(--mds-page-pad-top, 80px) !important;
	margin-top: 0 !important;
}

/* No need to offset a hidden fixed header */
.mds-header-hidden.has-mds-sidebar .sc_layouts_row_fixed_on,
.mds-header-hidden.has-mds-sidebar .top_panel_fixed_wrap .sc_layouts_row_fixed,
.mds-header-hidden.has-mds-sidebar .top_panel.top_panel_fixed,
.mds-header-hidden.has-mds-sidebar .top_panel_fixed {
	left: 0 !important;
	width: 100% !important;
}

/* ---- Scroll to top: keep default right position (do not shift to left) ---- */
.has-mds-sidebar .trx_addons_scroll_to_top,
.has-mds-sidebar #trx_addons_scroll_to_top {
	right: 2em;
	left: auto;
}

@media (max-width: 767px) {
	.has-mds-sidebar .trx_addons_scroll_to_top.show,
	.has-mds-sidebar #trx_addons_scroll_to_top.show {
		bottom: calc(var(--mds-mobile-tabbar-h) + 0.75rem);
	}
}

/* ---- Offset the theme top header so it never sits under the sidebar ----
 * The TRX header can be sticky/fixed full-width; shift its fixed rows right
 * by the collapsed sidebar width (desktop only). The non-fixed header is
 * already offset because it lives inside .page_wrap. */
@media (min-width: 768px) {
	.has-mds-sidebar:not(.mds-header-hidden) .sc_layouts_row_fixed_on,
	.has-mds-sidebar:not(.mds-header-hidden) .top_panel_fixed_wrap .sc_layouts_row_fixed,
	.has-mds-sidebar:not(.mds-header-hidden) .top_panel.top_panel_fixed,
	.has-mds-sidebar:not(.mds-header-hidden) .top_panel_fixed {
		left: var(--mds-sidebar-w) !important;
		width: calc(100% - var(--mds-sidebar-w)) !important;
		transition: left var(--mds-sidebar-transition), width var(--mds-sidebar-transition);
	}

	.has-mds-sidebar.sidebar-pinned:not(.mds-header-hidden) .sc_layouts_row_fixed_on,
	.has-mds-sidebar.sidebar-pinned:not(.mds-header-hidden) .top_panel_fixed_wrap .sc_layouts_row_fixed,
	.has-mds-sidebar.sidebar-pinned:not(.mds-header-hidden) .top_panel.top_panel_fixed,
	.has-mds-sidebar.sidebar-pinned:not(.mds-header-hidden) .top_panel_fixed {
		left: var(--mds-sidebar-w-open) !important;
		width: calc(100% - var(--mds-sidebar-w-open)) !important;
	}
}

/* ---- Mobile toggle button (in main header) ---- */
.mds-sidebar-mobile-toggle {
	display: none;
}

@media (max-width: 767px) {
	.mds-sidebar-mobile-toggle {
		display: flex;
		align-items: center;
		justify-content: center;
		width: 36px;
		height: 36px;
		background: transparent;
		border: none;
		color: var(--theme-color-text, #b0b0c0);
		cursor: pointer;
		border-radius: 6px;
	}
}

button.mds-sidebar__link {
	width: 100%;
	margin: 0;
	-webkit-appearance: none;
	appearance: none;
	background: none;
	border: none;
	cursor: pointer;
	font: inherit;
	text-align: left;
	color: inherit;
}

/* ── Theme toggle button ────────────────────────────────────────────────── */

.mds-theme-toggle {
	/* Reset browser button defaults so it matches .mds-sidebar__link exactly */
	-webkit-appearance: none;
	appearance: none;
	background: none;
	border: none;
	cursor: pointer;
	/* width/box-sizing: let .mds-sidebar__link handle layout */
	width: 100%;
	box-sizing: border-box;
	text-align: left;
	/* DO NOT override padding — inherited from .mds-sidebar__link */
	color: var(--mds-sidebar-text);
	font-family: inherit;
	font-size: inherit;
}

.mds-theme-toggle:hover {
	background: var(--mds-sidebar-hover-bg);
}

/* Icon wrapper: same dimensions as any other .mds-sidebar__icon — no extra rules needed */

/* Dark mode: sun visible (switch to light), moon hidden */
.mds-theme-toggle__sun  { display: block !important; }
.mds-theme-toggle__moon { display: none !important; }

/* Light mode: moon visible (switch to dark), sun hidden */
html.mds-light .mds-theme-toggle__sun  { display: none !important; }
html.mds-light .mds-theme-toggle__moon { display: block !important; }

/* ── Language toggle button ─────────────────────────────────────────────── */

.mds-lang-toggle {
	-webkit-appearance: none;
	appearance: none;
	background: none;
	border: none;
	cursor: pointer;
	width: 100%;
	box-sizing: border-box;
	text-align: left;
	color: var(--mds-sidebar-text);
	font-family: inherit;
	font-size: inherit;
}

.mds-lang-toggle:hover {
	background: var(--mds-sidebar-hover-bg);
}

.mds-lang-toggle__icon-wrap {
	display: flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 var(--mds-sidebar-icon-col);
	width: var(--mds-sidebar-icon-col);
	height: var(--mds-sidebar-icon-col);
	flex-shrink: 0;
}

.mds-lang-toggle__flag {
	display: block;
	width: 22px;
	height: 22px;
	min-width: 22px;
	min-height: 22px;
	max-width: 22px;
	aspect-ratio: 1 / 1;
	border-radius: 50%;
	object-fit: cover;
	object-position: center center;
	flex-shrink: 0;
	user-select: none;
	border: 0;
	padding: 0;
	background: transparent;
	overflow: hidden;
}

/* ── Language picker modal (candy-style grid) ─────────────────────────── */

.mds-lang-modal {
	position: fixed;
	inset: 0;
	z-index: calc(var(--mds-sidebar-z, 100) + 50);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	pointer-events: none;
}

.mds-lang-modal.is-open {
	pointer-events: auto;
}

.mds-lang-modal[hidden] {
	display: none;
}

/* Backdrop + panel share the same opacity timing so close feels as one unit */
.mds-lang-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.58);
	backdrop-filter: blur(6px);
	opacity: 0;
	transition: opacity 0.2s ease;
}

.mds-lang-modal.is-open .mds-lang-modal__backdrop {
	opacity: 1;
}

.mds-lang-modal__panel {
	position: relative;
	width: 100%;
	max-width: 560px;
	background: var(--theme-color-bg_color, var(--mds-bg2, #21212b));
	border: 1px solid var(--mds-border, var(--theme-color-bd_color));
	border-radius: 16px;
	box-shadow: 0 24px 64px rgba(0, 0, 0, 0.42);
	color: var(--mds-text, var(--theme-color-text));
	opacity: 0;
	transform: translateY(10px) scale(0.98);
	transition: opacity 0.2s ease, transform 0.2s ease;
	overflow: hidden;
}

.mds-lang-modal.is-open .mds-lang-modal__panel {
	opacity: 1;
	transform: translateY(0) scale(1);
}

.mds-lang-modal__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 20px 22px 14px;
}

.mds-lang-modal__title {
	margin: 0;
	font-size: 1.15rem;
	font-weight: 700;
	line-height: 1.25;
	color: var(--mds-text-dark, var(--theme-color-text_dark));
}

.mds-lang-modal__close {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	border: none;
	border-radius: var(--mds-radius-sm, 8px);
	background: color-mix(in srgb, var(--theme-color-alter_bg_color, #292933) 70%, transparent);
	color: var(--mds-text-muted, var(--theme-color-text));
	cursor: pointer;
	transition: background 0.15s, color 0.15s;
}

.mds-lang-modal__close:hover {
	background: var(--mds-fill-hover, var(--theme-color-alter_bg_hover));
	color: var(--mds-text-dark, var(--theme-color-text_dark));
}

.mds-lang-modal__body {
	padding: 0 18px 20px;
	max-height: min(70vh, 520px);
	overflow-y: auto;
}

.mds-lang-modal__grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 10px;
	list-style: none;
	margin: 0;
	padding: 0;
}

@media (min-width: 640px) {
	.mds-lang-modal__grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

.mds-lang-modal__item {
	margin: 0;
}

.mds-lang-modal__card {
	display: grid;
	grid-template-columns: auto 1fr auto;
	align-items: center;
	gap: 8px 10px;
	width: 100%;
	min-height: 44px;
	height: auto;
	padding: 10px 12px;
	border: 1px solid var(--mds-border, var(--theme-color-bd_color));
	border-radius: 12px;
	background: color-mix(in srgb, var(--theme-color-alter_bg_color, #292933) 42%, var(--theme-color-bg_color, #21212b));
	color: var(--mds-text-dark, var(--theme-color-text_dark));
	font: inherit;
	text-align: left;
	text-decoration: none;
	box-sizing: border-box;
	cursor: pointer;
	transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.mds-lang-modal__card:hover {
	border-color: var(--theme-color-alter_bd_color);
	background: color-mix(in srgb, var(--theme-color-alter_bg_color, #292933) 62%, var(--theme-color-bg_color, #21212b));
}

.mds-lang-modal__card.is-active {
	border-color: color-mix(in srgb, var(--theme-color-text_link, var(--mds-accent)) 55%, var(--theme-color-bd_color));
	background: color-mix(in srgb, var(--theme-color-text_link, var(--mds-accent)) 10%, var(--theme-color-bg_color, #21212b));
	box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--theme-color-text_link, var(--mds-accent)) 18%, transparent);
}

.mds-lang-modal__flag {
	font-size: 1.15rem;
	line-height: 1;
	flex-shrink: 0;
}

.mds-lang-modal__name {
	display: block;
	min-width: 0;
	font-size: 0.84rem;
	font-weight: 600;
	line-height: 1.2;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: clip;
}

.mds-lang-modal__check {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 18px;
	height: 18px;
	color: var(--theme-color-text_link, var(--mds-accent));
	opacity: 0;
	transform: scale(0.85);
	transition: opacity 0.15s ease, transform 0.15s ease;
}

.mds-lang-modal__card.is-active .mds-lang-modal__check {
	opacity: 1;
	transform: scale(1);
}

html.mds-light .mds-lang-modal__panel {
	box-shadow: 0 20px 50px rgba(0, 0, 0, 0.14);
}

html.mds-light .mds-lang-modal__card {
	background: var(--theme-color-bg_color);
}

html.mds-light .mds-lang-modal__card:hover {
	background: var(--theme-color-alter_bg_hover);
}

/* ── Contact / feedback modal ─────────────────────────────────────────── */

.mds-contact-modal__panel {
	max-width: 440px;
}

.mds-contact-modal .mds-lang-modal__head {
	padding: 24px 28px 10px;
}

.mds-contact-modal .mds-lang-modal__body {
	padding: 4px 28px 28px;
}

.mds-contact-modal__lead {
	margin: 0 0 18px;
	font-size: 0.92rem;
	line-height: 1.4;
	color: var(--theme-color-text);
}

.mds-contact-form {
	display: flex;
	flex-direction: column;
	gap: 14px;
}

.mds-contact-form__hp {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

.mds-contact-form__field {
	display: flex;
	flex-direction: column;
	gap: 6px;
	margin: 0;
}

.mds-contact-form__label {
	font-size: 0.82rem;
	font-weight: 600;
	color: var(--theme-color-text_dark);
}

.mds-contact-modal .mds-contact-form__field input[type="text"],
.mds-contact-modal .mds-contact-form__field input[type="email"],
.mds-contact-modal .mds-contact-form__field textarea {
	width: 100%;
	min-height: 44px;
	padding: 11px 14px;
	border: 1px solid var(--theme-color-bd_color);
	border-radius: var(--mds-radius, 12px);
	background: var(--theme-color-alter_bg_color);
	color: var(--theme-color-text_dark);
	font: inherit;
	font-size: 0.92rem;
	line-height: 1.35;
	box-sizing: border-box;
	appearance: none;
	-webkit-appearance: none;
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.mds-contact-modal .mds-contact-form__field textarea {
	min-height: 120px;
	resize: vertical;
}

.mds-contact-modal .mds-contact-form__field input::placeholder,
.mds-contact-modal .mds-contact-form__field textarea::placeholder {
	color: color-mix(in srgb, var(--theme-color-text) 48%, transparent);
	opacity: 1;
}

.mds-contact-modal .mds-contact-form__field input:focus,
.mds-contact-modal .mds-contact-form__field textarea:focus {
	outline: none;
	border-color: color-mix(in srgb, var(--theme-color-text_link) 55%, var(--theme-color-bd_color));
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--theme-color-text_link) 14%, transparent);
}

.mds-contact-form__submit {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	margin-top: 4px;
	margin-right: 0;
	width: 100%;
	min-height: 44px;
	text-align: center;
}

.mds-contact-form__submit .sc_button_text,
.mds-contact-form__submit .sc_button_title {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	text-align: center;
}

.mds-contact-form.is-sending .mds-contact-form__submit {
	opacity: 0.65;
	pointer-events: none;
}

@media (max-width: 767px) {
	.mds-contact-modal__panel {
		max-width: 100%;
	}

	.mds-contact-modal .mds-lang-modal__head {
		padding: 22px 22px 8px;
	}

	.mds-contact-modal .mds-lang-modal__body {
		padding: 4px 22px 22px;
	}
}

html.mds-modal-open,
body.mds-modal-open {
	overflow: hidden;
}

/* ── Light theme — CSS token overrides (MDS pages only) ─────────────────── */
/*
 * Target both html.mds-light and body.mds-light so the class applied in <head>
 * (to <html>) works before body exists, and the body class works after JS loads.
 * Scoped to .has-mds-sidebar so non-MDS pages are untouched.
 */

html.mds-light body.mds-theme-page,
body.mds-light.mds-theme-page {
	/* ─ Theme bridge (ann theme vars) ─ */
	--theme-color-bg_color:       #f2f2f6;
	--theme-color-alter_bg_color: #ffffff;
	--theme-color-alter_bg_hover: #e6e6ed;
	--theme-color-text:            #1e1e30;
	--theme-color-text_dark:       #0a0a18;
	--theme-color-text_light:      #55556b;
	--theme-color-bd_color:        rgba(0, 0, 0, 0.11);
	--theme-color-alter_bd_color:  rgba(0, 0, 0, 0.07);
	--theme-color-inverse_text:    #ffffff;

	/* ─ MDS direct token overrides ─ */
	--mds-bg:            #f2f2f6;
	--mds-bg2:           #ffffff;
	--mds-bg3:           #e6e6ed;
	--mds-text:          #1e1e30;
	--mds-text-dark:     #0a0a18;
	--mds-text-muted:    #55556b;
	--mds-bd:            rgba(0, 0, 0, 0.11);
	--mds-bd-alt:        rgba(0, 0, 0, 0.07);
	--mds-surface-glass: rgba(255, 255, 255, 0.92);
	--mds-fill-muted:    rgba(0, 0, 0, 0.05);
	--mds-fill-hover:    rgba(0, 0, 0, 0.09);
	--mds-overlay:       rgba(255, 255, 255, 0.80);
	--mds-on-accent:     #ffffff;
	--mds-bg-input:      #ececf4;
	--mds-bg-dropzone:   #e6e6ee;

	background-color: #f2f2f6;
}

/* Page / wrap surfaces */
html.mds-light body.mds-theme-page .page_content_wrap,
html.mds-light body.mds-theme-page .page_wrap,
html.mds-light body.mds-theme-page .content_wrap,
body.mds-light.mds-theme-page .page_content_wrap,
body.mds-light.mds-theme-page .page_wrap,
body.mds-light.mds-theme-page .content_wrap {
	background-color: #f2f2f6 !important;
	color: #1e1e30;
}

/* Input fields, textareas, selects */
html.mds-light body.mds-theme-page input:not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="checkbox"]):not([type="radio"]),
html.mds-light body.mds-theme-page textarea,
html.mds-light body.mds-theme-page select,
body.mds-light.mds-theme-page input:not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="checkbox"]):not([type="radio"]),
body.mds-light.mds-theme-page textarea,
body.mds-light.mds-theme-page select {
	background-color: var(--mds-bg-input, #ececf4) !important;
	color: #1e1e30 !important;
	border-color: rgba(0, 0, 0, 0.18) !important;
	border-radius: var(--mds-radius-sm) !important;
	padding: 10px 14px !important;
}

html.mds-light body.mds-theme-page input.mds-gallery__search,
html.mds-light body.mds-theme-page input.mds-explore__search,
html.mds-light body.mds-theme-page input.mds-sp__search,
body.mds-light.mds-theme-page input.mds-gallery__search,
body.mds-light.mds-theme-page input.mds-explore__search,
body.mds-light.mds-theme-page input.mds-sp__search {
	border-radius: var(--mds-radius-pill) !important;
	padding: 9px 16px !important;
}

html.mds-light body.mds-theme-page textarea.mds-chat__input,
body.mds-light.mds-theme-page textarea.mds-chat__input {
	border: none !important;
	padding: 11px 14px !important;
	background: var(--mds-bg-input, #ececf4) !important;
	color: #1e1e30 !important;
}

/* Studio prompt is flush inside .mds-igen__prompt-box — not a nested input card */
html.mds-light body.mds-theme-page textarea.mds-igen__prompt,
body.mds-light.mds-theme-page textarea.mds-igen__prompt {
	background: transparent !important;
	background-color: transparent !important;
	border: 0 !important;
	border-radius: 0 !important;
	padding: 14px 44px 10px 14px !important;
	box-shadow: none !important;
}

html.mds-light body.mds-theme-page input::placeholder,
html.mds-light body.mds-theme-page textarea::placeholder,
body.mds-light.mds-theme-page input::placeholder,
body.mds-light.mds-theme-page textarea::placeholder {
	color: #8888a0 !important;
}

/* Studio prompt textarea (TRX custom element) */
html.mds-light body.mds-theme-page .sc_igenerator_form_field_prompt_text,
body.mds-light.mds-theme-page .sc_igenerator_form_field_prompt_text {
	background: var(--mds-bg-input, #ececf4) !important;
	color: #1e1e30 !important;
	border-color: rgba(0,0,0,.15) !important;
}

/* Dropzones — Video, FaceSwap, Image Editor */
html.mds-light body.mds-theme-page .mds-video__dropzone,
html.mds-light body.mds-theme-page .mds-edit__dropzone,
html.mds-light body.mds-theme-page [class*="__dz"],
body.mds-light.mds-theme-page .mds-video__dropzone,
body.mds-light.mds-theme-page .mds-edit__dropzone,
body.mds-light.mds-theme-page [class*="__dz"] {
	background: var(--mds-bg-dropzone, #e6e6ee) !important;
	border-color: rgba(0,0,0,.14) !important;
}

/* TRX igenerator form areas */
html.mds-light body.mds-theme-page .sc_igenerator,
html.mds-light body.mds-theme-page .sc_igenerator_form,
html.mds-light body.mds-theme-page .sc_igenerator_form_field_image_wrap,
html.mds-light body.mds-theme-page .sc_igenerator_form_field_image_inner,
body.mds-light.mds-theme-page .sc_igenerator,
body.mds-light.mds-theme-page .sc_igenerator_form,
body.mds-light.mds-theme-page .sc_igenerator_form_field_image_wrap,
body.mds-light.mds-theme-page .sc_igenerator_form_field_image_inner {
	background: var(--mds-bg-dropzone, #e6e6ee) !important;
	border-color: rgba(0,0,0,.10) !important;
}

html.mds-light body.mds-theme-page .mds-gen__left,
html.mds-light body.mds-theme-page .mds-gen__center,
body.mds-light.mds-theme-page .mds-gen__left,
body.mds-light.mds-theme-page .mds-gen__center {
	background: #ffffff !important;
}

/* CTA cost badge */
html.mds-light body.mds-theme-page .mds-cta-cost,
body.mds-light.mds-theme-page .mds-cta-cost {
	background: rgba(0, 0, 0, 0.14);
}

/* Gallery filter dropdowns */
html.mds-light body.mds-theme-page .mds-gallery__dropdown-toggle,
body.mds-light.mds-theme-page .mds-gallery__dropdown-toggle {
	color: #0a0a18;
	background: #e8e8f0;
	border-color: rgba(0,0,0,0.15);
}

html.mds-light body.mds-theme-page .mds-gallery__dropdown-menu,
body.mds-light.mds-theme-page .mds-gallery__dropdown-menu {
	background: #ffffff;
	border-color: rgba(0,0,0,0.12);
}

html.mds-light body.mds-theme-page .mds-gallery__dropdown-option,
body.mds-light.mds-theme-page .mds-gallery__dropdown-option {
	color: #3a3a50;
}

html.mds-light body.mds-theme-page .mds-gallery__dropdown-option.is-active,
body.mds-light.mds-theme-page .mds-gallery__dropdown-option.is-active,
html.mds-light body.mds-theme-page .mds-gallery__dropdown-option:hover,
body.mds-light.mds-theme-page .mds-gallery__dropdown-option:hover {
	color: #0a0a18;
	background: #e8e8f0;
}

html.mds-light body.mds-theme-page .mds-gallery__search,
body.mds-light.mds-theme-page .mds-gallery__search {
	background: var(--mds-bg-input, #ececf4);
	color: #1e1e30;
}

/* Chat hub (position: fixed — explicit bg needed) */
html.mds-light body.mds-theme-page .mds-chat-hub,
body.mds-light.mds-theme-page .mds-chat-hub {
	background: #f2f2f6;
}

html.mds-light body.mds-theme-page .mds-chat-hub__sidebar,
body.mds-light.mds-theme-page .mds-chat-hub__sidebar {
	background: #e8e8ef;
	border-color: rgba(0,0,0,0.09);
}

html.mds-light body.mds-theme-page .mds-chat__log,
html.mds-light body.mds-theme-page .mds-chat__compose,
body.mds-light.mds-theme-page .mds-chat__log,
body.mds-light.mds-theme-page .mds-chat__compose {
	background: #ffffff;
}

html.mds-light body.mds-theme-page .mds-chat__input,
body.mds-light.mds-theme-page .mds-chat__input {
	background: #f4f4f8 !important;
	color: #1e1e30 !important;
}

/* Account cards */
html.mds-light body.mds-theme-page .mds-dash__card,
html.mds-light body.mds-theme-page .mds-dash__tile,
body.mds-light.mds-theme-page .mds-dash__card,
body.mds-light.mds-theme-page .mds-dash__tile {
	background: #ffffff;
	border-color: rgba(0,0,0,0.09);
}

/* Shell chrome — light theme variant (scoped to theme pages only) */
html.mds-light body.mds-theme-page .mds-sidebar,
html.mds-light body.mds-theme-page .mds-app-header,
html.mds-light body.mds-theme-page .mds-mobile-tabbar,
body.mds-light.mds-theme-page .mds-sidebar,
body.mds-light.mds-theme-page .mds-app-header,
body.mds-light.mds-theme-page .mds-mobile-tabbar {
	--mds-sidebar-bg:       #eaeaf2;
	--mds-sidebar-bd:       rgba(0, 0, 0, 0.08);
	--mds-sidebar-text:     #55556b;
	--mds-sidebar-text-act: #0a0a18;
	--mds-sidebar-hover-bg: rgba(0, 0, 0, 0.06);
	--mds-sidebar-act-bg:   rgba(136, 102, 255, 0.12);
	--mds-sidebar-accent:   var(--theme-color-text_link, #8866ff);
}

/* Light theme — active filled (bold) icon uses primary accent */
html.mds-light body.mds-theme-page .mds-sidebar__item.is-active .mds-sidebar__icon--iconly .mds-sidebar__icon-bold,
body.mds-light.mds-theme-page .mds-sidebar__item.is-active .mds-sidebar__icon--iconly .mds-sidebar__icon-bold,
html.mds-light body.mds-theme-page .mds-mobile-tabbar__item.is-active .mds-sidebar__icon--iconly .mds-sidebar__icon-bold,
body.mds-light.mds-theme-page .mds-mobile-tabbar__item.is-active .mds-sidebar__icon--iconly .mds-sidebar__icon-bold {
	color: var(--mds-sidebar-accent);
}

/* ── Dark theme — ann scheme tokens only (no hardcoded palette) ─────────── */

html:not(.mds-light) body.mds-theme-page,
body.mds-theme-page:not(.mds-light) {
	/* MDS bridge — ann scheme; softened surfaces via color-mix (no extra_bg jumps) */
	--mds-bg:            var(--theme-color-bg_color);
	--mds-bg2:           color-mix(in srgb, var(--theme-color-alter_bg_color) 48%, var(--theme-color-bg_color));
	--mds-bg3:           var(--theme-color-alter_bg_hover);
	--mds-bg-input:      color-mix(in srgb, var(--theme-color-alter_bg_color) 32%, var(--theme-color-bg_color));
	--mds-bg-dropzone:   color-mix(in srgb, var(--theme-color-alter_bg_color) 18%, var(--theme-color-bg_color));
	--mds-text:          var(--theme-color-text);
	--mds-text-dark:     var(--theme-color-text_dark);
	--mds-text-muted:    var(--theme-color-text_light);
	--mds-bd:            var(--theme-color-alter_bd_color, var(--theme-color-bd_color));
	--mds-bd-alt:        color-mix(in srgb, var(--theme-color-alter_bd_color, var(--theme-color-bd_color)) 65%, transparent);
	--mds-fill-muted:    color-mix(in srgb, var(--theme-color-text) 5%, transparent);
	--mds-fill-hover:    var(--theme-color-alter_bg_hover);
	--mds-overlay:       color-mix(in srgb, var(--theme-color-bg_color) 72%, transparent);
	--mds-on-accent:     var(--theme-color-inverse_text, #fff);

	background-color: var(--theme-color-bg_color);
}

html:not(.mds-light) body.mds-theme-page .page_content_wrap,
html:not(.mds-light) body.mds-theme-page .page_wrap,
html:not(.mds-light) body.mds-theme-page .content_wrap,
body.mds-theme-page:not(.mds-light) .page_content_wrap,
body.mds-theme-page:not(.mds-light) .page_wrap,
body.mds-theme-page:not(.mds-light) .content_wrap {
	background-color: var(--theme-color-bg_color) !important;
	color: var(--theme-color-text);
}

/* Shell chrome — alter_bg from scheme (subtle step above workspace) */
html:not(.mds-light) body.mds-theme-page .mds-sidebar,
html:not(.mds-light) body.mds-theme-page .mds-app-header,
html:not(.mds-light) body.mds-theme-page .mds-mobile-tabbar,
body.mds-theme-page:not(.mds-light) .mds-sidebar,
body.mds-theme-page:not(.mds-light) .mds-app-header,
body.mds-theme-page:not(.mds-light) .mds-mobile-tabbar {
	--mds-sidebar-bg:       var(--theme-color-alter_bg_color);
	--mds-sidebar-bd:       var(--theme-color-alter_bd_color, var(--theme-color-bd_color));
	--mds-sidebar-text:     var(--theme-color-text);
	--mds-sidebar-text-act: var(--theme-color-text_dark);
	--mds-sidebar-hover-bg: var(--theme-color-alter_bg_hover);
	--mds-sidebar-act-bg:   color-mix(in srgb, var(--theme-color-text_link) 12%, transparent);
	--mds-sidebar-accent:   var(--theme-color-text_link);
}

/* Studio tool surfaces — tab bar + cards above workspace */
html:not(.mds-light) body.mds-theme-page .mds-studio__tabs,
html:not(.mds-light) body.mds-theme-page .mds-studio__notice,
html:not(.mds-light) body.mds-theme-page .mds-edit__slot,
html:not(.mds-light) body.mds-theme-page .mds-gen__left,
html:not(.mds-light) body.mds-theme-page .mds-gen__center,
html:not(.mds-light) body.mds-theme-page .sc_igenerator,
html:not(.mds-light) body.mds-theme-page .sc_igenerator_form,
body.mds-theme-page:not(.mds-light) .mds-studio__tabs,
body.mds-theme-page:not(.mds-light) .mds-studio__notice,
body.mds-theme-page:not(.mds-light) .mds-edit__slot,
body.mds-theme-page:not(.mds-light) .mds-gen__left,
body.mds-theme-page:not(.mds-light) .mds-gen__center,
body.mds-theme-page:not(.mds-light) .sc_igenerator,
body.mds-theme-page:not(.mds-light) .sc_igenerator_form {
	background: var(--mds-bg2);
	border-color: var(--mds-bd);
}

/* Recessed inputs + dropzones — soft tint, not extra_bg */
html:not(.mds-light) body.mds-theme-page .mds-video__dropzone,
html:not(.mds-light) body.mds-theme-page .mds-edit__dropzone,
html:not(.mds-light) body.mds-theme-page .mds-edit__slot,
html:not(.mds-light) body.mds-theme-page [class*="__dz"],
body.mds-theme-page:not(.mds-light) .mds-video__dropzone,
body.mds-theme-page:not(.mds-light) .mds-edit__dropzone,
body.mds-theme-page:not(.mds-light) .mds-edit__slot,
body.mds-theme-page:not(.mds-light) [class*="__dz"] {
	background: var(--mds-bg-dropzone) !important;
	border-color: var(--mds-bd-alt) !important;
}

html:not(.mds-light) body.mds-theme-page input:not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="checkbox"]):not([type="radio"]),
html:not(.mds-light) body.mds-theme-page textarea,
html:not(.mds-light) body.mds-theme-page select,
html:not(.mds-light) body.mds-theme-page .sc_igenerator_form_field_prompt_text,
html:not(.mds-light) body.mds-theme-page .sc_igenerator_form_field_negative_prompt_text,
body.mds-theme-page:not(.mds-light) input:not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="checkbox"]):not([type="radio"]),
body.mds-theme-page:not(.mds-light) textarea,
body.mds-theme-page:not(.mds-light) select,
body.mds-theme-page:not(.mds-light) .sc_igenerator_form_field_prompt_text,
body.mds-theme-page:not(.mds-light) .sc_igenerator_form_field_negative_prompt_text {
	background: var(--mds-bg-input) !important;
	border-color: var(--mds-bd-alt) !important;
}

html:not(.mds-light) body.mds-theme-page .sc_igenerator_form_field_image_wrap,
html:not(.mds-light) body.mds-theme-page .sc_igenerator_form_field_image_inner,
body.mds-theme-page:not(.mds-light) .sc_igenerator_form_field_image_wrap,
body.mds-theme-page:not(.mds-light) .sc_igenerator_form_field_image_inner {
	background: var(--mds-bg-dropzone) !important;
	border-color: var(--mds-bd-alt) !important;
}

/* Account + gallery cards */
html:not(.mds-light) body.mds-theme-page .mds-dash__card,
html:not(.mds-light) body.mds-theme-page .mds-dash__tile,
html:not(.mds-light) body.mds-theme-page .mds-gallery__dropdown-menu,
body.mds-theme-page:not(.mds-light) .mds-dash__card,
body.mds-theme-page:not(.mds-light) .mds-dash__tile,
body.mds-theme-page:not(.mds-light) .mds-gallery__dropdown-menu {
	background: var(--mds-bg2);
	border-color: var(--mds-bd);
}

html:not(.mds-light) body.mds-theme-page .mds-gallery__dropdown-toggle,
body.mds-theme-page:not(.mds-light) .mds-gallery__dropdown-toggle {
	background: var(--mds-bg3);
	border-color: var(--mds-bd);
	color: var(--mds-text-dark);
}

html:not(.mds-light) body.mds-theme-page .mds-gallery__dropdown-option:hover,
html:not(.mds-light) body.mds-theme-page .mds-gallery__dropdown-option.is-active,
body.mds-theme-page:not(.mds-light) .mds-gallery__dropdown-option:hover,
body.mds-theme-page:not(.mds-light) .mds-gallery__dropdown-option.is-active {
	background: var(--mds-fill-hover);
	color: var(--mds-text-dark);
}

/* Chat hub */
html:not(.mds-light) body.mds-theme-page .mds-chat-hub,
body.mds-theme-page:not(.mds-light) .mds-chat-hub {
	background: var(--mds-bg);
}

html:not(.mds-light) body.mds-theme-page .mds-chat-hub__sidebar,
body.mds-theme-page:not(.mds-light) .mds-chat-hub__sidebar {
	background: var(--theme-color-alter_bg_color);
	border-color: var(--theme-color-alter_bd_color, var(--theme-color-bd_color));
}

html:not(.mds-light) body.mds-theme-page .mds-chat__log,
html:not(.mds-light) body.mds-theme-page .mds-chat__compose,
body.mds-theme-page:not(.mds-light) .mds-chat__log,
body.mds-theme-page:not(.mds-light) .mds-chat__compose {
	background: var(--mds-bg2);
}
