.lh-student-portal__view:has(.lh-portal-messages--chat) {
	display: flex;
	flex-direction: column;
	min-height: 0;
}

.lh-portal-messages--chat {
	display: flex;
	flex: 1;
	flex-direction: column;
	margin-top: 0;
	min-height: min(72vh, 680px);
}

.lh-portal-messages--student-page {
	flex: 1;
	min-height: 0;
}

.lh-portal-messages--student-page .lh-portal-messages__chat {
	min-height: min(78vh, 720px);
}

.lh-portal-messages__header {
	flex-shrink: 0;
	margin-bottom: 0.75rem;
}

.lh-portal-messages__header h3 {
	margin: 0 0 0.35rem;
}

.lh-portal-messages .description {
	color: #6b625c;
	font-size: 0.88rem;
	margin: 0;
}

.lh-portal-messages__error {
	color: #8b3a3a;
	font-size: 0.88rem;
	margin: 0 0 0.65rem;
}

.lh-portal-messages__chat {
	background: #fff;
	border: 1px solid #e8e2da;
	border-radius: 14px;
	box-shadow: 0 8px 28px rgb(50 35 25 / 0.05);
	display: flex;
	flex: 1;
	flex-direction: column;
	min-height: 0;
	overflow: hidden;
}

.lh-portal-messages__scroll {
	flex: 1;
	min-height: 0;
	overflow-y: auto;
	padding: 1rem 1rem 0.5rem;
	scroll-behavior: smooth;
}

.lh-portal-messages__empty {
	color: #6b625c;
	margin: 2rem 0;
	text-align: center;
}

.lh-portal-messages__thread {
	display: flex;
	flex-direction: column;
	gap: 0.65rem;
	list-style: none;
	margin: 0;
	padding: 0;
}

.lh-portal-messages__item {
	display: flex;
	margin: 0;
	max-width: 100%;
}

.lh-portal-messages__item--student {
	justify-content: flex-end;
}

.lh-portal-messages__item--tutor {
	justify-content: flex-start;
}

.lh-portal-messages__bubble {
	background: #faf8f5;
	border-radius: 14px 14px 14px 4px;
	box-shadow: 0 1px 2px rgb(50 35 25 / 0.06);
	max-width: min(100%, 34rem);
	padding: 0.65rem 0.85rem;
}

.lh-portal-messages__item--student .lh-portal-messages__bubble {
	background: #eef3f8;
	border-radius: 14px 14px 4px 14px;
}

.lh-portal-messages__item.is-unread .lh-portal-messages__bubble {
	box-shadow: inset 0 0 0 1px #7a3e48;
}

.lh-portal-messages__meta {
	align-items: baseline;
	display: flex;
	flex-wrap: wrap;
	gap: 0.35rem 0.65rem;
	justify-content: space-between;
	margin: 0 0 0.35rem;
}

.lh-portal-messages__meta time {
	color: #6b625c;
	font-size: 0.78rem;
}

.lh-portal-messages__body {
	font-size: 0.95rem;
	line-height: 1.55;
	margin: 0;
	word-break: break-word;
}

.lh-portal-messages__body p {
	margin: 0 0 0.5rem;
}

.lh-portal-messages__body p:last-child {
	margin-bottom: 0;
}

.lh-portal-messages__attachment {
	margin-top: 0.45rem;
}

.lh-portal-messages__attachment-image {
	border-radius: 10px;
	display: block;
	max-height: 16rem;
	max-width: 100%;
	object-fit: cover;
}

.lh-portal-messages__attachment-video {
	border-radius: 10px;
	display: block;
	max-height: 16rem;
	max-width: 100%;
}

.lh-portal-messages__attachment audio,
.lh-portal-messages__attachment video {
	max-width: 100%;
	width: min(100%, 20rem);
}

.lh-portal-messages__attachment-file {
	color: #7a3e48;
	font-weight: 600;
	text-decoration: none;
	word-break: break-all;
}

.lh-portal-messages__attachment-file:hover,
.lh-portal-messages__attachment-file:focus-visible {
	text-decoration: underline;
}

.lh-portal-messages__composer {
	background: #faf8f5;
	border-top: 1px solid #e8e2da;
	flex-shrink: 0;
	padding: 0.65rem 0.75rem 0.75rem;
}

.lh-portal-messages__preview[hidden],
.lh-portal-messages__emoji-panel[hidden] {
	display: none !important;
}

.lh-portal-messages__preview:not([hidden]) {
	align-items: center;
	background: #fff;
	border: 1px solid #e8e2da;
	border-radius: 10px;
	display: flex;
	gap: 0.65rem;
	margin-bottom: 0.55rem;
	padding: 0.45rem 0.55rem;
}

.lh-portal-messages__preview-inner {
	align-items: center;
	display: flex;
	flex: 1;
	gap: 0.65rem;
	min-width: 0;
}

