.th-ai-assistant{
	--th-ai-edge-offset:1.35rem;
	bottom:var(--th-ai-edge-offset);
	display:flex;
	flex-direction:column-reverse;
	gap:.9rem;
	position:fixed;
	right:1.35rem;
	z-index:1080;
}

.th-ai-footer-dock{
	box-sizing:border-box;
	display:flex;
	justify-content:flex-end;
	width:100%;
}

.th-ai-footer-dock:empty{
	display:none;
}

.th-ai-footer-dock:not(:empty){
	padding:1rem 1.35rem 1.35rem;
}

.th-ai-assistant.is-footer-docked{
	bottom:auto;
	position:static;
	right:auto;
}

.th-ai-launcher{
	align-items:center;
	align-self:flex-end;
	-webkit-backdrop-filter:blur(18px);
	backdrop-filter:blur(18px);
	background:
		radial-gradient(circle at 18% 12%,var(--th-glow-cyan),var(--th-color-transparent) 44%),
		var(--th-card-bg-glass);
	border:1px solid var(--th-border-glass);
	border-radius:999px;
	box-shadow:
		0 18px 44px var(--th-control-shadow-elevated),
		0 0 0 4px var(--th-status-success-ring);
	color:var(--th-color-text-main);
	display:flex;
	gap:.7rem;
	isolation:isolate;
	min-height:4.15rem;
	overflow:hidden;
	padding:.38rem .9rem .38rem .4rem;
	position:relative;
	transition:border-color .2s ease,box-shadow .2s ease,transform .2s ease;
}

.th-ai-launcher::before{
	background:linear-gradient(110deg,var(--th-color-transparent) 12%,var(--th-overlay-white-shine) 46%,var(--th-color-transparent) 72%);
	content:"";
	inset:0;
	opacity:.45;
	pointer-events:none;
	position:absolute;
	transform:translateX(-115%);
	transition:transform .7s ease;
	z-index:0;
}

.th-ai-launcher-orb{
	align-items:center;
	animation:th-ai-launcher-spectrum 7s linear infinite;
	background:
		radial-gradient(circle at 32% 24%,var(--th-overlay-white-shine),var(--th-color-transparent) 35%),
		var(--th-gradient-brand);
	border:1px solid var(--th-overlay-white-shine);
	border-radius:50%;
	box-shadow:
		0 0 0 4px var(--th-status-success-ring),
		0 10px 24px var(--th-status-success-glow);
	color:var(--th-color-white);
	display:flex;
	flex:0 0 3.25rem;
	height:3.25rem;
	justify-content:center;
	position:relative;
	will-change:filter;
	z-index:1;
}

.th-ai-launcher-orb::before{
	border:1px solid var(--th-overlay-white-shine);
	border-radius:50%;
	content:"";
	inset:.32rem;
	position:absolute;
}

.th-ai-launcher-orb::after{
	animation:th-ai-orbit 5.5s linear infinite;
	background:var(--th-color-white);
	border-radius:50%;
	box-shadow:0 0 .65rem var(--th-color-white);
	content:"";
	height:.32rem;
	left:50%;
	position:absolute;
	top:.12rem;
	transform-origin:0 1.5rem;
	width:.32rem;
}

.th-ai-launcher-orb i{
	font-size:1.35rem;
	position:relative;
	z-index:1;
}

.th-ai-launcher-copy{
	display:flex;
	flex:0 0 auto;
	flex-direction:column;
	line-height:1.08;
	min-width:6.35rem;
	position:relative;
	text-align:left;
	z-index:1;
}

.th-ai-launcher-copy strong{
	font-size:1.02rem;
	font-weight:800;
	letter-spacing:.01em;
}

.th-ai-launcher-copy small{
	color:var(--th-color-text-muted);
	font-size:.68rem;
	font-weight:700;
	letter-spacing:.035em;
	margin-top:.24rem;
	text-transform:uppercase;
	white-space:nowrap;
}

