#asc-chat-root {
	--asc-accent: #2563eb;
	--asc-accent-contrast: #ffffff;
	--asc-bg: #ffffff;
	--asc-text: #1f2937;
	--asc-muted: #6b7280;
	--asc-border: #e5e7eb;
	--asc-user-bg: var(--asc-accent);
	--asc-bot-bg: #f3f4f6;
	position: fixed;
	bottom: 20px;
	right: 20px;
	z-index: 99999;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-size: 15px;
	line-height: 1.5;
}

.asc-launcher {
	width: 60px;
	height: 60px;
	border-radius: 50%;
	border: none;
	background: var(--asc-accent);
	color: var(--asc-accent-contrast);
	cursor: pointer;
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
	display: flex;
	align-items: center;
	justify-content: center;
	transition: transform 0.15s ease, box-shadow 0.15s ease;
	margin-left: auto;
}

.asc-launcher:hover {
	transform: scale(1.06);
	box-shadow: 0 8px 26px rgba(0, 0, 0, 0.24);
}

#asc-chat-root.asc-open .asc-launcher {
	transform: scale(0.92);
}

.asc-launcher-custom {
	padding: 0;
	overflow: hidden;
}

.asc-launcher-img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: 50%;
	display: block;
}

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

.asc-panel {
	position: absolute;
	bottom: 76px;
	right: 0;
	width: 380px;
	max-width: calc(100vw - 40px);
	height: 560px;
	max-height: calc(100vh - 120px);
	background: var(--asc-bg);
	color: var(--asc-text);
	border-radius: 16px;
	box-shadow: 0 16px 48px rgba(0, 0, 0, 0.22);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	animation: asc-pop 0.18s ease;
}

@keyframes asc-pop {
	from { opacity: 0; transform: translateY(12px) scale(0.98); }
	to { opacity: 1; transform: translateY(0) scale(1); }
}

.asc-header {
	background: var(--asc-accent);
	color: var(--asc-accent-contrast);
	padding: 14px 16px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex: 0 0 auto;
}

.asc-title {
	font-weight: 600;
	font-size: 16px;
}

.asc-close {
	background: transparent;
	border: none;
	color: inherit;
	font-size: 26px;
	line-height: 1;
	cursor: pointer;
	opacity: 0.9;
	padding: 0 4px;
}

.asc-close:hover { opacity: 1; }

.asc-header-actions {
	display: flex;
	align-items: center;
	gap: 6px;
}

.asc-change {
	background: rgba(255, 255, 255, 0.18);
	border: none;
	color: inherit;
	font-size: 12px;
	padding: 4px 10px;
	border-radius: 999px;
	cursor: pointer;
	white-space: nowrap;
}

.asc-change:hover { background: rgba(255, 255, 255, 0.32); }
.asc-change[hidden] { display: none; }

.asc-lang-select {
	background: rgba(255, 255, 255, 0.18);
	color: inherit;
	border: none;
	font: inherit;
	font-size: 12px;
	padding: 4px 6px;
	border-radius: 999px;
	cursor: pointer;
	max-width: 130px;
}

.asc-lang-select option {
	color: #1f2937;
}

/* ----- Selettore skill ----- */
.asc-picker {
	display: flex;
	flex-direction: column;
	gap: 10px;
	padding: 2px;
}

.asc-picker-title {
	font-size: 15px;
	font-weight: 600;
	color: var(--asc-text);
	margin: 4px 0 2px;
}

/* Voci del selettore come accordion */
.asc-pick-card {
	background: var(--asc-bg);
	border: 1px solid var(--asc-border);
	border-radius: 12px;
	overflow: hidden;
}

.asc-pick-card:hover {
	border-color: var(--asc-accent);
}

.asc-pick-head {
	display: flex;
	align-items: center;
	gap: 12px;
	width: 100%;
	text-align: left;
	background: transparent;
	border: none;
	padding: 12px 14px;
	cursor: pointer;
	font: inherit;
	color: var(--asc-text);
}

