/* Panel styles. The site's colours are set as custom properties at the top of the token block;
   everything is scoped to #site-assistant so nothing here can leak into the theme. */

#site-assistant,
#site-assistant * {
	box-sizing: border-box;
}

/* Host-theme leakage guard. Extra applies text-transform:uppercase to buttons and to
   ::placeholder, and its own font/borders to form fields; the panel must not inherit any of it. */
#site-assistant button,
#site-assistant input,
#site-assistant textarea,
#site-assistant select {
	font: inherit;
	letter-spacing: normal;
	text-transform: none;
	text-shadow: none;
}

#site-assistant textarea::placeholder,
#site-assistant input::placeholder {
	text-transform: none;
	letter-spacing: normal;
	opacity: 1;
}

#site-assistant {
	--sa-canvas: #ecf0f5;
	--sa-surface: #ffffff;
	/* Panel wash. Two colours set per site (Settings -> Site Assistant -> Panel wash) and seeded
	   from the theme's own palette when they are left blank; both are blended toward white so a
	   saturated brand colour becomes a tint rather than a wall of colour. */
	--sa-grad-a: #ffffff;
	--sa-grad-b: #eef3fa;
	--sa-grad: linear-gradient(180deg, var(--sa-grad-a) 0%, var(--sa-grad-b) 100%);
	--sa-band: #3e5062;
	--sa-band-2: #334453;
	--sa-ink: #313131;
	--sa-ink-link: rgba(0, 0, 0, 0.75);
	--sa-link: #2fa3f2;
	--sa-action: #f78da7;
	--sa-action-2: #e9768f;
	--sa-border: #e7e7e7;
	--sa-grey-1: #f3f4f5;
	--sa-grey-2: #f0f0f0;
	--sa-grey-3: #e9edf1;
	--sa-muted: #94a3b1;
	--sa-alert: #c93a51;
	--sa-pill-shadow: rgba(0, 0, 0, 0.24) 7px 6px 28px 1px;
	--sa-ease: cubic-bezier(0.2, 0.8, 0.2, 1);
	/* Motion speeds. Readers who are older or just reading slowly need a change on screen to
	   last long enough to notice and act on: the pill rocks gently for three seconds and the
	   "Hi" bubble stays up for nine, rather than being gone before they have looked twice.
	   JS mirrors these two numbers (WIGGLE_MS / HI_HOLD_MS) - change them together. */
	--sa-wiggle-ms: 3000ms;
	--sa-hi-ms: 9000ms;
	--sa-hi-fade: 900ms;
	position: fixed;
	inset: auto 0 0 auto;
	z-index: 9990;
	font-family: "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
		"Hiragino Sans", "Hiragino Sans GB", "PingFang SC", "Microsoft YaHei", "Malgun Gothic",
		"Noto Sans CJK SC", "Noto Sans SC", "Noto Sans", "Noto Sans Arabic", "Noto Sans Devanagari",
		sans-serif;
	font-size: 14px;
	line-height: 1.6;
	color: var(--sa-ink);
	text-align: left;
}

/* ---------- launcher ---------- */
#site-assistant .sa-launch {
	position: absolute;
	right: 20px;
	bottom: 20px;
	display: inline-flex;
	align-items: center;
	gap: 9px;
	height: 48px;
	padding: 0 20px 0 16px;
	margin: 0;
	border: 0;
	border-radius: 9999px;
	background: var(--sa-action); /* same pink as the site's "Visit <site>" pills */
	color: var(--sa-ink);         /* and the same ink-on-pink contrast they use */
	font: inherit;
	font-size: 15px;
	font-weight: 600;
	line-height: 1;
	letter-spacing: 0.1px;
	text-decoration: none;
	cursor: pointer;
	box-shadow: var(--sa-pill-shadow);
	transition: transform 0.18s var(--sa-ease), background 0.18s var(--sa-ease),
		box-shadow 0.18s var(--sa-ease), opacity 0.16s var(--sa-ease);
	white-space: nowrap;
	-webkit-appearance: none;
	appearance: none;
}

#site-assistant .sa-launch:hover {
	background: var(--sa-action-2);
	transform: translateY(-2px);
	box-shadow: rgba(0, 0, 0, 0.3) 8px 10px 30px 1px;
}

#site-assistant .sa-launch:active {
	transform: translateY(0) scale(0.985);
}