.th-ai-launcher-status{
	background:var(--th-color-success-strong);
	border:2px solid var(--th-card-bg-hover);
	border-radius:50%;
	box-shadow:0 0 0 3px var(--th-status-success-ring);
	flex:0 0 .55rem;
	height:.55rem;
	position:relative;
	width:.55rem;
	z-index:1;
}

@media (hover:hover){
	.th-ai-launcher:hover{
		border-color:var(--th-border-soft);
		box-shadow:
			0 22px 54px var(--th-control-shadow-elevated),
			0 0 0 6px var(--th-status-success-ring);
		transform:translateY(-3px);
}

	.th-ai-launcher:hover::before{
		transform:translateX(115%);
	}
}

.th-ai-launcher:focus-visible,
.th-ai-panel .th-action-btn:focus-visible,
.th-ai-panel .th-btn:focus-visible,
.th-ai-suggestions-panel .th-action-btn:focus-visible,
.th-ai-suggestions-panel .th-btn:focus-visible{
	outline:3px solid var(--th-border-cyan);
	outline-offset:3px;
}

.th-ai-workspace{
	align-items:flex-end;
	display:flex;
	gap:.65rem;
	position:relative;
}

.th-ai-panel{
	background:var(--th-card-bg-hover);
	border:1px solid var(--th-border-base);
	border-radius:1rem;
	box-shadow:0 24px 70px var(--th-control-shadow-elevated);
	display:grid;
	grid-template-rows:auto minmax(11rem,1fr) auto auto;
	height:min(33rem,calc(100vh - 6rem));
	height:min(33rem,calc(100dvh - 6rem));
	overflow:hidden;
	width:min(30rem,calc(100vw - 2rem));
}

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

.th-ai-suggestions-panel{
	background:var(--th-card-bg-hover);
	border:1px solid var(--th-border-base);
	border-radius:.5rem;
	box-shadow:0 18px 48px var(--th-control-shadow-elevated);
	display:flex;
	flex-direction:column;
	max-height:min(25rem,calc(100vh - 8rem));
	max-height:min(25rem,calc(100dvh - 8rem));
	overflow:hidden;
	width:min(17.5rem,calc(100vw - 2rem));
}

.th-ai-suggestions-panel[hidden]{
	display:none;
}

.th-ai-suggestions-header{
	align-items:center;
	border-bottom:1px solid var(--th-border-base);
	display:flex;
	justify-content:space-between;
	padding:.6rem .65rem .6rem .75rem;
}

.th-ai-suggestions-heading{
	align-items:center;
	display:flex;
	font-size:.82rem;
	font-weight:800;
	gap:.45rem;
}

.th-ai-suggestions-heading i{
	color:var(--th-color-success);
}

.th-ai-suggestions-close{
	flex:0 0 2rem;
	height:2rem;
	width:2rem;
}

.th-ai-panel-header{
	align-items:center;
	background:
		radial-gradient(circle at 12% 20%,var(--th-status-success-ring),var(--th-color-transparent) 36%),
		var(--th-gradient-card);
	border-bottom:1px solid var(--th-border-base);
	display:flex;
	justify-content:space-between;
	padding:.75rem .85rem;
}

.th-ai-panel-actions{
	align-items:center;
	display:flex;
	gap:.4rem;
}

.th-ai-panel-download:disabled{
	cursor:not-allowed;
	opacity:.45;
}

.th-ai-panel-clear:disabled{
	cursor:not-allowed;
	opacity:.45;
}

.th-ai-panel-clear:not(:disabled):hover{
	background:var(--th-status-danger-bg-strong);
	box-shadow:0 12px 28px var(--th-status-danger-glow);
	color:var(--th-color-danger-contrast);
}

.th-ai-panel-identity{
	align-items:center;
	display:flex;
	gap:.6rem;
}

.th-ai-panel-avatar{
	align-items:center;
	animation:th-ai-launcher-spectrum 7s linear infinite;
	background:var(--th-gradient-brand);
	border:1px solid var(--th-overlay-white-shine);
	border-radius:50%;
	box-shadow:0 0 0 4px var(--th-status-success-ring);
	color:var(--th-color-white);
	display:flex;
	flex:0 0 2.1rem;
	height:2.1rem;
	justify-content:center;
	position:relative;
	will-change:filter;
	z-index:1;
}

