/* =========================================================
   站内消息 am_message
   只依赖 bootstrap 4 的基本类和颜色变量，不绑定具体主题
   ========================================================= */

.am-tabbar {
	display: flex;
	align-items: center;
	gap: 6px;
	flex-wrap: wrap;
}

.am-tab {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 5px 14px;
	font-size: 14px;
	color: #6c757d;
	background: #f4f4f5;
	border-radius: 16px;
	text-decoration: none;
	transition: background .15s, color .15s;
}

.am-tab:hover {
	background: #ebebee;
	color: #343a40;
	text-decoration: none;
}

.am-tab.is-active {
	background: #343a40;
	color: #fff;
}

.am-tab .am-count {
	min-width: 18px;
	height: 18px;
	padding: 0 5px;
	font-size: 11px;
	line-height: 18px;
	text-align: center;
	color: #fff;
	background: #dc3545;
	border-radius: 9px;
}

.am-tab.is-active .am-count {
	background: rgba(255, 255, 255, .25);
}

/* ---------------- 通知列表 ---------------- */

.am-noticelist {
	list-style: none;
	margin: 0;
	padding: 0;
}

.am-notice {
	display: flex;
	gap: 12px;
	padding: 14px 2px;
	border-bottom: 1px solid #f0f0f1;
}

.am-notice:last-child {
	border-bottom: 0;
}

.am-notice.is-unread {
	background: #fbfaf8;
}

.am-notice-avatar {
	flex: 0 0 36px;
}

.am-notice-avatar img {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	object-fit: cover;
	background: #e9ecef;
}

.am-notice-avatar .am-sysicon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	font-size: 16px;
	color: #fff;
	background: #4c6ef5;
	border-radius: 50%;
}

.am-notice-main {
	flex: 1;
	min-width: 0;
}

.am-notice-head {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
	font-size: 13px;
	color: #868e96;
}

.am-notice-name {
	font-weight: 600;
	color: #343a40;
}

.am-notice-type {
	padding: 1px 7px;
	font-size: 11px;
	color: #5c7cfa;
	background: #edf2ff;
	border-radius: 8px;
}