#site-assistant .sa-launch:focus-visible {
	outline: 3px solid var(--sa-link);
	outline-offset: 3px;
}

#site-assistant .sa-launch .sa-spark {
	width: 18px;
	height: 18px;
	flex: 0 0 18px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linejoin: round;
	stroke-linecap: round;
}

/* the mark is a speech bubble with three dots - the site's own logo is a speech bubble,
   and it cannot be mistaken for the four-point star Gemini uses */
#site-assistant .sa-spark circle {
	fill: currentColor;
	stroke: none;
}

@keyframes sa-twinkle {
	0%, 86%, 100% { transform: scale(1) rotate(0deg); }
	90% { transform: scale(1.14) rotate(9deg); }
	94% { transform: scale(0.96) rotate(-4deg); }
}

#site-assistant .sa-launch.is-compact {
	width: 48px;
	padding: 0;
	justify-content: center;
}

#site-assistant .sa-launch.is-compact .sa-label {
	display: none;
}

#site-assistant .sa-dot {
	position: absolute;
	top: -3px;
	right: -3px;
	min-width: 19px;
	height: 19px;
	padding: 0 5px;
	border-radius: 9999px;
	background: var(--sa-alert);
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	line-height: 19px;
	text-align: center;
	box-shadow: 0 0 0 3px #fff;
	transform: scale(0);
	transition: transform 0.26s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#site-assistant .sa-dot.is-on { transform: scale(1); }

/* ---------- panel ---------- */
/* Docked right-hand panel: full viewport height, slides in from the edge, and the page is
   pushed left by the same width (see the body rule below). */
#site-assistant .sa-panel {
	position: fixed;
	top: 0;
	right: 0;
	bottom: 0;
	width: 384px;
	height: 100%;
	max-height: none;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	background: var(--sa-grad);
	border-radius: 0;
	box-shadow: rgba(0, 0, 0, 0.16) -14px 0 38px -18px;
	transform: translateX(101%);
	pointer-events: none;
	transition: transform 0.22s var(--sa-ease);
	font-size: 14px;
	z-index: 9991;
}

#site-assistant.is-open .sa-panel,
html[data-sa="open"] #site-assistant .sa-panel {
	transform: none;
	pointer-events: auto;
}

/* The WP admin bar is fixed at z-index 99999 and would cover the panel's header. */
body.admin-bar #site-assistant .sa-panel {
	top: 32px;
}

/* Push, not overlay: the reader keeps the whole article visible beside the chat. */
body {
	transition: margin-right 0.22s var(--sa-ease);
}

html[data-sa="open"][data-sa-layout="push"] body {
	margin-right: 384px !important;
}

#site-assistant.is-open .sa-launch,
html[data-sa="open"] #site-assistant .sa-launch {
	opacity: 0;
	transform: translateY(10px) scale(0.9);
	pointer-events: none;
}

#site-assistant .sa-head {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 12px 12px 16px;
	background: var(--sa-band);
	color: #fff;
	flex: 0 0 auto;
}

#site-assistant .sa-av {
	width: 30px;
	height: 30px;
	flex: 0 0 30px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.14);
	display: grid;
	place-items: center;
}

#site-assistant .sa-av svg {
	width: 16px;
	height: 16px;
	fill: none;
	stroke: #fff;
	stroke-width: 2;
	stroke-linejoin: round;
	stroke-linecap: round;
}
#site-assistant .sa-av svg circle { fill: #fff; stroke: none; }

#site-assistant .sa-tt { line-height: 1.25; min-width: 0; }

#site-assistant .sa-nm {
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 1.2px;
	text-transform: uppercase;
}

#site-assistant .sa-tt {
	/* let the subtitle ellipsis instead of pushing the action buttons out of the header */
	min-width: 0;
}

#site-assistant .sa-sub {
	font-size: 11.5px;
	color: #b9c8d6;
	letter-spacing: 0.2px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

#site-assistant .sa-acts { margin-left: auto; display: flex; gap: 2px; }

#site-assistant .sa-acts button {
	width: 30px;
	height: 30px;
	display: grid;
	place-items: center;
	padding: 0;
	margin: 0;
	border: 0;
	border-radius: 3px;
	background: none;
	color: #dfe8f0;
	font: inherit;
	font-size: 15px;
	line-height: 1;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
}

