/* ==========================================================================
   右侧中间「联系人工客服」大悬浮条  (2026-11-27)
   --------------------------------------------------------------------------
   形态：贴右边缘、垂直居中、**四边圆角**（老板 2026-11-27 定：贴边但四角都要圆）。

   🔑 缩放体系（2026-11-27 重做）
   原来宽/高/字号/图标各写一套 clamp，上下限互相打架 —— 实测拉窗口只在一小段
   区间会动，其余时候纹丝不动，字号更是写死完全不动（老板：「为什么不随缩放」）。
   现在只留**一个**随视口变化的基准 font-size，其余尺寸全用 em：
     窗口 1024 → 1920，整块（含文字、图标、圆角）等比放大约 1.7 倍。
   em 系数按 1440 屏（1vw = 14.4px）反推：
     width 8.4em ≈ 121px / height 11em ≈ 158px / 圆角 1.3em ≈ 19px

   上下限是必要的保护：<1100px 太小点不到，>1700px 太夸张会像广告位。

   和聊天窗的关系：body.hqt-cw-open 是 chat-widget.js open() 时加的类，
   直接用它让位，不用 JS 监听 DOM 变化。
   ========================================================================== */

.hqt-chat-tab {
	position: fixed;
	right: 0;
	/* 2026-11-27：从 50% 下移到 70% —— 50% 时正好压住首页轮播的右侧切换按钮
	   （实测 .hero-arr.next 在 y=495–541）。70% 让竖条顶部落在 551，避开。 */
	top: 70%;
	transform: translateY(-50%) translateX(100%);
	z-index: 85;                       /* 高于 .floater(80)，低于聊天窗(2147483647) */

	/* 唯一缩放基准 —— 改这一个值，整块等比变化 */
	font-size: clamp(11px, 1vw, 17px);

	width: 8.4em;
	height: 11em;
	border: 0;
	border-radius: 1.3em;              /* 四边圆角，贴边也保留右侧两角 */
	background: #2563EB;               /* 与报价器「联系客服」按钮、进度环同一个蓝 */
	color: #fff;
	cursor: pointer;
	padding: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: .55em;
	font-family: inherit;
	opacity: 0;
	transition: transform .34s cubic-bezier(.22,.61,.36,1), opacity .2s ease, background-color .18s ease;
	box-shadow: -2px 0 10px rgba(9, 30, 66, .10);
	-webkit-tap-highlight-color: transparent;
}

/* 进入态：从右侧滑入 */
.hqt-chat-tab.is-in {
	transform: translateY(-50%) translateX(0);
	opacity: 1;
}

.hqt-chat-tab:hover {
	background: #1D4ED8;
	transform: translateY(-50%) translateX(-.18em);
}

.hqt-chat-tab:focus-visible {
	outline: 2px solid #93C5FD;
	outline-offset: 2px;
}

/* 图标：普通流式，跟文字一起被 flex 垂直居中。
   🔴 2026-11-27 修：原来是 absolute + top:1.1em，文字又是 absolute + top:55% 旋转，
   竖条从「细高」变「宽扁」后两者在纵向撞在一起（老板截图：耳机压着「联系人工客服」）。 */
.hqt-chat-tab .ct-ic {
	position: relative;                /* 红点相对图标定位 */
	display: grid;
	place-items: center;
	opacity: .95;
	flex: 0 0 auto;
}
.hqt-chat-tab .ct-ic svg {
	width: 2.5em;
	height: 2.5em;
}

/* 文字：两行（footer 输出 <span>联系</span><span>人工客服</span>）。
   🔴 2026-11-27 修：两个 span 原来是 inline，英文拼成「Talk toa human」（少空格），
   中文能凑成「联系人工客服」所以没暴露。这里让每个 span 各占一行。
   121px 宽放「人工客服」4 字（58px）、「a human」7 字符（50px）都很宽松。 */
