/* Messages dashboard */
.tm-messages-shell {
	display: grid;
	grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
	gap: 0;
	min-height: 28rem;
	background: #fff;
	border: 1px solid var(--tm-c-border, #e2e8f0);
	border-radius: 14px;
	overflow: hidden;
	box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
}

@media (max-width: 800px) {
	.tm-messages-shell {
		grid-template-columns: 1fr;
		min-height: 0;
	}
	.tm-messages-shell.is-thread-open .tm-messages-list-pane {
		display: none;
	}
	.tm-messages-shell:not(.is-thread-open) .tm-messages-thread-pane {
		display: none;
	}
	.tm-messages-list-pane {
		min-height: 18rem;
		border-right: 0;
	}
}

.tm-messages-list-pane {
	border-right: 1px solid var(--tm-c-border, #e2e8f0);
	background: #f8fafc;
	display: flex;
	flex-direction: column;
	min-height: 22rem;
}

.tm-messages-list-pane__head {
	padding: 0.85rem 1rem;
	font-weight: 700;
	font-size: 0.9rem;
	border-bottom: 1px solid var(--tm-c-border, #e2e8f0);
	color: #0f172a;
}

.tm-messages-list {
	overflow-y: auto;
	flex: 1;
	max-height: 32rem;
}

.tm-messages-item {
	display: block;
	width: 100%;
	text-align: left;
	border: 0;
	border-bottom: 1px solid var(--tm-c-border, #e2e8f0);
	background: transparent;
	padding: 0.85rem 1rem;
	cursor: pointer;
	font: inherit;
	color: inherit;
}

.tm-messages-item:hover,
.tm-messages-item.is-active {
	background: rgba(20, 184, 166, 0.1);
}

.tm-messages-item__title {
	font-weight: 700;
	font-size: 0.92rem;
	color: #0f172a;
	margin: 0 0 0.2rem;
}

.tm-messages-item__meta {
	font-size: 0.78rem;
	color: #64748b;
	margin: 0 0 0.25rem;
}

.tm-messages-item__preview {
	font-size: 0.82rem;
	color: #475569;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.tm-messages-item__badge {
	display: inline-block;
	margin-left: 0.35rem;
	min-width: 1.25rem;
	padding: 0.05rem 0.4rem;
	border-radius: 999px;
	background: #0d9488;
	color: #fff;
	font-size: 0.72rem;
	font-weight: 700;
	text-align: center;
}

.tm-messages-thread-pane {
	display: flex;
	flex-direction: column;
	min-height: 22rem;
	background: #fff;
}

.tm-messages-empty {
	margin: auto;
	padding: 2rem;
	text-align: center;
	color: #64748b;
	font-size: 0.95rem;
}

.tm-messages-thread {
	display: flex;
	flex-direction: column;
	height: 100%;
	min-height: 22rem;
}

.tm-messages-thread__head {
	padding: 0.85rem 1.1rem;
	border-bottom: 1px solid var(--tm-c-border, #e2e8f0);
	background: linear-gradient(180deg, #eef6f9, #f8fafc);
}

.tm-messages-back {
	display: none;
	border: 0;
	background: transparent;
	color: #0f766e;
	font: inherit;
	font-weight: 600;
	font-size: 0.85rem;
	padding: 0 0 0.35rem;
	cursor: pointer;
	text-align: left;
}

@media (max-width: 800px) {
	.tm-messages-back {
		display: inline-block;
	}
}

.tm-messages-thread__title {
	font-weight: 700;
	font-size: 1rem;
	color: #0f172a;
}

.tm-messages-thread__sub {
	font-size: 0.82rem;
	color: #64748b;
	margin-top: 0.15rem;
}

.tm-messages-bubbles {
	flex: 1;
	overflow-y: auto;
	padding: 1rem;
	display: flex;
	flex-direction: column;
	gap: 0.65rem;
	max-height: 24rem;
	background: #f8fafc;
}

.tm-msg-bubble {
	max-width: min(85%, 28rem);
	padding: 0.65rem 0.85rem;
	border-radius: 12px;
	font-size: 0.92rem;
	line-height: 1.45;
	white-space: pre-wrap;
	word-break: break-word;
}

.tm-msg-bubble--mine {
	align-self: flex-end;
	background: linear-gradient(135deg, #14b8a6, #0d9488);
	color: #fff;
	border-bottom-right-radius: 4px;
}

.tm-msg-bubble--theirs {
	align-self: flex-start;
	background: #fff;
	border: 1px solid var(--tm-c-border, #e2e8f0);
	color: #0f172a;
	border-bottom-left-radius: 4px;
}

.tm-msg-bubble__time {
	display: block;
	margin-top: 0.35rem;
	font-size: 0.72rem;
	opacity: 0.75;
}

.tm-messages-compose {
	display: flex;
	flex-wrap: wrap;
	gap: 0.65rem;
	align-items: flex-end;
	padding: 0.85rem 1rem;
	border-top: 1px solid var(--tm-c-border, #e2e8f0);
	background: #fff;
}

.tm-messages-compose textarea {
	flex: 1 1 12rem;
	min-height: 2.75rem;
	padding: 0.55rem 0.7rem;
	border: 1px solid var(--tm-c-border, #e2e8f0);
	border-radius: 10px;
	font: inherit;
	resize: vertical;
}

.tm-messages-status {
	margin: 0;
	padding: 0 1rem 0.65rem;
	font-size: 0.82rem;
	color: #b91c1c;
	min-height: 1.1rem;
}

.tm-tuition-connect {
	margin-top: 1.25rem;
}

.tm-tuition-connect__bar {
	margin-top: 0;
}

.tm-tuition-connect__bar .tm-muted {
	color: rgba(248, 250, 252, 0.78);
}

.tm-tuition-connect__bar .tm-muted a {
	color: #5eead4;
	font-weight: 600;
}

.tm-tuition-connect__bar-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.65rem;
	align-items: center;
	justify-content: flex-end;
}

.tm-tuition-connect__bar .tm-login-submit,
.tm-tuition-connect__bar a.tm-login-submit {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	min-height: 44px;
	height: 44px;
	padding: 0 1.25rem;
	line-height: 1.2;
	text-decoration: none;
	min-width: 0;
	white-space: nowrap;
	vertical-align: middle;
}

.tm-tuition-connect .tm-teacher-profile-view__reco-panel .tm-register-form__fieldset-label {
	color: rgba(248, 250, 252, 0.88);
}