#site-assistant .sa-acts button:hover { background: rgba(255, 255, 255, 0.13); color: #fff; }
#site-assistant .sa-acts button:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }

/* ---------- stream ---------- */
#site-assistant .sa-body {
	flex: 1 1 auto;
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 16px 16px 6px;
	color-scheme: light;
	scrollbar-width: thin;
	scrollbar-color: #cfd9e3 transparent;
}

#site-assistant .sa-msg { margin: 0 0 16px; animation: sa-rise 0.2s var(--sa-ease) both; }

@keyframes sa-rise {
	from { opacity: 0; transform: translateY(8px); }
	to { opacity: 1; transform: none; }
}

#site-assistant .sa-msg.is-me { display: flex; justify-content: flex-end; }

#site-assistant .sa-msg.is-me .sa-bubble {
	background: var(--sa-grey-1);
	border-radius: 3px;
	padding: 9px 13px;
	max-width: 86%;
	font-size: 14px;
	color: var(--sa-ink);
	white-space: pre-wrap;
	overflow-wrap: anywhere;
}

#site-assistant .sa-bot { font-size: 14px; line-height: 1.62; color: var(--sa-ink); overflow-wrap: anywhere; }
#site-assistant .sa-bot p { margin: 0 0 10px; }
#site-assistant .sa-bot p:last-child { margin-bottom: 0; }
#site-assistant .sa-bot ul { margin: 0 0 10px; padding-left: 18px; list-style: disc; }
#site-assistant .sa-bot li { margin: 0 0 3px; }
#site-assistant .sa-bot strong { font-weight: 600; color: #111; }

#site-assistant .sa-bot a {
	color: var(--sa-ink-link);
	text-decoration: underline;
	text-decoration-color: var(--sa-link);
	text-underline-position: under;
}

#site-assistant .sa-bot a:hover { text-decoration-color: var(--sa-band); }

/* source chips */
#site-assistant .sa-srcs { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; }

#site-assistant .sa-src {
	display: inline-block;
	padding: 3px 7px;
	border: 1px solid transparent;
	border-radius: 3px;
	background: var(--sa-grey-2);
	color: var(--sa-band) !important;
	font-size: 10.5px;
	font-weight: 600;
	letter-spacing: 0.7px;
	text-transform: uppercase;
	text-decoration: none !important;
	line-height: 1.5;
}

#site-assistant .sa-src:hover { background: var(--sa-grey-3); border-color: var(--sa-border); }

/* CTA - deliberately the same object as the site's "Visit <site>" button */
#site-assistant .sa-cta {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 12px 0 0;
	padding: 11px 20px;
	border-radius: 9999px;
	background: var(--sa-action);
	color: var(--sa-ink) !important;
	font-size: 14.5px;
	font-weight: 600;
	text-decoration: none !important;
	box-shadow: var(--sa-pill-shadow);
	transition: background 0.16s var(--sa-ease), transform 0.16s var(--sa-ease);
}

#site-assistant .sa-cta:hover { background: var(--sa-action-2); transform: translateY(-1px); }
#site-assistant .sa-cta .sa-cta-why { font-weight: 400; font-size: 12px; opacity: 0.75; }
#site-assistant .sa-cta .sa-cta-arw { margin-left: auto; font-size: 16px; }

/* chips / suggestions */
#site-assistant .sa-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 0; }

/* suggestion icons: small, muted, inline with the label */
#site-assistant .sa-chip svg {
	width: 13px;
	height: 13px;
	flex: 0 0 13px;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.8;
	stroke-linejoin: round;
	stroke-linecap: round;
	opacity: 0.7;
}

#site-assistant .sa-chip {
	padding: 6px 12px;
	border: 1px solid var(--sa-border);
	border-radius: 9999px;
	background: #fff;
	color: var(--sa-band);
	font: inherit;
	font-size: 12.5px;
	line-height: 1.4;
	cursor: pointer;
	transition: border-color 0.15s var(--sa-ease), background 0.15s var(--sa-ease);
	-webkit-appearance: none;
	appearance: none;
	text-align: left;
}

#site-assistant .sa-chip:hover { border-color: var(--sa-band); background: #f8fafc; }
#site-assistant .sa-chip:focus-visible { outline: 2px solid var(--sa-link); outline-offset: 2px; }

