.ect-message-launcher {
	position: fixed;
	right: 24px;
	bottom: 24px;
	z-index: 9990;
	display: inline-flex;
	align-items: center;
	gap: 10px;
	min-height: 52px;
	padding: 11px 17px 11px 13px;
	border: 1px solid rgba(255, 255, 255, 0.2);
	border-radius: 999px;
	background: #183f66;
	box-shadow: 0 12px 30px rgba(22, 40, 59, 0.24);
	color: #fff;
	font: 600 14px/1.3 var(--ec-font, "Montserrat", sans-serif);
	cursor: pointer;
}

.ect-message-launcher:hover {
	background: #2e6f9f;
	transform: translateY(-1px);
}

.ect-message-launcher[aria-expanded="true"] {
	background: #2e6f9f;
}

.ect-message-launcher:focus-visible,
.ect-message-dialog button:focus-visible {
	outline: 3px solid #d9b468;
	outline-offset: 3px;
}

.ect-message-launcher__icon {
	display: grid;
	width: 30px;
	height: 30px;
	place-items: center;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.14);
}

.ect-message-launcher__icon svg {
	width: 19px;
	height: 19px;
	fill: none;
	stroke: currentColor;
	stroke-linecap: round;
	stroke-linejoin: round;
	stroke-width: 1.8;
}

.ect-message-launcher__count {
	display: grid;
	min-width: 23px;
	height: 23px;
	padding: 0 6px;
	place-items: center;
	border-radius: 999px;
	background: #d9b468;
	color: #16283b;
	font-size: 12px;
	font-weight: 700;
}

.ect-message-dialog {
	width: min(420px, calc(100vw - 32px));
	height: min(760px, calc(100dvh - 40px));
	max-width: none;
	max-height: none;
	margin: auto 20px 20px auto;
	padding: 0;
	overflow: hidden;
	border: 1px solid #cbd7df;
	border-radius: 16px;
	background: #fff;
	box-shadow: 0 24px 70px rgba(17, 39, 59, 0.3);
	font-family: var(--ec-font, "Montserrat", sans-serif);
}

.ect-message-dialog::backdrop {
	background: rgba(14, 31, 47, 0.42);
	backdrop-filter: blur(2px);
}

.ect-message-dialog[open] {
	display: grid;
	grid-template-rows: auto auto minmax(0, 1fr);
}

.ect-message-dialog__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	min-height: 76px;
	padding: 14px 16px 13px 20px;
	background: #183f66;
	color: #fff;
}

.ect-message-dialog__actions {
	display: flex;
	flex: 0 0 auto;
	align-items: center;
	gap: 8px;
}

.ect-message-dialog__expand {
	display: inline-flex;
	min-height: 40px;
	align-items: center;
	gap: 7px;
	padding: 0 11px;
	border: 1px solid rgba(255, 255, 255, 0.26);
	border-radius: 8px;
	color: #fff !important;
	font-size: 11px;
	font-weight: 700;
	line-height: 1.2;
	text-decoration: none !important;
}

.ect-message-dialog__expand:hover {
	background: rgba(255, 255, 255, 0.12);
}

.ect-message-dialog__expand:focus-visible {
	outline: 3px solid #d9b468;
	outline-offset: 3px;
}

.ect-message-dialog__expand svg {
	width: 17px;
	height: 17px;
	fill: none;
	stroke: currentColor;
	stroke-linecap: round;
	stroke-linejoin: round;
	stroke-width: 1.8;
}

.ect-message-dialog__header p,
.ect-message-dialog__header h2 {
	margin: 0;
	color: inherit;
}

.ect-message-dialog__header p {
	margin-bottom: 3px;
	color: #dbe8f1;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
}

.ect-message-dialog__header h2 {
	font-size: 19px;
	line-height: 1.25;
}

.ect-message-dialog__header .ect-message-dialog__close {
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.12);
	color: #fff;
	font: 300 31px/1 Arial, sans-serif;
	cursor: pointer;
}

.ect-message-dialog__status {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	min-height: 38px;
	padding: 8px 20px;
	border-bottom: 1px solid #d8e1e8;
	background: #f6f8fa;
	color: #50657a;
	font-size: 12px;
	font-weight: 600;
	line-height: 1.45;
}

.ect-message-dialog__status span {
	flex: 0 0 auto;
	width: 8px;
	height: 8px;
	margin-top: 4px;
	border-radius: 50%;
	background: #4b836c;
}

