/* KT AI Chat widget — Apple風（ktc- namespace） */
.ktc-fab,
.ktc-panel,
.ktc-panel *{
	box-sizing:border-box;
	font-family:-apple-system,BlinkMacSystemFont,"Helvetica Neue","Hiragino Sans","Hiragino Kaku Gothic ProN","Noto Sans JP",Meiryo,sans-serif;
}

/* ページトップボタン（チャット有効時のみこのCSSが読み込まれる）
   「質問する」ボタンの真上に右端を揃え、同系の丸型デザインに統一する */
p.page-top{
	right:20px !important; bottom:88px !important; left:auto !important;
	width:auto !important; margin:0 !important; text-align:right !important;
}
p.page-top a{
	display:flex !important; align-items:center !important; justify-content:center !important;
	width:44px !important; height:44px !important; padding:0 !important;
	box-sizing:border-box !important;
	background:rgba(29,29,31,.55) !important;
	-webkit-backdrop-filter:blur(8px); backdrop-filter:blur(8px);
	border:none !important; border-radius:50% !important;
	box-shadow:0 4px 14px rgba(0,0,0,.18) !important;
}
p.page-top a::before{ position:static !important; margin:0 !important; }

/* ---------- FAB ---------- */
.ktc-fab{
	position:fixed; right:20px; bottom:20px; z-index:99000;
	display:inline-flex; align-items:center; gap:8px;
	height:52px; padding:0 20px;
	background:#0071e3; color:#fff;
	border:none; border-radius:980px;
	font-size:14px; font-weight:600; letter-spacing:.02em;
	box-shadow:0 4px 16px rgba(0,0,0,.16);
	cursor:pointer;
	transition:transform .2s ease, opacity .2s ease, background .2s;
}
.ktc-fab:hover{ background:#0077ed; transform:scale(1.03); }
.ktc-fab.ktc-hidden{ opacity:0; pointer-events:none; transform:scale(.9); }
.ktc-fab svg{ flex:none; }

/* ---------- パネル ---------- */
.ktc-panel{
	position:fixed; right:20px; bottom:20px; z-index:99010;
	width:380px; height:min(620px, 80vh);
	display:flex; flex-direction:column;
	background:#fff;
	border-radius:18px;
	box-shadow:0 24px 64px rgba(0,0,0,.24);
	overflow:hidden;
	animation:ktc-in .2s ease;
}
@keyframes ktc-in{
	from{ opacity:0; transform:translateY(12px); }
	to{ opacity:1; transform:none; }
}

.ktc-header{
	flex:none; display:flex; align-items:center; justify-content:space-between;
	padding:14px 16px;
	border-bottom:1px solid rgba(0,0,0,.08);
	background:rgba(255,255,255,.9);
}
.ktc-title{ font-size:15px; font-weight:600; color:#1d1d1f; }
.ktc-close{
	background:#f5f5f7; border:none; cursor:pointer;
	width:28px; height:28px; border-radius:50%;
	font-size:13px; line-height:1; color:#6e6e73;
	display:flex; align-items:center; justify-content:center;
}
.ktc-close:hover{ background:#e8e8ed; }

.ktc-msgs{
	flex:1; overflow-y:auto;
	padding:16px;
	display:flex; flex-direction:column; gap:10px;
	background:#fff;
}
.ktc-msg{
	max-width:85%;
	padding:10px 14px;
	border-radius:16px;
	font-size:14px; line-height:1.75;
	white-space:normal; word-break:break-word;
}
.ktc-ai{
	align-self:flex-start;
	background:#f5f5f7; color:#1d1d1f;
	border-bottom-left-radius:6px;
}
.ktc-user{
	align-self:flex-end;
	background:#0071e3; color:#fff;
	border-bottom-right-radius:6px;
}
.ktc-loading{ color:#6e6e73; }
.ktc-loading::after{
	content:''; display:inline-block; width:1em; text-align:left;
	animation:ktc-dots 1.2s steps(4) infinite;
}
@keyframes ktc-dots{
	0%{ content:''; } 25%{ content:'.'; } 50%{ content:'..'; } 75%{ content:'...'; }
}

.ktc-sources{
	align-self:flex-start; max-width:85%;
	display:flex; flex-direction:column; gap:4px;
	margin-top:-4px;
}
.ktc-sources-label{ font-size:11px; color:#6e6e73; }
.ktc-source{
	font-size:12.5px; color:#0071e3; text-decoration:none;
	overflow:hidden; text-overflow:ellipsis; white-space:nowrap; max-width:100%;
}
.ktc-source:hover{ text-decoration:underline; }

.ktc-consult{
	align-self:flex-start; max-width:85%;
	font-size:12.5px; line-height:1.7; color:#48484a;
	background:rgba(0,113,227,.07);
	border-radius:12px; padding:9px 13px;
	margin-top:-2px;
}
.ktc-consult-link{ color:#0071e3; text-decoration:underline; margin:0 2px; }

.ktc-chips{
	flex:none; display:flex; flex-wrap:wrap; gap:8px;
	padding:0 16px 8px;
}
.ktc-chips:empty{ display:none; }
.ktc-chip{
	background:#fff; color:#0071e3;
	border:1px solid rgba(0,113,227,.35);
	border-radius:980px;
	padding:7px 14px; font-size:12.5px;
	cursor:pointer; transition:background .2s;
}
.ktc-chip:hover{ background:rgba(0,113,227,.08); }

.ktc-form{
	flex:none; display:flex; align-items:center; gap:8px;
	padding:10px 12px;
	border-top:1px solid rgba(0,0,0,.08);
}
.ktc-input{
	flex:1; height:40px;
	background:#f5f5f7; color:#1d1d1f;
	border:none; border-radius:980px;
	padding:0 16px; font-size:14px;
	outline:none;
}
.ktc-input:focus{ box-shadow:0 0 0 2px rgba(0,113,227,.4); }
.ktc-input:disabled{ opacity:.6; }
.ktc-hp{
	position:absolute; left:-9999px; top:-9999px;
	width:1px; height:1px; opacity:0;
}
.ktc-send{
	flex:none; width:40px; height:40px;
	background:#0071e3; color:#fff;
	border:none; border-radius:50%;
	display:flex; align-items:center; justify-content:center;
	cursor:pointer; transition:background .2s;
}
.ktc-send:hover{ background:#0077ed; }
.ktc-send:disabled{ opacity:.5; cursor:default; }

.ktc-foot{
	flex:none;
	padding:8px 16px 12px;
	font-size:10.5px; line-height:1.5; color:#6e6e73;
	background:#fff;
}

/* ---------- SP ---------- */
@media (max-width:767px){
	.ktc-fab{ right:14px; bottom:16px; height:48px; padding:0 16px; font-size:13px; }
	p.page-top{ right:14px !important; bottom:76px !important; }
	p.page-top a{ width:40px !important; height:40px !important; }
	.ktc-panel{
		right:0; left:0; bottom:0;
		width:100%; height:85vh; height:85dvh;
		border-radius:18px 18px 0 0;
	}
	.ktc-input{ font-size:16px; } /* iOSのズーム防止 */
}