#site-assistant .sa-hello { margin: 0 0 12px; }

/* typing */
#site-assistant .sa-typing { display: inline-flex; gap: 4px; padding: 6px 0 8px; }

#site-assistant .sa-typing i {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: #a9b6c4;
	animation: sa-bob 1.1s var(--sa-ease) infinite;
}

#site-assistant .sa-typing i:nth-child(2) { animation-delay: 0.13s; }
#site-assistant .sa-typing i:nth-child(3) { animation-delay: 0.26s; }

@keyframes sa-bob {
	0%, 60%, 100% { transform: translateY(0); opacity: 0.6; }
	30% { transform: translateY(-4px); opacity: 1; }
}

/* ---------- composer ---------- */
#site-assistant .sa-foot {
	flex: 0 0 auto;
	border-top: 1px solid rgba(62, 80, 98, 0.09);
	padding: 10px 12px 11px;
	background: linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.6) 100%);
}

#site-assistant .sa-in {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	padding: 7px 7px 7px 11px;
	border: 1px solid transparent;
	border-radius: 3px;
	background: rgba(0, 0, 0, 0.05);
	transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

#site-assistant .sa-in:focus-within {
	background: #fff;
	border-color: var(--sa-band);
	box-shadow: 0 0 0 3px rgba(62, 80, 98, 0.08);
}

#site-assistant .sa-in textarea {
	flex: 1 1 auto;
	width: 100%;
	max-height: 96px;
	margin: 0;
	padding: 5px 0;
	border: 0;
	background: none;
	box-shadow: none;
	resize: none;
	font: inherit;
	font-size: 14px;
	line-height: 1.5;
	color: var(--sa-ink);
	outline: none;
	overflow-y: auto;
}

#site-assistant .sa-in textarea::placeholder { color: var(--sa-muted); }

/* The composer's bottom row holds only the send button now - no attachment or model picker,
   because the bot accepts neither. Base layout keeps the button inline as it always was. */
#site-assistant .sa-tools { display: contents; }

#site-assistant .sa-send {
	width: 32px;
	height: 32px;
	flex: 0 0 32px;
	display: grid;
	place-items: center;
	padding: 0;
	margin: 0;
	border: 0;
	border-radius: 50%;
	background: var(--sa-band);
	color: #fff;
	cursor: pointer;
	transition: background 0.15s, transform 0.15s;
	-webkit-appearance: none;
	appearance: none;
}

#site-assistant .sa-send svg { width: 15px; height: 15px; fill: currentColor; }
#site-assistant .sa-send:hover { background: var(--sa-band-2); transform: scale(1.05); }
#site-assistant .sa-send[disabled] { background: #c3cdd7; cursor: default; transform: none; }
#site-assistant .sa-send:focus-visible { outline: 2px solid var(--sa-link); outline-offset: 2px; }

#site-assistant .sa-hint {
	display: flex;
	justify-content: space-between;
	gap: 8px;
	padding: 6px 2px 0;
	font-size: 10.5px;
	color: var(--sa-muted);
}

/* ---------- disclosure ---------- */
/* One short line under the composer; the full wording opens on click, so the notice costs a
   dozen pixels instead of a paragraph nobody reads. */
#site-assistant .sa-note {
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	color: var(--sa-muted);
	font: inherit;
	font-size: 10.5px;
	line-height: 1.4;
	text-decoration: underline;
	text-decoration-style: dotted;
	text-underline-offset: 2px;
	cursor: pointer;
	white-space: nowrap;
	-webkit-appearance: none;
	appearance: none;
}

#site-assistant .sa-note:hover { color: var(--sa-ink); text-decoration-style: solid; }
#site-assistant .sa-note:focus-visible { outline: 2px solid var(--sa-link); outline-offset: 2px; border-radius: 2px; }
#site-assistant .sa-note[aria-expanded="true"] { color: var(--sa-ink); text-decoration-style: solid; }

/* floats above the composer, so opening it never pushes the conversation up */
#site-assistant .sa-note-pop {
	position: absolute;
	left: 12px;
	right: 12px;
	bottom: calc(100% - 4px);
	z-index: 3;
	padding: 11px 14px;
	border: 1px solid var(--sa-border);
	border-radius: 10px;
	background: #fff;
	box-shadow: rgba(0, 0, 0, 0.16) 0 8px 24px -8px;
	font-size: 11.5px;
	line-height: 1.5;
	color: var(--sa-ink);
	text-align: left;
}