.th-ai-panel-avatar::before{
	border:1px solid var(--th-overlay-white-shine);
	border-radius:50%;
	content:"";
	inset:.22rem;
	position:absolute;
}

.th-ai-panel-avatar::after{
	animation:th-ai-orbit 4.5s linear infinite;
	background:var(--th-color-white);
	border-radius:50%;
	box-shadow:0 0 .45rem var(--th-color-white);
	content:"";
	height:.22rem;
	left:50%;
	position:absolute;
	top:.05rem;
	transform-origin:0 .98rem;
	width:.22rem;
}

.th-ai-panel-avatar i{
	position:relative;
	z-index:1;
}

.th-ai-panel-header h2{
	align-items:center;
	display:flex;
	font-size:1rem;
	font-weight:800;
	margin:.12rem 0 0;
}

.th-ai-kicker{
	color:var(--th-color-text-muted);
	font-size:.65rem;
	font-weight:700;
	letter-spacing:.06em;
	text-transform:uppercase;
}

.th-ai-messages{
	display:flex;
	flex-direction:column;
	gap:.6rem;
	overflow-y:auto;
	padding:.75rem .85rem;
}

.th-ai-message{
	align-items:flex-start;
	display:flex;
	font-size:.875rem;
	gap:.45rem;
	line-height:1.45;
	max-width:94%;
}

.th-ai-message-body{
	min-width:0;
	overflow-wrap:anywhere;
}

.th-ai-message-body p{
	margin:0;
	white-space:pre-wrap;
}

.th-ai-message-stream-cursor{
	animation:th-ai-stream-cursor .8s steps(1,end) infinite;
	background:currentColor;
	border-radius:.1rem;
	display:inline-block;
	height:.95em;
	margin-left:.12rem;
	opacity:.75;
	vertical-align:-.12rem;
	width:.12rem;
}

.th-ai-message-streaming [hidden]{
	display:none!important;
}

.th-ai-message-body p+.th-ai-message-list,
.th-ai-message-body .th-ai-message-list+p,
.th-ai-message-body p+p{
	margin-top:.55rem;
}

.th-ai-message-section-title{
	align-items:center;
	background:color-mix(in srgb,var(--th-color-success) 9%,var(--th-color-transparent));
	border-left:3px solid var(--th-color-success);
	border-radius:.35rem;
	display:flex;
	font-size:.82rem;
	font-weight:800;
	letter-spacing:.01em;
	line-height:1.35;
	margin-top:.85rem;
	padding:.35rem .5rem;
}

.th-ai-message-body>p:first-child+.th-ai-message-section-title{
	margin-top:.7rem;
}

.th-ai-message-section-title+.th-ai-message-section-copy{
	margin-top:.4rem;
}

.th-ai-message-section-copy{
	line-height:1.55;
	padding:0 .15rem;
}

.th-ai-message-list{
	display:grid;
	gap:.2rem;
	margin:.55rem 0 0;
	padding-left:1.35rem;
}

.th-ai-message-section-list{
	margin-top:.4rem;
}

.th-ai-message-step-list li{
	font-weight:600;
}

.th-ai-message-bullet-list li{
	padding-bottom:.35rem;
}

.th-ai-message-list li{
	padding-left:.25rem;
}

.th-ai-message-list li+li{
	border-top:1px solid var(--th-border-soft);
	margin-top:.25rem;
	padding-top:.75rem;
}

.th-ai-message-list li::marker{
	color:var(--th-color-success);
	font-weight:800;
}

.th-ai-message-list-title{
	display:block;
	font-weight:800;
	line-height:1.45;
}

.th-ai-message-list-details{
	color:var(--th-color-text-muted);
	display:grid;
	font-size:.8rem;
	font-weight:400;
	font-variant-numeric:tabular-nums;
	gap:.26rem;
	line-height:1.45;
	margin-top:.38rem;
}

.th-ai-message-list-details>span{
	display:block;
}

.th-ai-message-list-detail-label{
	color:var(--th-color-text-main);
	font-weight:700;
}

