/* 白色主题 */
:root {
	--primary: #1677ff;
	--primary-hover: #4096ff;
	--bg-page: #ffffff;
	--bg-subtle: #f5f5f5;
	--border: #e8e8e8;
	--text: #1a1a1a;
	--text-muted: #888888;
	--bubble-self: #d6e8ff;
	--bubble-other: #ffffff;
	--avatar: #5b6b8c;
}

html,
body,
#app {
	height: 100%;
	margin: 0;
}

body {
	background: var(--bg-page);
	color: var(--text);
	overflow: hidden;
}

.scroll-hidden {
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
	-ms-overflow-style: none;
}

.scroll-hidden::-webkit-scrollbar {
	display: none;
}

.app-shell {
	height: 100dvh;
	max-height: 100dvh;
	display: flex;
	flex-direction: column;
	background: var(--bg-page);
	overflow: hidden;
}

/* 顶栏：三栏网格保证标题居中 */
.toolbar-header {
	flex-shrink: 0;
	display: grid;
	grid-template-columns: 48px 1fr 48px;
	align-items: center;
	min-height: 48px;
	padding: 4px 6px;
	background: var(--bg-page);
	border-bottom: 1px solid var(--border);
}

.toolbar-slot {
	display: flex;
	align-items: center;
	min-width: 48px;
}

.toolbar-slot:first-child {
	justify-content: flex-start;
	padding-left: 2px;
}

.toolbar-slot--end {
	justify-content: flex-end;
	padding-right: 2px;
}

.toolbar-title {
	text-align: center;
	font-size: 1rem;
	font-weight: 600;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	padding: 0 4px;
	line-height: 48px;
}

.toolbar-slot .btn,
.toolbar-slot .dropdown > .btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	padding: 0;
	line-height: 1;
}

.toolbar-slot .btn .bi {
	display: block;
	line-height: 1;
}

.app-body {
	flex: 1 1 auto;
	min-height: 0;
	background: var(--bg-page);
}

.app-footer {
	flex-shrink: 0;
	background: var(--bg-page);
	border-top: 1px solid var(--border);
	padding-bottom: env(safe-area-inset-bottom, 0);
}

.app-footer .nav {
	align-items: stretch;
}

.app-footer .nav-item {
	flex: 1;
	display: flex;
}

.app-footer .nav-link {
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0.6rem 0;
	font-size: 1.35rem;
	color: var(--text-muted);
	border: 0;
	background: transparent;
	line-height: 1;
}

.app-footer .nav-link .bi {
	display: block;
	line-height: 1;
}

.app-footer .nav-item.position-relative .badge {
	top: 6px;
	left: 50%;
	right: auto;
	margin-left: 10px;
	transform: none;
	font-size: 10px;
	min-width: 16px;
	padding: 2px 5px;
	line-height: 1;
}

.app-footer .nav-link.active {
	color: var(--primary);
}

.empty-state {
	text-align: center;
	color: var(--text-muted);
	padding: 3rem 1.5rem;
}

.empty-state .bi {
	display: block;
	font-size: 3rem;
	opacity: 0.2;
	margin-bottom: 0.75rem;
}

/* 聊天页 */
.app-shell > .chat-page {
	flex: 1 1 auto;
	min-height: 0;
}

.chat-page {
	height: 100%;
	display: flex;
	flex-direction: column;
	background: var(--bg-subtle);
	overflow: hidden;
}

.chat-messages {
	flex: 1 1 auto;
	min-height: 0;
	padding: 12px;
}

.msg-row {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	margin-bottom: 12px;
}

.list-group-item-action > .bi.bi-chevron-right {
	align-self: center;
	display: block;
	line-height: 1;
	font-size: 0.9rem;
}

.msg-row--self {
	flex-direction: row-reverse;
}

.emoji-panel {
	flex: 0 0 auto;
	height: 0;
	overflow: hidden;
	background: var(--bg-page);
	border-top: 1px solid transparent;
	transition: height 0.2s ease;
}

.emoji-panel.is-open {
	height: 200px;
	border-top-color: var(--border);
}

.emoji-panel__scroll {
	height: 200px;
	overflow-y: auto;
	padding: 8px;
}

.emoji-grid {
	display: grid;
	grid-template-columns: repeat(8, minmax(0, 1fr));
	grid-auto-rows: 44px;
	gap: 0;
	width: 100%;
}

.emoji-btn {
	width: 100%;
	height: 44px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 6px;
	background: transparent;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 24px;
	line-height: 1;
	font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
}

.emoji-btn:active {
	background: var(--bg-subtle);
}