#site-assistant .sa-note-pop[hidden] { display: none; }

#site-assistant .sa-foot { position: relative; }

/* ============================================================================
   Ask Gemini layout - Chrome only (root gets .is-chrome from panel.js).
   Chrome users already know this shape, so the panel stops looking like a blog
   widget and looks like the assistant they are used to: light ground, centred
   mark and greeting, big white icon pills, one tall rounded composer with an
   auto-model label. Everything added here is additive; the base rules above stay
   as the fallback for every other browser.
   ============================================================================ */

#site-assistant.is-chrome .sa-panel {
	/* Gemini's ground is a pale wash that deepens towards the bottom. Same direction in brand
	   colours: near-white at the top, warming into a faint pink, then settling into the site's
	   blue-grey canvas at the foot. Low saturation on purpose - tinted white, not a coloured panel. */
	background: linear-gradient(180deg, var(--sa-grad-a) 0%, var(--sa-grad-b) 100%);
	box-shadow: rgba(0, 0, 0, 0.18) -20px 0 50px -24px;
}

/* --- header: quiet, icon-only actions like Gemini's, sitting on the gradient --- */
#site-assistant.is-chrome .sa-head {
	background: transparent;
	color: var(--sa-ink-2);
	padding: 14px 14px 10px 20px;
	gap: 9px;
}

#site-assistant.is-chrome .sa-head .sa-av {
	width: 26px;
	height: 26px;
	flex: 0 0 26px;
	background: #eef1f5;
}

#site-assistant.is-chrome .sa-head .sa-av svg {
	width: 14px;
	height: 14px;
	stroke: var(--sa-band);
}

#site-assistant.is-chrome .sa-head .sa-av svg circle { fill: var(--sa-band); }

#site-assistant.is-chrome .sa-nm {
	font-size: 13.5px;
	font-weight: 600;
	letter-spacing: 0;
	text-transform: none;
	color: var(--sa-ink-2);
}

#site-assistant.is-chrome .sa-sub {
	font-size: 11.5px;
	color: var(--sa-muted);
}

#site-assistant.is-chrome .sa-acts button {
	width: 34px;
	height: 34px;
	border-radius: 50%;
	color: #5f6368;
	font-size: 17px;
}

#site-assistant.is-chrome .sa-acts button:hover,
#site-assistant.is-chrome .sa-acts button:focus-visible {
	background: #f1f3f4;
	color: var(--sa-ink-2);
	outline: none;
}

/* Gemini's header keeps only a menu and a close cross. We keep minimise and new conversation
   (the only reset now that the composer has no buttons) and drop nothing but the visual weight. */
#site-assistant.is-chrome .sa-acts button { display: grid; }

/* --- body: roomy, airy, scrolled in the middle --- */
#site-assistant.is-chrome .sa-body {
	padding: 4px 20px 10px;
	display: flex;
	flex-direction: column;
}

/* the empty state is centred in the available space, like Gemini's, and drops back to the top
   as soon as a conversation starts */
#site-assistant.is-chrome .sa-msg {
	flex: 0 0 auto;
}

#site-assistant.is-chrome .sa-msg.is-bot:first-of-type {
	margin-top: auto;
	padding-top: 8px;
}

#site-assistant.is-chrome .sa-body:has(.sa-msg.is-me) .sa-msg.is-bot:first-of-type,
#site-assistant.is-chrome .sa-body:has(.sa-msg:nth-child(3)) .sa-msg.is-bot:first-of-type {
	margin-top: 0;
}

/* --- the hero: mark above a big friendly greeting, centred --- */
/* off by default so other browsers keep their empty state; .is-chrome turns it on */
#site-assistant .sa-hero { display: none; }

#site-assistant.is-chrome .sa-hero {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 22px;
	padding: 44px 0 30px;
	text-align: center;
}

#site-assistant.is-chrome .sa-mark {
	width: 42px;
	height: 42px;
	display: grid;
	place-items: center;
}

#site-assistant.is-chrome .sa-heromark {
	width: 44px;
	height: 44px;
	display: block;
	color: var(--sa-band);
}