.asc-pick-icon {
	font-size: 22px;
	line-height: 1.2;
	flex: 0 0 auto;
}

.asc-pick-label {
	font-weight: 600;
	font-size: 14px;
	flex: 1 1 auto;
	min-width: 0;
}

.asc-pick-arrow {
	flex: 0 0 auto;
	color: var(--asc-muted);
	transition: transform 0.15s ease;
}

.asc-pick-head[aria-expanded="true"] .asc-pick-arrow {
	transform: rotate(-180deg);
}

.asc-pick-body {
	padding: 0 14px 14px 48px;
}

.asc-pick-desc {
	font-size: 12.5px;
	color: var(--asc-muted);
	line-height: 1.4;
	margin: 0 0 10px;
}

.asc-pick-select {
	background: var(--asc-accent);
	color: var(--asc-accent-contrast);
	border: none;
	border-radius: 8px;
	padding: 8px 16px;
	font: inherit;
	font-size: 13.5px;
	font-weight: 600;
	cursor: pointer;
	transition: opacity 0.15s ease;
}

.asc-pick-select:hover { opacity: 0.9; }
.asc-pick-select:active { transform: scale(0.98); }

.asc-messages {
	flex: 1 1 auto;
	overflow-y: auto;
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	background: #fafafa;
}

/* ----- Chip cliccabili (es. categorie prodotto) ----- */
.asc-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 2px;
}

.asc-chip {
	background: var(--asc-bg);
	border: 1px solid var(--asc-accent);
	color: var(--asc-accent);
	border-radius: 999px;
	padding: 7px 14px;
	font: inherit;
	font-size: 13.5px;
	line-height: 1.2;
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease;
}

.asc-chip:hover {
	background: var(--asc-accent);
	color: var(--asc-accent-contrast);
}

.asc-chip:active {
	transform: scale(0.98);
}

.asc-chip-link {
	background: var(--asc-accent);
	color: var(--asc-accent-contrast);
	border-color: var(--asc-accent);
}

.asc-chip-link:hover {
	opacity: 0.9;
	background: var(--asc-accent);
	color: var(--asc-accent-contrast);
}

.asc-chip-change {
	border-style: dashed;
	border-color: var(--asc-muted);
	color: var(--asc-muted);
}

.asc-chip-change:hover {
	background: var(--asc-muted);
	color: var(--asc-bg);
}

.asc-msg {
	display: flex;
	flex-direction: column;
	max-width: 85%;
}

.asc-msg-user {
	align-self: flex-end;
	align-items: flex-end;
}

.asc-msg-assistant {
	align-self: flex-start;
	align-items: flex-start;
}

.asc-bubble {
	padding: 10px 14px;
	border-radius: 14px;
	word-wrap: break-word;
	overflow-wrap: anywhere;
}

.asc-msg-user .asc-bubble {
	background: var(--asc-user-bg);
	color: var(--asc-accent-contrast);
	border-bottom-right-radius: 4px;
}

.asc-msg-assistant .asc-bubble {
	background: var(--asc-bot-bg);
	color: var(--asc-text);
	border-bottom-left-radius: 4px;
}

.asc-md-table {
	border-collapse: collapse;
	width: 100%;
	margin: 8px 0;
	font-size: 13px;
	display: block;
	overflow-x: auto;
}

.asc-md-table th,
.asc-md-table td {
	border: 1px solid var(--asc-border);
	padding: 6px 8px;
	text-align: left;
	vertical-align: top;
	white-space: nowrap;
}

.asc-md-table th {
	background: rgba(0, 0, 0, 0.04);
	font-weight: 600;
}

.asc-md-table td:first-child,
.asc-md-table th:first-child {
	white-space: normal;
}

.asc-bubble a { color: inherit; text-decoration: underline; }
.asc-msg-assistant .asc-bubble a { color: var(--asc-accent); }
.asc-bubble code {
	background: rgba(0, 0, 0, 0.07);
	padding: 1px 5px;
	border-radius: 4px;
	font-size: 0.9em;
}

