.toolbar {
	height: var(--toolbar-height);
	background: var(--bg-sidebar);
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0 var(--spacing-md);
	border-bottom: 1px solid var(--border-color);
}

.toolbar-left {
	display: flex;
	align-items: center;
	gap: var(--spacing-sm);
}

.toolbar-label {
	font-size: 13px;
	font-weight: 500;
	color: var(--text-primary);
}

.toolbar-separator {
	color: var(--border-color);
	margin: 0 var(--spacing-xs);
}

.toolbar-action {
	display: flex;
	align-items: center;
	gap: var(--spacing-xs);
	padding: var(--spacing-xs) var(--spacing-sm);
	font-size: 12px;
	color: var(--text-secondary);
	border-radius: 4px;
	transition: all 0.15s;
}

.toolbar-action:hover {
	background: rgba(255, 255, 255, 0.1);
	color: var(--text-primary);
}

.toolbar-action.loading {
	cursor: not-allowed;
	opacity: 0.8;
}

.toolbar-action:disabled {
	opacity: 0.7;
	cursor: not-allowed;
}

.toolbar-action.primary {
	background: var(--primary-color);
	color: white;
}

.toolbar-action.primary:hover {
	background: var(--primary-hover);
}

.toolbar-action.ai {
	background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
	color: white;
}

.toolbar-action.ai:hover {
	opacity: 0.9;
}

.toolbar-dropdown {
	position: relative;
	display: inline-flex;
}

.dropdown-caret {
	margin-left: 4px;
	font-size: 10px;
	opacity: 0.8;
}

.toolbar-menu {
	position: absolute;
	top: calc(100% + 6px);
	left: 0;
	min-width: 120px;
	background: var(--bg-darker);
	border: 1px solid var(--border-color);
	border-radius: 6px;
	box-shadow: 0 8px 16px rgba(0, 0, 0, 0.35);
	z-index: 10;
	padding: 4px;
}

.toolbar-menu-item {
	width: 100%;
	text-align: left;
	padding: 6px 10px;
	font-size: 12px;
	color: var(--text-secondary);
	border-radius: 4px;
}

.toolbar-menu-item:hover {
	background: rgba(255, 255, 255, 0.08);
	color: var(--text-primary);
}

.toolbar-spinner {
	width: 12px;
	height: 12px;
	border-radius: 50%;
	border: 2px solid rgba(255, 255, 255, 0.4);
	border-top-color: rgba(255, 255, 255, 0.9);
	animation: toolbar-spin 0.9s linear infinite;
}

@keyframes toolbar-spin {
	to {
		transform: rotate(360deg);
	}
}

.toolbar-right {
	display: flex;
	align-items: center;
	gap: var(--spacing-sm);
}

.toolbar-status {
	font-size: 12px;
	color: var(--text-muted);
}

/* 知识库选择器 */
.toolbar-kb-selector {
	position: relative;
}

.toolbar-kb-btn {
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 6px 12px;
	font-size: 12px;
	color: var(--text-secondary);
	background: var(--bg-darker);
	border: 1px solid var(--border-color);
	border-radius: 4px;
	cursor: pointer;
	transition: all 0.15s;
}

.toolbar-kb-btn:hover {
	border-color: var(--primary-color);
	color: var(--text-primary);
}

.toolbar-kb-btn svg {
	opacity: 0.7;
}

.kb-name {
	max-width: 120px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.toolbar-kb-menu {
	position: absolute;
	top: calc(100% + 6px);
	right: 0;
	min-width: 200px;
	background: var(--bg-darker);
	border: 1px solid var(--border-color);
	border-radius: 6px;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
	z-index: 100;
	overflow: hidden;
}

.kb-menu-header {
	padding: 8px 12px;
	font-size: 11px;
	font-weight: 500;
	color: var(--text-muted);
	text-transform: uppercase;
	letter-spacing: 0.5px;
	border-bottom: 1px solid var(--border-color);
	background: rgba(255, 255, 255, 0.02);
}

.toolbar-kb-item {
	width: 100%;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 2px;
	padding: 10px 12px;
	font-size: 12px;
	color: var(--text-secondary);
	text-align: left;
	border: none;
	background: transparent;
	cursor: pointer;
	transition: background 0.1s;
	position: relative;
}

.toolbar-kb-item:hover {
	background: rgba(255, 255, 255, 0.06);
	color: var(--text-primary);
}

.toolbar-kb-item.active {
	background: rgba(24, 144, 255, 0.1);
	color: var(--primary-color);
}

.kb-item-name {
	font-weight: 500;
}

.kb-item-desc {
	font-size: 11px;
	color: var(--text-muted);
}

.toolbar-kb-item.active .kb-item-desc {
	color: rgba(24, 144, 255, 0.7);
}

.kb-item-check {
	position: absolute;
	right: 12px;
	top: 50%;
	transform: translateY(-50%);
	color: var(--primary-color);
	font-weight: bold;
}
