.companion-fab {
	position: fixed;
	right: 24px;
	bottom: 24px;
	z-index: 1000;
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 12px 18px;
	border-radius: 980px;
	background: var(--bl);
	color: #fff;
	cursor: pointer;
	box-shadow: 0 6px 20px rgba(0, 0, 0, .16);
	transition: box-shadow .15s var(--ea);
	user-select: none;
	touch-action: none;
	-webkit-tap-highlight-color: transparent;
}

.companion-fab:hover {
	box-shadow: 0 10px 26px rgba(0, 0, 0, .2);
}

.companion-fab-ic { font-size: 1.15rem; line-height: 1; }

.companion-fab-tip {
	font-size: .88rem;
	font-weight: 500;
	letter-spacing: .02em;
}

.companion-panel {
	position: fixed;
	right: 24px;
	bottom: 88px;
	z-index: 1001;
	width: 360px;
	max-width: calc(100vw - 32px);
	display: flex;
	flex-direction: column;
	background: var(--w, #fff);
	border-radius: 18px;
	box-shadow: 0 16px 44px rgba(0, 0, 0, .2);
	overflow: hidden;
}

.companion-panel[hidden] { display: none; }

.companion-panel-head {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 14px 16px;
	background: var(--bl);
	color: #fff;
}

.companion-panel-head .cp-ic { font-size: 1.2rem; line-height: 1; }

.companion-panel-title {
	display: flex;
	flex-direction: column;
	flex: 1;
	min-width: 0;
	line-height: 1.3;
}

.companion-panel-title strong { font-size: .98rem; }

.companion-panel-title span {
	font-size: .74rem;
	opacity: .85;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.companion-close {
	border: none;
	background: rgba(255, 255, 255, .18);
	color: #fff;
	width: 28px;
	height: 28px;
	border-radius: 50%;
	font-size: 1.2rem;
	line-height: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
}

.companion-close:hover { background: rgba(255, 255, 255, .3); }

.companion-chat {
	display: flex;
	flex-direction: column;
	gap: 8px;
	max-height: 340px;
	min-height: 160px;
	overflow-y: auto;
	padding: 14px 14px 4px;
}

.cp-msg {
	max-width: 88%;
	padding: 9px 13px;
	border-radius: 14px;
	font-size: .86rem;
	line-height: 1.55;
	word-break: break-word;
}

.cp-msg.ai {
	background: var(--bg);
	border-top-left-radius: 6px;
	align-self: flex-start;
	color: var(--t);
}

.cp-msg.user {
	background: var(--bl);
	color: #fff;
	border-top-right-radius: 6px;
	align-self: flex-end;
}

.cp-thinking {
	color: var(--ts);
	font-size: .8rem;
	font-style: italic;
	align-self: flex-start;
	padding: 4px 2px;
}

.companion-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	padding: 8px 14px;
}

.companion-chips button {
	font-size: .78rem;
	padding: 5px 12px;
	border-radius: 980px;
	border: 1px solid var(--t3);
	background: var(--w);
	color: var(--ts);
	cursor: pointer;
	font-family: inherit;
	transition: all .15s var(--ea);
}

.companion-chips button:hover {
	border-color: var(--bl);
	color: var(--bl);
}

.companion-row {
	display: flex;
	gap: 8px;
	align-items: center;
	padding: 0 14px 14px;
}

.companion-row input {
	flex: 1;
	min-width: 0;
	border: 1px solid var(--t3);
	border-radius: 980px;
	padding: 9px 14px;
	font-size: .88rem;
	font-family: inherit;
	background: var(--w);
	color: var(--t);
	outline: none;
}

.companion-row input:focus {
	border-color: var(--bl);
	box-shadow: 0 0 0 3px rgba(232, 56, 61, .1);
}

.companion-row button {
	flex-shrink: 0;
	border: none;
	border-radius: 980px;
	padding: 9px 16px;
	background: var(--bl);
	color: #fff;
	font-size: .86rem;
	font-weight: 500;
	cursor: pointer;
	font-family: inherit;
}

.companion-row button:active { transform: scale(.97); }

@media (max-width: 640px) {
	.companion-fab { right: 16px; bottom: 88px; padding: 11px 15px; }
	.companion-fab-tip { display: none; }
	.companion-panel { right: 16px; bottom: 156px; }
}