.ect-message-dialog iframe {
	width: 100%;
	height: 100%;
	border: 0;
	background: #f4f6f8;
}

html.ect-messages-open {
	overflow: hidden;
}

.ect-messaging-page {
	width: min(1120px, calc(100% - 40px));
	margin: 0 auto;
	padding: 54px 0 64px;
	font-family: var(--ec-font, "Montserrat", sans-serif);
	color: #16283b;
}

.ect-messaging-page__intro {
	max-width: 760px;
	margin-bottom: 24px;
}

.ect-messaging-page__eyebrow {
	margin: 0 0 8px;
	color: #2e6f9f;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
}

.ect-messaging-page__intro h1 {
	margin: 0 0 10px;
	color: #183f66;
	font-size: clamp(28px, 4vw, 42px);
	line-height: 1.12;
}

.ect-messaging-page__intro > p:last-child {
	margin: 0;
	color: #607184;
	font-size: 16px;
	line-height: 1.65;
}

.ect-presence {
	margin: 0 0 16px;
	padding: 14px 16px;
	border: 1px solid #cbd7df;
	border-radius: 12px;
	background: #fff;
	box-shadow: 0 8px 22px rgba(22, 40, 59, 0.08);
}

.ect-presence__heading {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
}

.ect-presence__eyebrow,
.ect-presence__heading h2 {
	margin: 0;
}

.ect-presence__eyebrow {
	margin-bottom: 2px;
	color: #607184;
	font-size: 10px;
	font-weight: 700;
	letter-spacing: 0.1em;
	text-transform: uppercase;
}

.ect-presence__heading h2 {
	color: #183f66;
	font-size: 16px;
	line-height: 1.3;
}

.ect-presence__count {
	display: inline-flex;
	min-height: 30px;
	align-items: center;
	gap: 7px;
	padding: 5px 10px;
	border-radius: 999px;
	background: #edf6f1;
	color: #315f4d;
	font-size: 11px;
	font-weight: 700;
	white-space: nowrap;
}

.ect-presence__count > span {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: #2d8a62;
	box-shadow: 0 0 0 3px rgba(45, 138, 98, 0.14);
}

.ect-presence__list {
	display: grid;
	max-height: 194px;
	margin: 12px 0 0;
	padding: 0;
	overflow: auto;
	list-style: none;
	border-top: 1px solid #e2e8ed;
}

.ect-presence__student {
	display: flex;
	min-width: 0;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 10px 0;
	border-bottom: 1px solid #edf1f4;
}

.ect-presence__student:last-child {
	border-bottom: 0;
}

.ect-presence__identity {
	display: flex;
	min-width: 0;
	align-items: center;
	gap: 10px;
}

.ect-presence__identity > span:last-child {
	display: grid;
	min-width: 0;
	gap: 2px;
}

.ect-presence__identity strong,
.ect-presence__identity small {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.ect-presence__identity strong {
	color: #16283b;
	font-size: 13px;
	line-height: 1.3;
}

.ect-presence__identity small {
	max-width: 255px;
	color: #607184;
	font-size: 10px;
	line-height: 1.35;
}

.ect-presence__identity .ect-presence__status {
	color: #50657a;
	font-weight: 600;
}

.ect-presence__avatar {
	position: relative;
	flex: 0 0 40px;
	width: 40px;
	height: 40px;
}

.ect-presence__avatar-image {
	display: block;
	width: 40px;
	height: 40px;
	border-radius: 50%;
}

.ect-presence__avatar.is-online::after {
	position: absolute;
	right: -1px;
	bottom: 1px;
	width: 10px;
	height: 10px;
	border: 2px solid #fff;
	border-radius: 50%;
	background: #2d8a62;
	content: "";
}

.ect-presence__student form {
	flex: 0 0 auto;
	margin: 0;
}

.ect-presence__student button {
	min-height: 36px;
	padding: 7px 12px;
	border: 1px solid #2e6f9f;
	border-radius: 8px;
	background: #fff;
	color: #1e5e8c;
	font: 700 11px/1.2 var(--ec-font, "Montserrat", sans-serif);
	cursor: pointer;
}

.ect-presence__student button:hover {
	background: #2e6f9f;
	color: #fff;
}

.ect-presence__student button:focus-visible {
	outline: 3px solid #d9b468;
	outline-offset: 2px;
}

.ect-presence__empty {
	margin: 11px 0 0;
	color: #607184;
	font-size: 12px;
	line-height: 1.5;
}

.ect-messaging-page__panel {
	overflow: hidden;
	border: 1px solid #cbd7df;
	border-radius: 14px;
	background: #fff;
	box-shadow: 0 14px 36px rgba(22, 40, 59, 0.1);
}

.ect-messaging-page__panel .bp-messages-wrap,
.ect-messaging-page__panel .bp-messages-single-thread-wrap {
	min-height: 520px;
	border: 0 !important;
	border-radius: 0 !important;
	font-family: var(--ec-font, "Montserrat", sans-serif) !important;
}

.ect-messaging-page__panel button,
.ect-messaging-page__panel input,
.ect-messaging-page__panel textarea {
	font-family: var(--ec-font, "Montserrat", sans-serif) !important;
}

.ect-messaging-page__privacy {
	margin: 15px 4px 0;
	color: #607184;
	font-size: 12px;
	line-height: 1.55;
}

.ect-messaging-notice {
	width: min(760px, calc(100% - 40px));
	margin: 60px auto;
	padding: 20px;
	border: 1px solid #dfc993;
	border-left: 4px solid #a87927;
	border-radius: 8px;
	background: #fbf7ed;
	color: #5d4723;
	font-family: var(--ec-font, "Montserrat", sans-serif);
}

body.ect-student-messages-embed {
	min-height: 100%;
	background: #f4f6f8 !important;
}

body.extension-courses-app.ect-student-messages-embed .ec-site-header[data-ect-app-header],
body.extension-courses-app.ect-student-messages-embed .ec-site-footer,
body.ect-student-messages-embed #wpadminbar {
	display: none !important;
}