.chat-footer {
	flex-shrink: 0;
	background: var(--bg-page);
	border-top: 1px solid var(--border);
	padding: 8px;
	padding-bottom: calc(8px + env(safe-area-inset-bottom, 0));
}

.chat-footer .input-group {
	align-items: center;
	flex-wrap: nowrap;
	gap: 6px;
}

.chat-footer .input-group > .btn,
.chat-footer .input-group > label.btn {
	flex-shrink: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	padding: 0;
	margin: 0;
	line-height: 1;
}

.chat-footer .input-group > .btn .bi,
.chat-footer .input-group > label.btn .bi {
	display: block;
	line-height: 1;
	font-size: 1.2rem;
}

.chat-footer textarea.form-control {
	flex: 1 1 auto;
	width: 1%;
	resize: none;
	min-height: 40px;
	height: 40px;
	max-height: 120px;
	line-height: 1.4;
	padding: 9px 12px;
	margin: 0;
	vertical-align: middle;
}

/* 气泡：非绿色 */
.bubble {
	max-width: 72%;
	padding: 8px 12px;
	border-radius: 6px;
	font-size: 16px;
	line-height: 1.45;
	word-break: break-word;
	font-family: inherit, "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
}

.bubble span {
	display: inline-block;
	max-width: 100%;
}

.bubble-self {
	background: var(--bubble-self);
	color: var(--text);
}

.bubble-other {
	background: var(--bubble-other);
	border: 1px solid var(--border);
	color: var(--text);
}

.avatar {
	background: var(--avatar);
	color: #fff;
	border-radius: 6px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	font-weight: 600;
}

.avatar-lg { width: 48px; height: 48px; font-size: 1.1rem; }
.avatar-md { width: 40px; height: 40px; font-size: 0.95rem; }
.avatar-sm { width: 36px; height: 36px; font-size: 0.85rem; border-radius: 4px; }
.avatar-profile { width: 64px; height: 64px; font-size: 1.5rem; border-radius: 8px; }

.btn-primary-app {
	background: var(--primary);
	border-color: var(--primary);
	color: #fff;
}

.btn-primary-app:hover,
.btn-primary-app:active,
.btn-primary-app:disabled {
	background: var(--primary-hover);
	border-color: var(--primary-hover);
	color: #fff;
}

.btn-outline-app {
	color: var(--primary);
	border-color: var(--primary);
}

.btn-outline-app:hover {
	background: rgba(22, 119, 255, 0.06);
	color: var(--primary-hover);
}

.section-label {
	font-size: 12px;
	color: var(--text-muted);
	padding: 8px 16px;
	background: var(--bg-subtle);
	border-bottom: 1px solid var(--border);
	text-align: left;
	line-height: 1.4;
}

.list-group-item {
	background: var(--bg-page);
	border-color: var(--border);
}

.list-group-item-action {
	text-align: left;
}

.list-group-item-action.d-flex {
	align-items: center;
}

.list-group-item .list-label {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	line-height: 1.4;
}

.list-group-item .list-label .bi {
	display: block;
	flex-shrink: 0;
	line-height: 1;
	font-size: 1.1rem;
}

.btn-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.35rem;
	line-height: 1;
}

.btn-icon .bi {
	display: block;
	line-height: 1;
	flex-shrink: 0;
}

.btn-icon.btn-lg {
	min-height: 48px;
}

.btn-group.request-actions .btn {
	flex: 1;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	height: 42px;
	padding: 0;
}

.btn-group.request-actions .btn .bi {
	display: block;
	line-height: 1;
	font-size: 1.15rem;
}

.btn-outline-app.btn-sm {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	padding: 0;
}

.btn-outline-app.btn-sm .bi {
	display: block;
	line-height: 1;
}

.modal-footer .btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 44px;
	height: 44px;
	padding: 0 12px;
}

.modal-footer .btn .bi {
	display: block;
	line-height: 1;
}

.dropdown-item {
	display: flex;
	align-items: center;
}

.dropdown-item .bi {
	display: block;
	line-height: 1;
	flex-shrink: 0;
}

.app-shell *,
.chat-page *,
.modal-content {
	box-shadow: none !important;
}

.btn:focus,
.form-control:focus {
	box-shadow: none !important;
}

.nav-tabs .nav-link {
	text-align: center;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	padding-top: 0.5rem;
	padding-bottom: 0.5rem;
}

.nav-tabs .nav-link.active {
	color: var(--primary);
	border-color: var(--border) var(--border) var(--bg-page);
}

.nav-tabs .nav-link:focus {
	border-color: var(--border);
}