/* the back bubble idles, the front one stays put - a quiet "someone is here" without a spinner */
#site-assistant.is-chrome .sa-heromark path:last-of-type {
	animation: sa-mark-breathe 5s var(--sa-ease) infinite;
}

@keyframes sa-mark-breathe {
	0%, 100% { opacity: 0.45; }
	50% { opacity: 0.85; }
}

#site-assistant.is-chrome .sa-title {
	margin: 0;
	font-size: 26px;
	line-height: 1.3;
	font-weight: 400;
	letter-spacing: -0.2px;
	color: var(--sa-ink-2);
	text-wrap: balance;
}

/* the plain-text hello doubles as Gemini's quiet subtitle under the hero */
#site-assistant.is-chrome .sa-hello {
	margin: 0 0 18px;
	padding: 0 2px;
	font-size: 14.5px;
	line-height: 1.55;
	color: var(--sa-muted);
	text-align: left;
}

/* --- suggestion pills: white, tall, left-aligned, icon then text --- */
#site-assistant.is-chrome .sa-chips {
	display: flex;
	flex-direction: column;
	gap: 10px;
	margin: 0;
}

#site-assistant.is-chrome .sa-chip {
	display: flex;
	align-items: center;
	gap: 14px;
	width: 100%;
	padding: 15px 18px;
	border: 0;
	border-radius: 14px;
	background: #fff;
	box-shadow: rgba(0, 0, 0, 0.1) 0 1px 3px 0, rgba(0, 0, 0, 0.06) 0 4px 12px -4px;
	color: var(--sa-ink-2);
	font-size: 14.5px;
	line-height: 1.35;
	text-align: left;
}

#site-assistant.is-chrome .sa-chip:hover {
	background: #fff;
	border-color: transparent;
	box-shadow: rgba(0, 0, 0, 0.16) 0 2px 6px 0, rgba(0, 0, 0, 0.1) 0 8px 20px -6px;
	transform: translateY(-1px);
}

#site-assistant.is-chrome .sa-chip:focus-visible { outline: 2px solid var(--sa-link); outline-offset: 2px; }

#site-assistant.is-chrome .sa-chip svg {
	width: 19px;
	height: 19px;
	flex: 0 0 19px;
	fill: none;
	stroke: #5f6368;
	stroke-width: 1.7;
	stroke-linejoin: round;
	stroke-linecap: round;
}

/* --- conversation: no bubbles, text on the canvas, like Gemini's turns --- */
#site-assistant.is-chrome .sa-msg.is-me .sa-bubble {
	background: #f1f3f4;
	border-radius: 18px 18px 4px 18px;
	padding: 10px 15px;
	font-size: 14.5px;
}

#site-assistant.is-chrome .sa-bot { font-size: 14.5px; line-height: 1.65; }

/* --- composer: one tall rounded box with an inner tool row --- */
#site-assistant.is-chrome .sa-foot {
	border-top: 0;
	padding: 4px 20px 14px;
	background: none;
}

#site-assistant.is-chrome .sa-in {
	display: block;
	padding: 12px 12px 8px 16px;
	border: 1px solid #f0e2e9;
	border-radius: 26px;
	background: rgba(255, 255, 255, 0.55);
	transition: background 0.15s var(--sa-ease), border-color 0.15s var(--sa-ease),
		box-shadow 0.15s var(--sa-ease);
}

#site-assistant.is-chrome .sa-in:focus-within {
	background: #fff;
	border-color: #ead4de;
	box-shadow: rgba(201, 122, 148, 0.18) 0 1px 8px 0;
}

#site-assistant.is-chrome .sa-in textarea {
	display: block;
	width: 100%;
	padding: 2px 4px 6px;
	font-size: 15px;
	line-height: 1.5;
	color: var(--sa-ink-2);
}

#site-assistant.is-chrome .sa-in textarea::placeholder { color: #7c8794; }

#site-assistant.is-chrome .sa-tools {
	display: flex;
	align-items: center;
	gap: 10px;
}

#site-assistant.is-chrome .sa-send {
	width: 38px;
	height: 38px;
	flex: 0 0 38px;
	margin-left: auto;
	background: var(--sa-band);
}

#site-assistant.is-chrome .sa-send svg { width: 16px; height: 16px; }

#site-assistant.is-chrome .sa-hint {
	padding: 8px 6px 0;
	font-size: 10.5px;
	color: #9aa5b1;
}