body.ect-student-messages-embed .ect-messaging-page {
	width: 100%;
	height: 100vh;
	min-height: 0;
	margin: 0;
	padding: 0;
	display: flex;
	overflow: hidden;
	flex-direction: column;
}

body.ect-student-messages-embed .ect-messaging-page__intro,
body.ect-student-messages-embed .ect-messaging-page__privacy {
	display: none;
}

body.ect-student-messages-embed .ect-messaging-page__panel {
	min-height: 0;
	flex: 1 1 auto;
	border: 0;
	border-radius: 0;
	box-shadow: none;
}

body.ect-student-messages-embed .ect-messaging-page__panel .bp-messages-wrap,
body.ect-student-messages-embed .ect-messaging-page__panel .bp-messages-single-thread-wrap {
	height: 100% !important;
	min-height: 0;
}

body.ect-student-messages-embed .ect-presence {
	margin: 0;
	padding: 11px 14px;
	border-width: 0 0 1px;
	border-radius: 0;
	box-shadow: none;
}

body.ect-student-messages-embed .ect-presence__list {
	max-height: 126px;
	margin-top: 9px;
}

body.ect-student-messages-embed .ect-presence__student {
	padding: 8px 0;
}

@media (max-width: 700px) {
	.ect-message-launcher {
		right: 14px;
		bottom: 14px;
		max-width: calc(100vw - 28px);
		min-height: 50px;
		padding-right: 15px;
	}

	.ect-message-dialog {
		width: 100vw;
		height: min(82dvh, 760px);
		margin: auto 0 0;
		border-width: 1px 0 0;
		border-radius: 18px 18px 0 0;
		box-shadow: 0 -18px 50px rgba(17, 39, 59, 0.28);
	}

	.ect-message-dialog__header {
		min-height: 70px;
		padding: 11px 12px 10px 16px;
	}

	.ect-message-dialog__header h2 {
		font-size: 16px;
	}

	.ect-message-dialog__expand {
		width: 42px;
		padding: 0;
		justify-content: center;
	}

	.ect-message-dialog__expand span {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip: rect(0 0 0 0);
		clip-path: inset(50%);
		white-space: nowrap;
	}

	.ect-messaging-page {
		width: min(100% - 24px, 1120px);
		padding: 32px 0 44px;
	}

	.ect-messaging-page__panel .bp-messages-wrap,
	.ect-messaging-page__panel .bp-messages-single-thread-wrap {
		min-height: 560px;
	}

	.ect-presence {
		padding: 12px;
	}

	.ect-presence__heading {
		align-items: flex-start;
		gap: 10px;
	}

	.ect-presence__count {
		min-height: 28px;
		padding: 4px 8px;
	}

	.ect-presence__identity small {
		max-width: 170px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.ect-message-launcher {
		transition: none;
	}
}