.asc-feedback {
	display: flex;
	align-items: center;
	gap: 6px;
	margin-top: 6px;
}

.asc-fb-btn {
	background: transparent;
	border: 1px solid var(--asc-border);
	border-radius: 8px;
	padding: 2px 8px;
	font-size: 14px;
	line-height: 1.4;
	cursor: pointer;
	opacity: 0.7;
	transition: opacity 0.15s ease, border-color 0.15s ease;
}

.asc-fb-btn:hover { opacity: 1; border-color: var(--asc-accent); }
.asc-fb-btn:disabled { cursor: default; }
.asc-fb-active { opacity: 1; border-color: var(--asc-accent); }

.asc-fb-thanks {
	font-size: 12px;
	color: var(--asc-muted);
}

.asc-sources {
	width: 100%;
	margin-top: 10px;
	padding-top: 8px;
	border-top: 1px solid var(--asc-border);
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.asc-sources-label {
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--asc-muted);
	font-weight: 700;
	margin-bottom: 2px;
}

.asc-source {
	display: block;
	font-size: 13px;
	line-height: 1.3;
	color: var(--asc-accent);
	text-decoration: none;
	max-width: 100%;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.asc-source::before {
	content: "↗";
	margin-right: 6px;
	opacity: 0.6;
}

.asc-source:hover { text-decoration: underline; }

.asc-input-row {
	flex: 0 0 auto;
	display: flex;
	align-items: flex-end;
	gap: 8px;
	padding: 10px 12px;
	border-top: 1px solid var(--asc-border);
	background: var(--asc-bg);
}

.asc-input {
	flex: 1 1 auto;
	resize: none;
	border: 1px solid var(--asc-border);
	border-radius: 10px;
	padding: 9px 12px;
	font-family: inherit;
	font-size: 15px;
	line-height: 1.4;
	max-height: 120px;
	color: var(--asc-text);
	background: #fff;
}

.asc-input:focus {
	outline: none;
	border-color: var(--asc-accent);
	box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.asc-send {
	flex: 0 0 auto;
	width: 42px;
	height: 42px;
	border-radius: 10px;
	border: none;
	background: var(--asc-accent);
	color: var(--asc-accent-contrast);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: opacity 0.15s ease;
}

.asc-send:disabled { opacity: 0.5; cursor: default; }

.asc-typing .asc-bubble {
	display: flex;
	gap: 4px;
	align-items: center;
}

.asc-typing .asc-bubble.asc-status {
	font-style: italic;
	color: var(--asc-muted);
	font-size: 13px;
}

.asc-dot {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--asc-muted);
	animation: asc-blink 1.2s infinite ease-in-out both;
}

.asc-dot:nth-child(2) { animation-delay: 0.2s; }
.asc-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes asc-blink {
	0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
	40% { opacity: 1; transform: scale(1); }
}

@media (max-width: 480px) {
	#asc-chat-root { bottom: 12px; right: 12px; }
	.asc-panel-float {
		width: calc(100vw - 24px);
		height: calc(100vh - 90px);
		bottom: 72px;
	}
}

/* ----- Modalità inline (shortcode) ----- */
.asc-chat-inline {
	--asc-accent: #2563eb;
	--asc-accent-contrast: #ffffff;
	--asc-bg: #ffffff;
	--asc-text: #1f2937;
	--asc-muted: #6b7280;
	--asc-border: #e5e7eb;
	--asc-user-bg: var(--asc-accent);
	--asc-bot-bg: #f3f4f6;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-size: 15px;
	line-height: 1.5;
	display: block;
	max-width: 100%;
	margin: 1em 0;
}

.asc-panel-inline {
	position: relative;
	bottom: auto;
	right: auto;
	width: 100%;
	height: 100%;
	max-height: none;
	border: 1px solid var(--asc-border);
	border-radius: 16px;
	box-shadow: 0 4px 18px rgba(0, 0, 0, 0.08);
	animation: none;
}