/* the "Hi" bubble sits above a taller composer in this layout */
#site-assistant.is-chrome .sa-hi { bottom: 96px; }

@media (max-width: 720px) {
	#site-assistant.is-chrome .sa-title { font-size: 25px; }
	#site-assistant.is-chrome .sa-hero { padding: 28px 0 22px; gap: 18px; }
	#site-assistant.is-chrome .sa-foot { padding: 4px 14px 12px; }
}

/* The "Clear" control and the page-change divider that the persistent thread needs. */
#site-assistant .sa-clear {
	width: auto !important;
	padding: 0 9px !important;
	font-size: 11.5px;
	font-weight: 600;
	letter-spacing: 0.2px;
	border-radius: 9999px !important;
}

#site-assistant .sa-clear span { line-height: 1; }

/* Seam between pages inside one conversation: a quiet rule, never a message bubble. */
#site-assistant .sa-pagecut {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 14px 0 10px;
	font-size: 11px;
	color: var(--sa-muted);
	text-align: center;
}

#site-assistant .sa-pagecut::before,
#site-assistant .sa-pagecut::after {
	content: "";
	flex: 1 1 auto;
	height: 1px;
	background: var(--sa-border);
}

#site-assistant.is-chrome .sa-pagecut { color: #8b95a1; }
#site-assistant.is-chrome .sa-pagecut::before,
#site-assistant.is-chrome .sa-pagecut::after { background: rgba(62, 80, 98, 0.16); }

#site-assistant.is-chrome .sa-clear {
	color: #5f6368 !important;
	background: rgba(255, 255, 255, 0.6) !important;
	border: 1px solid rgba(62, 80, 98, 0.16) !important;
}
#site-assistant.is-chrome .sa-clear:hover { background: #fff !important; color: var(--sa-ink-2) !important; }

/* ---------- quiet attention: a wiggle and a small "Hi" ---------- */
/* Slower and gentler than a typical attention jiggle: fewer, wider beats over 3s, so the
   movement is easy to follow instead of a flick the eye misses. */
@keyframes sa-wiggle {
	0%, 100% { transform: rotate(0deg) translateY(0) scale(1); }
	14% { transform: rotate(-4deg) translateY(-1px) scale(1.06); }
	32% { transform: rotate(4deg) translateY(-1px) scale(1.1); }
	50% { transform: rotate(-3deg) scale(1.07); }
	68% { transform: rotate(2deg) scale(1.04); }
	86% { transform: rotate(-0.8deg) scale(1.015); }
}

#site-assistant .sa-launch.is-wiggle {
	animation: sa-wiggle var(--sa-wiggle-ms) var(--sa-ease) 1;
}

#site-assistant .sa-hi {
	position: absolute;
	right: 76px; /* clears the theme's back-to-top button, which shares this corner */
	bottom: 82px;
	padding: 9px 17px;
	border-radius: 9999px;
	background: linear-gradient(160deg, #4b5f75 0%, #3e5062 52%, #2c3b49 100%);
	color: #fff;
	border: 1.5px solid rgba(255, 255, 255, 0.65);
	box-shadow:
		rgba(20, 30, 40, 0.42) 0 12px 28px -10px,
		rgba(255, 255, 255, 0.5) 0 1px 0 inset;
	font-size: 14.5px;
	font-weight: 650;
	letter-spacing: 0.2px;
	line-height: 1.35;
	white-space: nowrap;
	opacity: 0;
	transform-origin: 100% 100%;
	transition: opacity var(--sa-hi-fade) var(--sa-ease), transform var(--sa-hi-fade) var(--sa-ease);
	pointer-events: none;
	z-index: 2;
}

/* a tail pointing at the pill, so the bubble reads as coming from it */
#site-assistant .sa-hi::after {
	content: "";
	position: absolute;
	right: 22px;
	bottom: -5px;
	width: 11px;
	height: 11px;
	background: linear-gradient(160deg, #3e5062, #2c3b49);
	transform: rotate(45deg);
	border-radius: 2px;
}

/* pop in, then breathe once while it is on screen (~9s, matching the JS hold), and fade out
   over the last 10% - a fade gives the eye time to register that it is leaving */
#site-assistant .sa-hi.is-on {
	opacity: 1;
	animation: sa-hi-pop var(--sa-hi-ms) var(--sa-ease) both;
}