.th-ai-message>div:last-child{
	background:color-mix(in srgb,var(--th-color-info) 18%,var(--th-card-bg-hover));
	border:1px solid var(--th-status-info-border);
	border-radius:.25rem .75rem .75rem .75rem;
	padding:.55rem .65rem;
}

.th-ai-message-user{
	align-self:flex-end;
	flex-direction:row-reverse;
}

.th-ai-message-user>div:last-child{
	background:color-mix(in srgb,var(--th-color-success) 24%,var(--th-card-bg-hover));
	border-color:var(--th-status-success-border-medium);
	border-radius:.75rem .25rem .75rem .75rem;
}

.th-ai-message-icon{
	align-items:center;
	background:var(--th-gradient-cta);
	border-radius:50%;
	color:var(--th-color-white);
	display:flex;
	flex:0 0 1.5rem;
	font-size:.78rem;
	height:1.5rem;
	justify-content:center;
}

.th-ai-assistant.is-thinking .th-ai-panel-avatar,
.th-ai-message-thinking .th-ai-message-icon{
	animation:th-ai-thinking-color 1.15s ease-in-out infinite;
}

.th-ai-message-thinking>div:last-child{
	align-items:center;
	display:inline-flex;
	gap:.48rem;
	min-height:2.35rem;
	padding:.55rem .75rem;
}

.th-ai-typing-label{
	color:var(--th-color-text-muted);
	font-size:.74rem;
	font-weight:700;
	white-space:nowrap;
}

.th-ai-typing-dots{
	align-items:center;
	display:inline-flex;
	gap:.18rem;
	height:.75rem;
}

.th-ai-typing-dot{
	animation:th-ai-typing-dot 1.15s ease-in-out infinite;
	background:var(--th-color-info);
	border-radius:50%;
	height:.34rem;
	opacity:.34;
	width:.34rem;
}

.th-ai-typing-dot:nth-child(2){
	animation-delay:.16s;
}

.th-ai-typing-dot:nth-child(3){
	animation-delay:.32s;
}

.th-ai-message-meta{
	color:var(--th-color-text-muted);
	display:block;
	font-size:.68rem;
	margin-top:.35rem;
}

.th-ai-message .th-ai-chart{
	min-width:min(20rem,100%);
}

.th-ai-message-gallery{
	display:grid;
	gap:.45rem;
	grid-template-columns:repeat(2,minmax(0,1fr));
	margin-top:.55rem;
}

.th-ai-message-gallery-item{
	align-items:center;
	background:var(--th-card-bg);
	border:1px solid var(--th-border-soft);
	border-radius:.6rem;
	display:flex;
	justify-content:center;
	min-height:7.5rem;
	overflow:hidden;
}

.th-ai-message-gallery-item:focus-visible{
	outline:3px solid var(--th-border-cyan);
	outline-offset:2px;
}

.th-ai-message-gallery-item img{
	display:block;
	height:7.5rem;
	object-fit:contain;
	width:100%;
}

.th-ai-message-files{
	display:grid;
	gap:.45rem;
	margin-top:.55rem;
}

.th-ai-message-file{
	align-items:center;
	appearance:none;
	background:color-mix(in srgb,var(--th-card-bg) 88%,var(--th-status-success-bg));
	border:1px solid color-mix(in srgb,var(--th-color-success) 34%,var(--th-border-soft));
	border-radius:.75rem;
	color:var(--th-color-text-main);
	cursor:pointer;
	display:grid;
	font:inherit;
	gap:.65rem;
	grid-template-columns:2.3rem minmax(0,1fr) 1.8rem;
	padding:.65rem;
	text-align:left;
	transition:border-color .2s ease,box-shadow .2s ease,transform .2s ease;
	width:100%;
}

.th-ai-message-file:hover{
	border-color:var(--th-color-success);
	box-shadow:0 .55rem 1.4rem color-mix(in srgb,var(--th-color-success) 13%,var(--th-color-transparent));
	transform:translateY(-1px);
}

.th-ai-message-file:focus-visible{
	outline:3px solid var(--th-border-cyan);
	outline-offset:2px;
}