.hqt-chat-tab .ct-txt {
	font-size: 1em;
	font-weight: 600;
	letter-spacing: .01em;
	line-height: 1.3;
	text-align: center;
	flex: 0 0 auto;
	max-width: 96%;
}
.hqt-chat-tab .ct-txt > span {
	display: block;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* 在线状态行：绿点 + 「在线 / Online」。比静态图标更能推着人点。 */
.hqt-chat-tab .ct-state {
	display: inline-flex;
	align-items: center;
	gap: .32em;
	font-size: .8em;
	font-weight: 500;
	letter-spacing: .02em;
	opacity: .82;
	flex: 0 0 auto;
	line-height: 1;
}
.hqt-chat-tab .ct-live {
	width: .5em;
	height: .5em;
	border-radius: 50%;
	background: #34D399;
	box-shadow: 0 0 0 1.5px rgba(255, 255, 255, .5);
	flex: 0 0 auto;
}

/* 新消息红点（chat-widget.js 的 markDot 点亮）：挂在耳机图标右上角 */
.hqt-chat-tab .hqt-chat-dot[hidden]{display:none}
.hqt-chat-tab .hqt-chat-dot {
	position: absolute;
	top: -.15em;
	right: -.2em;
	width: .6em;
	height: .6em;
	border-radius: 50%;
	background: #EF4444;
	box-shadow: 0 0 0 2px #2563EB;
}

/* 右上角小关闭：物流客户来回比价，反复弹会烦。点了记 3 天 */
.hqt-chat-tab .ct-close {
	position: absolute;
	top: .42em;
	right: .42em;
	width: 1.35em;
	height: 1.35em;
	display: grid;
	place-items: center;
	border-radius: 50%;
	color: rgba(255, 255, 255, .62);
	cursor: pointer;
	opacity: 0;
	transition: opacity .18s ease, background-color .18s ease;
}
.hqt-chat-tab .ct-close svg {
	width: .8em;
	height: .8em;
}
.hqt-chat-tab:hover .ct-close,
.hqt-chat-tab:focus-within .ct-close { opacity: 1; }
.hqt-chat-tab .ct-close:hover { background: rgba(0, 0, 0, .22); color: #fff; }

/* 聊天窗打开时立即让位。
   visibility 不参与过渡、立即生效 —— 只写 opacity 会被 .is-in 的过渡卡住（实测）。
   开窗那刻做滑出动画没意义，聊天窗已经盖住这块了。 */
body.hqt-cw-open .hqt-chat-tab {
	transform: translateY(-50%) translateX(110%);
	opacity: 0 !important;
	visibility: hidden;
	pointer-events: none;
}

/* ===== 手机（≤640px）：改成右下角圆钮 =====
   竖条在手机上挡正文右边缘、且拇指够不到，所以换形态。
   圆钮宽高必须相等，用固定基准字号算，不跟 vw 走（否则小屏会缩到点不到）。 */
@media (max-width: 640px) {
	.hqt-chat-tab {
		right: 14px;
		/* 🔴 2026-11-27：原来是 16px，被手机吸底条 .mbar（高 63px，z-index 95）压住。
		   .mbar 只在有电话/CTA 时渲染，用 :has 判断；有它就抬到 71px（63 + 8）。
		   同时把右下角那列胶囊一起上移（见文件末尾），否则圆钮会和它纵向撞。 */
		bottom: 16px;
		top: auto;
		font-size: 16px;
		width: 4em;                    /* 64px */
		height: 4em;
		border-radius: 50%;
		transform: translateY(16px) scale(.9);
		box-shadow: 0 6px 18px rgba(37, 99, 235, .32);
	}
	.hqt-chat-tab.is-in {
		transform: translateY(0) scale(1);
		opacity: 1;
	}
	.hqt-chat-tab:hover {
		transform: translateY(-2px) scale(1);
	}
	body.hqt-cw-open .hqt-chat-tab {
		transform: translateY(16px) scale(.9);
		opacity: 0 !important;
		visibility: hidden;
		pointer-events: none;
	}
	/* 圆形形态：只留耳机图标，文字与状态行都收起（圆钮放不下两行字） */
	.hqt-chat-tab .ct-ic svg {
		width: 1.8em;                  /* 28.8px */
		height: 1.8em;
	}
	.hqt-chat-tab .ct-txt,
	.hqt-chat-tab .ct-state { display: none; }
	.hqt-chat-tab .hqt-chat-dot {
		width: .7em;
		height: .7em;
		top: -.2em;
		right: -.2em;
	}
	.hqt-chat-tab .ct-close { display: none; }
}

/* 减少动效偏好：不做滑入，直接出现 */
@media (prefers-reduced-motion: reduce) {
	.hqt-chat-tab { transition: opacity .1s linear; }
	.hqt-chat-tab,
	.hqt-chat-tab.is-in { transform: translateY(-50%) translateX(0); }
}
@media (max-width: 640px) and (prefers-reduced-motion: reduce) {
	.hqt-chat-tab,
	.hqt-chat-tab.is-in { transform: none; }
}

/* ===== 手机端：右下角三层纵向排开（2026-11-27 定稿）=====
   右下角原本挤了 4 个浮动元素，实测客服圆钮(71–135) 和 AI 询价球(72–118) 几乎完全重叠。
   AI 球是 freight-ai.js 独立注入的 fixed 元素，不在 .floater 里，所以只改 floater 没用。
   按「重要性从下往上」排：客服 → AI → 工具列，各自留 8px 间隙。

   | 层 | bottom | 高度 | 占据 |
   |---|---|---|---|
   | 吸底条 .mbar      | 0   | 63 | 0–63   |
   | 客服圆钮          | 71  | 64 | 71–135 |
   | AI 询价球         | 143 | 46 | 143–189|
   | 工具列 .floater   | 197 | 46 | 197–243|

   另外「获取报价」按钮右侧让出 68px（圆钮是 fixed，只有让按钮右边界恒在圆钮左侧，
   才能保证滚动到任何位置都不重叠）。 */
@media (max-width: 640px) {
	.hqt-site:has(.mbar) .hqt-chat-tab { bottom: 71px; }
	.hqt-site:has(.mbar) .faichat-launcher { bottom: 143px; }
	.hqt-site:has(.mbar) .floater { bottom: 197px; }
	.hqt-site:has(.mbar) .price-submit { margin-right: 68px; }

	/* 🔴 2026-11-27 修：尺寸区换行后第二行被「件数」卡片压住。
	     .pf-sibox 在手机是 flex-direction:column，.pf-body 却是 `flex:1 1 0%` ——
	     高度被锁成父容器的剩余空间（实测 55px），而 2×2 的两行内容需要 66px，
	     多出来的 11px 直接溢出到下一张卡片上（截图里「高」「单件重」被裁一半）。
	     让 body 按内容撑开即可；桌面不受影响（规则限手机断点 + .pf-dims）。 */
	.pf-sibox.pf-dims .pf-body { flex: 0 0 auto; height: auto; }
}