@keyframes sa-hi-pop {
	0%   { opacity: 0; transform: translateY(14px) scale(0.76); }
	6%   { opacity: 1; transform: translateY(0) scale(1.06); }
	12%  { transform: scale(0.98); }
	18%  { transform: scale(1); }
	44%  { transform: scale(1.07); }
	58%  { transform: scale(1); }
	90%  { opacity: 1; transform: scale(1); }
	100% { opacity: 0; transform: scale(0.98); }
}

/* ---------- nudge ---------- */
#site-assistant .sa-nudge {
	position: absolute;
	right: 20px;
	bottom: 80px;
	width: 300px;
	padding: 14px 16px 13px;
	background: #fff;
	border: 1px solid var(--sa-border);
	border-radius: 3px;
	box-shadow: rgba(0, 0, 0, 0.18) 0 10px 30px -6px;
	opacity: 0;
	transform: translateY(10px) scale(0.98);
	pointer-events: none;
	transition: opacity 0.26s var(--sa-ease), transform 0.26s var(--sa-ease);
}

#site-assistant .sa-nudge.is-on { opacity: 1; transform: none; pointer-events: auto; }

#site-assistant .sa-nudge .sa-who {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0 0 7px;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 1.1px;
	text-transform: uppercase;
	color: var(--sa-band);
}

#site-assistant .sa-nudge .sa-av { width: 22px; height: 22px; flex: 0 0 22px; background: var(--sa-band); }
#site-assistant .sa-nudge .sa-av svg { width: 12px; height: 12px; }

#site-assistant .sa-nudge p { margin: 0 0 11px; font-size: 13.5px; line-height: 1.5; color: var(--sa-ink); }

#site-assistant .sa-nudge .sa-row { display: flex; align-items: center; gap: 8px; }

#site-assistant .sa-nudge .sa-reply {
	padding: 6px 14px;
	border: 0;
	border-radius: 9999px;
	background: var(--sa-grey-2);
	color: var(--sa-band);
	font: inherit;
	font-size: 12.5px;
	font-weight: 600;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
}

#site-assistant .sa-nudge .sa-reply:hover { background: var(--sa-border); }

#site-assistant .sa-nudge .sa-x {
	margin-left: auto;
	padding: 2px 4px;
	border: 0;
	background: none;
	color: var(--sa-muted);
	font: inherit;
	font-size: 17px;
	line-height: 1;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
}

#site-assistant .sa-nudge .sa-x:hover { color: var(--sa-ink); }

/* ---------- states ---------- */
#site-assistant .sa-hide { display: none !important; }

/* ---------- small screens: bottom sheet ---------- */
@media (max-width: 720px) {
	/* Stretch the anchor itself, so a 100% panel is exactly the visible width (100vw includes
	   the scrollbar and pushes the sheet off the left edge). */
	#site-assistant {
		left: 0;
		right: 0;
		bottom: 0;
		width: auto;
		height: 0;
	}

	/* phone: chat takes the lower three quarters, content stays visible above it */
	#site-assistant .sa-panel {
		top: auto;
		left: 0;
		right: 0;
		bottom: 0;
		width: auto;
		height: 75dvh;
		max-height: 75dvh;
		border-radius: 0;
		transform: translateY(100%);
		box-shadow: rgba(0, 0, 0, 0.3) 0 -10px 40px -12px;
	}

	html[data-sa="open"] #site-assistant .sa-panel {
		transform: none;
	}

	/* bottom-anchored sheet: the admin bar must not pin it to the top */
	body.admin-bar #site-assistant .sa-panel {
		top: auto;
		height: 75dvh;
		max-height: 75dvh;
	}

	html[data-sa="open"][data-sa-layout="push"] body {
		margin-right: 0 !important;
	}

	#site-assistant .sa-launch { right: 14px; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }
	#site-assistant .sa-nudge { right: 14px; width: calc(100vw - 28px); bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
	#site-assistant .sa-hi { right: 14px; bottom: calc(74px + env(safe-area-inset-bottom, 0px)); }
	#site-assistant .sa-hint span:first-child { display: none; }
}

@media (prefers-reduced-motion: reduce) {
	#site-assistant *,
	#site-assistant *::before,
	#site-assistant *::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
	}
}