.th-ai-message-file:disabled{
	cursor:wait;
	opacity:.72;
}

.th-ai-message-file-icon{
	align-items:center;
	background:var(--th-status-success-bg);
	border-radius:.6rem;
	color:var(--th-color-success);
	display:flex;
	font-size:1.2rem;
	height:2.3rem;
	justify-content:center;
	width:2.3rem;
}

.th-ai-message-file-copy{
	display:block;
	min-width:0;
}

.th-ai-message-file-copy strong,
.th-ai-message-file-copy small{
	display:block;
	overflow:hidden;
	text-overflow:ellipsis;
	white-space:nowrap;
}

.th-ai-message-file-copy strong{
	font-size:.78rem;
	font-weight:800;
}

.th-ai-message-file-copy small{
	color:var(--th-color-text-muted);
	font-size:.66rem;
	margin-top:.16rem;
}

.th-ai-message-file-action{
	align-items:center;
	color:var(--th-color-success);
	display:flex;
	font-size:1rem;
	justify-content:center;
}

.th-ai-message-file[aria-busy="true"] .th-ai-message-file-action i{
	animation:th-ai-orbit 1s linear infinite;
}

.th-ai-message-actions{
	display:flex;
	flex-wrap:wrap;
	gap:.35rem;
	margin-top:.45rem;
}

.th-ai-message-actions .th-btn,
.th-ai-suggestions .th-btn{
	font-size:.78rem;
	font-weight:800;
	line-height:1.2;
	padding:.48rem .75rem;
}

.th-ai-suggestions{
	display:flex;
	flex-direction:column;
	gap:.35rem;
	overflow-y:auto;
	padding:.55rem;
}

.th-ai-suggestions-toggle{
	color:var(--th-color-text-muted);
	flex:0 0 2.5rem;
	height:2.5rem;
	width:2.5rem;
}

.th-ai-suggestions .th-btn{
	align-items:center;
	display:flex;
	font-size:.82rem;
	gap:.55rem;
	justify-content:flex-start;
	min-height:2.75rem;
	text-align:left;
	white-space:normal;
}

.th-ai-suggestion-label{
	line-height:1.25;
	overflow-wrap:anywhere;
}

.th-ai-suggestions .th-btn i{
	color:var(--th-color-success);
	flex:0 0 1rem;
	text-align:center;
	width:1rem;
}

.th-ai-suggestions-toggle.is-active{
	background:var(--th-badge-bg);
	color:var(--th-color-success);
}

.th-ai-composer{
	align-items:center;
	border-top:1px solid var(--th-border-base);
	display:flex;
	gap:.45rem;
	padding:.6rem .85rem;
}

.th-ai-question-field{
	flex:1 1 auto;
	min-width:0;
	position:relative;
}

.th-ai-composer textarea{
	background:var(--th-card-bg-hover);
	border:1px solid var(--th-border-base);
	border-radius:.65rem;
	color:inherit;
	display:block;
	font-size:.875rem;
	line-height:1.35;
	max-height:4.75rem;
	min-height:2.5rem;
	padding:.58rem .65rem;
	resize:vertical;
	width:100%;
}

.th-ai-question-field.has-voice-input textarea{
	padding-right:2.75rem;
}

.th-ai-voice-btn{
	background:var(--th-color-transparent);
	color:var(--th-color-text-muted);
	font-size:.95rem;
	height:1.9rem;
	position:absolute;
	right:.3rem;
	top:50%;
	transform:translateY(-50%);
	width:1.9rem;
}

.th-ai-voice-btn[hidden]{
	display:none;
}

.th-ai-voice-btn:hover{
	transform:translateY(-50%) scale(1.04);
}

.th-ai-voice-btn.is-listening{
	animation:th-ai-voice-pulse 1.1s ease-in-out infinite;
	background:var(--th-gradient-cta);
	color:var(--th-color-white);
}

.th-ai-send-btn{
	background:var(--th-gradient-cta);
	color:var(--th-color-white);
	flex:0 0 2.5rem;
	font-size:1rem;
	height:2.5rem;
	width:2.5rem;
}