.lh-portal-messages__preview-inner img,
.lh-portal-messages__preview-inner video {
	border-radius: 8px;
	max-height: 4.5rem;
	max-width: 5rem;
	object-fit: cover;
}

.lh-portal-messages__preview-name {
	color: #222;
	font-size: 0.88rem;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.lh-portal-messages__preview-clear {
	background: transparent;
	border: 0;
	color: #6b625c;
	cursor: pointer;
	font-size: 1.35rem;
	line-height: 1;
	padding: 0.15rem 0.35rem;
}

.lh-portal-messages__emoji-panel:not([hidden]) {
	background: #fff;
	border: 1px solid #e8e2da;
	border-radius: 12px;
	box-shadow: 0 6px 20px rgb(50 35 25 / 0.08);
	margin-bottom: 0.55rem;
	padding: 0.45rem;
}

.lh-portal-messages__emoji-grid {
	display: grid;
	gap: 0.15rem;
	grid-template-columns: repeat(auto-fill, minmax(2rem, 1fr));
}

.lh-portal-messages__emoji {
	background: transparent;
	border: 0;
	border-radius: 8px;
	cursor: pointer;
	font-size: 1.25rem;
	line-height: 1.4;
	padding: 0.2rem;
}

.lh-portal-messages__emoji:hover,
.lh-portal-messages__emoji:focus-visible {
	background: #f3ecee;
}

.lh-portal-messages__input-row {
	align-items: center;
	display: grid;
	gap: 0.45rem;
	grid-template-columns: auto 1fr auto;
}

.lh-portal-messages__toolbar {
	align-items: center;
	display: flex;
	flex-wrap: wrap;
	gap: 0.15rem;
}

.lh-portal-messages__tool {
	align-items: center;
	background: transparent;
	border: 0;
	border-radius: 999px;
	color: #6b625c;
	cursor: pointer;
	display: inline-flex;
	height: 2.25rem;
	justify-content: center;
	padding: 0;
	width: 2.25rem;
}

.lh-portal-messages__tool:hover,
.lh-portal-messages__tool:focus-visible {
	background: #f3ecee;
	color: #7a3e48;
}

.lh-portal-messages__tool.is-active,
.lh-portal-messages__tool.is-recording {
	background: #7a3e48;
	color: #fff;
}

.lh-portal-messages__tool.is-listening {
	background: #7a3e48;
	color: #fff;
}

.lh-portal-messages__composer textarea {
	background: #fff;
	border: 1px solid #e8e2da;
	border-radius: 18px;
	display: block;
	font: inherit;
	line-height: 1.45;
	margin: 0;
	max-height: 8rem;
	min-height: 2.5rem;
	overflow-y: hidden;
	padding: 0.55rem 0.85rem;
	resize: none;
	width: 100%;
}

.lh-portal-messages__composer textarea:focus {
	border-color: #7a3e48;
	box-shadow: 0 0 0 2px rgb(122 62 72 / 0.12);
	outline: none;
}

.lh-portal-messages__send {
	align-items: center;
	background: #7a3e48;
	border: 0;
	border-radius: 50%;
	box-shadow: none;
	color: #fff;
	cursor: pointer;
	display: inline-flex;
	flex-shrink: 0;
	height: 2.5rem;
	justify-content: center;
	margin: 0;
	padding: 0;
	width: 2.5rem;
}

.lh-portal-messages__send svg {
	margin-left: 1px;
}

.lh-portal-messages__send:hover,
.lh-portal-messages__send:focus-visible {
	background: #683540;
	color: #fff;
}

.lh-portal-messages__send:disabled {
	cursor: not-allowed;
	opacity: 0.55;
}

.lh-portal-messages--tutor {
	border-top: 1px solid #e8e2da;
	margin-top: 2rem;
	padding-top: 1.5rem;
}

.lh-portal-messages--tutor .lh-portal-messages__chat {
	background: #fff;
}

@media (max-width: 640px) {
	.lh-portal-messages--chat {
		min-height: min(68vh, 620px);
	}

	.lh-portal-messages__input-row {
		grid-template-areas:
			'input send'
			'toolbar toolbar';
		grid-template-columns: 1fr auto;
	}

	.lh-portal-messages__toolbar {
		grid-area: toolbar;
	}

	.lh-portal-messages__composer textarea {
		grid-area: input;
	}

	.lh-portal-messages__send {
		grid-area: send;
	}
}

@media (min-width: 641px) {
	.lh-portal-messages__input-row {
		grid-template-areas: 'toolbar input send';
		grid-template-columns: auto 1fr auto;
	}

	.lh-portal-messages__toolbar {
		grid-area: toolbar;
	}

	.lh-portal-messages__composer textarea {
		grid-area: input;
	}

	.lh-portal-messages__send {
		grid-area: send;
	}
}