.am-notice-type.is-reply { color: #0b7285; background: #e3fafc; }
.am-notice-type.is-quote { color: #6741d9; background: #f3f0ff; }
.am-notice-type.is-admin { color: #c92a2a; background: #fff5f5; }

.am-notice-dot {
	width: 7px;
	height: 7px;
	background: #dc3545;
	border-radius: 50%;
}

.am-notice-subject {
	margin: 4px 0 2px;
	font-size: 14.5px;
	font-weight: 600;
	color: #343a40;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.am-notice-body {
	font-size: 13.5px;
	line-height: 1.6;
	color: #495057;
	word-break: break-word;
}

.am-notice-foot {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-top: 6px;
	font-size: 12.5px;
}

.am-notice-foot a {
	color: #5c7cfa;
}

.am-link-muted {
	color: #adb5bd;
	background: none;
	border: 0;
	padding: 0;
	cursor: pointer;
}

.am-link-muted:hover {
	color: #868e96;
}

/* ---------------- 私信会话列表 ---------------- */

.am-sessions {
	list-style: none;
	margin: 0;
	padding: 0;
}

.am-session {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 13px 2px;
	border-bottom: 1px solid #f0f0f1;
	color: inherit;
	text-decoration: none;
}

.am-session:last-child { border-bottom: 0; }
.am-session:hover { background: #fbfaf8; text-decoration: none; color: inherit; }

.am-session img {
	width: 42px;
	height: 42px;
	border-radius: 50%;
	object-fit: cover;
	background: #e9ecef;
}

.am-session-main { flex: 1; min-width: 0; }

.am-session-top {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 10px;
}

.am-session-name {
	font-size: 14.5px;
	font-weight: 600;
	color: #343a40;
}

.am-session-date {
	font-size: 12px;
	color: #adb5bd;
	flex: none;
}

.am-session-last {
	margin-top: 2px;
	font-size: 13px;
	color: #868e96;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.am-session-unread {
	flex: none;
	min-width: 18px;
	height: 18px;
	padding: 0 5px;
	font-size: 11px;
	line-height: 18px;
	text-align: center;
	color: #fff;
	background: #dc3545;
	border-radius: 9px;
}

/* ---------------- 对话页 ---------------- */

.am-chat-head {
	display: flex;
	align-items: center;
	gap: 10px;
	padding-bottom: 12px;
	margin-bottom: 4px;
	border-bottom: 1px solid #f0f0f1;
}

.am-chat-head img {
	width: 34px;
	height: 34px;
	border-radius: 50%;
	object-fit: cover;
	background: #e9ecef;
}

.am-chat-head b { font-size: 14.5px; color: #343a40; }

.am-chat-scroll {
	/* 固定高度：消息再少也不塌，再多也不撑高，只在框内滚 */
	height: 460px;
	display: flex;
	flex-direction: column;
	overflow-y: auto;
	padding: 14px 2px 6px;
	scroll-behavior: smooth;
	overscroll-behavior: contain;
}

/* 消息少的时候贴底堆叠（和聊天软件一致），而不是浮在顶部 */
.am-chat-scroll > .am-msg:first-child { margin-top: auto; }

/* 还没聊过：图标和文字在框内居中 */
.am-chat-scroll > .am-empty { margin: auto; padding: 0; }

.am-msg {
	display: flex;
	gap: 10px;
	margin-bottom: 14px;
}

.am-msg img {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	object-fit: cover;
	background: #e9ecef;
	flex: none;
}

.am-msg-main { max-width: 76%; }

.am-msg-meta {
	font-size: 12px;
	color: #adb5bd;
	margin-bottom: 3px;
}

.am-bubble {
	padding: 9px 13px;
	font-size: 14px;
	line-height: 1.65;
	color: #343a40;
	background: #f4f4f5;
	border-radius: 4px 12px 12px 12px;
	word-break: break-word;
	white-space: pre-wrap;
}

.am-msg.is-me {
	flex-direction: row-reverse;
}

.am-msg.is-me .am-msg-main { text-align: right; }

.am-msg.is-me .am-bubble {
	text-align: left;
	color: #fff;
	background: #343a40;
	border-radius: 12px 4px 12px 12px;
}

.am-chat-form {
	display: flex;
	gap: 10px;
	align-items: flex-end;
	padding-top: 12px;
	border-top: 1px solid #f0f0f1;
}

.am-chat-form textarea {
	flex: 1;
	min-height: 44px;
	max-height: 140px;
	padding: 11px 13px;
	font-size: 14px;
	line-height: 1.6;
	color: #343a40;
	background: #f8f8f9;
	border: 1px solid #e9ecef;
	border-radius: 10px;
	resize: none;
	outline: 0;
	transition: border-color .15s, background .15s;
}

.am-chat-form textarea:focus {
	background: #fff;
	border-color: #ced4da;
}

.am-btn-send {
	flex: none;
	height: 44px;
	padding: 0 20px;
	font-size: 14px;
	font-weight: 600;
	color: #fff;
	background: #343a40;
	border: 0;
	border-radius: 10px;
	cursor: pointer;
	transition: opacity .15s;
}

.am-btn-send:hover { opacity: .88; }
.am-btn-send:disabled { opacity: .5; cursor: default; }

.am-empty {
	padding: 48px 0;
	text-align: center;
	color: #adb5bd;
	font-size: 14px;
}

.am-empty i { display: block; font-size: 34px; margin-bottom: 10px; opacity: .5; }

@media (max-width: 767px) {
	/* 手机上同样固定，按视口扣掉顶栏/对方信息/输入框的高度 */
	.am-chat-scroll { height: calc(100vh - 300px); min-height: 280px; }
	.am-msg-main { max-width: 84%; }
	.am-notice-subject { white-space: normal; }
}

/* ---------------- 页面外壳：不依赖主题的个人中心模板 ---------------- */

.am-page {
	width: 100%;
	max-width: 880px;
	margin: 0 auto;
	padding: 4px 0 12px;
}

.am-card {
	background: var(--card, #fff);
	border: 1px solid var(--line, #e9ecef);
	border-radius: 8px;
	overflow: hidden;
}

.am-card-head {
	padding: 12px 16px;
	border-bottom: 1px solid var(--line, #f0f0f1);
}

.am-card-body {
	padding: 4px 16px 14px;
}

@media (max-width: 767px) {
	.am-page { padding: 0 10px 10px; }
	.am-card-head { padding: 10px 12px; }
	.am-card-body { padding: 2px 12px 10px; }
}

/* panther 顶栏的消息图标 */
.am-pt-msg { position: relative; text-decoration: none; }

.am-pt-badge {
	position: absolute;
	top: 1px;
	right: 0;
	min-width: 15px;
	height: 15px;
	padding: 0 4px;
	font-family: var(--mono, inherit);
	font-size: 10px;
	font-weight: 700;
	line-height: 15px;
	text-align: center;
	color: #fff;
	background: var(--red, #e03131);
	border-radius: 8px;
}