.th-ai-send-btn:disabled{
	cursor:wait;
}

.th-ai-disclaimer{
	color:var(--th-color-text-muted);
	font-size:.65rem;
	line-height:1.35;
	margin:0;
	padding:0 .85rem .55rem;
	text-align:center;
}

.th-ai-highlight{
	animation:th-ai-pulse 1s ease-in-out 3;
	outline:3px solid var(--th-color-success) !important;
	outline-offset:4px;
}

@keyframes th-ai-pulse{
	50%{
		box-shadow:0 0 0 .55rem var(--th-ring-cyan);
	}
}

@keyframes th-ai-orbit{
	to{
		transform:rotate(360deg);
	}
}

@keyframes th-ai-launcher-spectrum{
	0%,
	100%{
		filter:hue-rotate(0deg) saturate(1.08) brightness(1.02);
	}

	25%{
		filter:hue-rotate(90deg) saturate(1.2) brightness(1.08);
	}

	50%{
		filter:hue-rotate(180deg) saturate(1.25) brightness(1.04);
	}

	75%{
		filter:hue-rotate(270deg) saturate(1.18) brightness(1.08);
	}
}

@keyframes th-ai-thinking-color{
	0%,
	100%{
		filter:hue-rotate(0deg) brightness(1);
		transform:scale(1);
	}

	50%{
		filter:hue-rotate(115deg) brightness(1.18);
		transform:scale(1.08);
	}
}

@keyframes th-ai-typing-dot{
	0%,
	60%,
	100%{
		opacity:.34;
		transform:translateY(0);
	}

	30%{
		opacity:1;
		transform:translateY(-.22rem);
	}
}

@keyframes th-ai-stream-cursor{
	50%{
		opacity:.18;
	}
}

@keyframes th-ai-voice-pulse{
	50%{
		box-shadow:0 0 0 .28rem var(--th-ring-cyan);
	}
}

@media (prefers-reduced-motion:reduce){
	.th-ai-launcher,
	.th-ai-launcher::before{
		transition:none;
	}

	.th-ai-launcher-orb::after,
	.th-ai-panel-avatar::after,
	.th-ai-assistant.is-thinking .th-ai-panel-avatar,
	.th-ai-message-thinking .th-ai-message-icon,
	.th-ai-typing-dot,
	.th-ai-message-stream-cursor{
		animation:none;
	}

	.th-ai-launcher-orb,
	.th-ai-panel-avatar{
		animation:none;
		filter:hue-rotate(150deg) saturate(1.16) brightness(1.06);
		will-change:auto;
	}

	.th-ai-voice-btn.is-listening{
		animation:none;
	}

	.th-ai-assistant.is-thinking .th-ai-panel-avatar,
	.th-ai-message-thinking .th-ai-message-icon{
		background:var(--th-color-info);
	}

	.th-ai-typing-dot{
		opacity:.75;
	}

	.th-ai-launcher:hover{
		transform:none;
	}

	.th-ai-highlight{
		animation:none;
	}
}

@media (max-width:991.98px){
	.th-ai-suggestions-panel{
		bottom:3.65rem;
		max-height:min(22rem,calc(100dvh - 9rem));
		position:absolute;
		right:0;
		width:min(18rem,calc(100vw - 3rem));
		z-index:3;
	}
}

@media (max-width:575.98px){
	.th-ai-assistant{
		--th-ai-edge-offset:.8rem;
		right:.8rem;
	}

	.th-ai-footer-dock:not(:empty){
		padding-bottom:.8rem;
		padding-left:.8rem;
		padding-right:.8rem;
	}

	.th-ai-panel{
		height:min(33rem,calc(100vh - 4.75rem));
		height:min(33rem,calc(100dvh - 4.75rem));
		width:calc(100vw - 1.6rem);
	}

	.th-ai-launcher{
		min-height:3.85rem;
		padding:.3rem;
	}

	.th-ai-launcher-copy,
	.th-ai-launcher-status{
		display:none;
	}

	.th-ai-chart{
		min-width:0;
		padding:.65rem;
	}
}
