/**
 * Front-end chat widget CSS.
 *
 * @package MyBot
 */

/*
 * Typography is pinned inside the widget, and pinned hard.
 *
 * Vietnamese needs glyphs from the Latin Extended Additional block. A theme whose body font is
 * a webfont loaded with only the "latin" subset has none of them, so the browser fills those
 * characters from a different font: one sentence then comes out in two typefaces and the
 * diacritics look wrong — which is what "the Vietnamese font is broken" usually turns out to
 * be. A rule that targets elements directly (for example `.fl-page-content p`) beats a
 * font-family inherited from an ancestor, so every descendant is named here, and the form
 * controls separately because a browser gives <button> and <input> their own default font
 * instead of inheriting one. The stack ends in families that always carry Vietnamese, so it
 * degrades safely. Scoped to the widget: nothing outside it is affected.
 */
.mybot-widget,
.mybot-widget *,
.mybot-widget button,
.mybot-widget input,
.mybot-widget textarea,
.mybot-widget select {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif !important;
}

.mybot-widget {
	--mybot-color: #2563eb;
	--mybot-height: 480px;
	background: #fff;
	border-radius: 14px;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
	display: flex;
	flex-direction: column;
	font-size: 14px;
	line-height: 1.55;
	/*
	 * The composer grows with the question, so the widget has to have a ceiling of its own. The
	 * floating panel is anchored a fixed distance from the bottom of the screen, so without this a
	 * five-line question on a phone would push the widget's own header — and its close button — off
	 * the top of the viewport. The message list is the part that gives way; see below.
	 */
	max-height: calc(100vh - 110px);
	overflow: hidden;
	width: 380px;
}

.mybot-widget--inline {
	margin: 20px auto;
	max-width: 100%;
	width: 100%;
}

/* ===== Widget header ===== */
.mybot-widget__header {
	align-items: center;
	background: var(--mybot-color);
	color: #fff;
	display: flex;
	gap: 8px;
	padding: 12px 14px;
}

/*
 * The brand mark in the widget header and on the launcher.
 *
 * Both sit on the plugin's own primary colour, which a site owner can change — so the mark rides on
 * a white circle rather than directly on the colour. The logo is blue on white, and blue-on-blue at
 * 26px is unreadable; a white badge keeps it legible whatever colour is configured.
 */
.mybot-widget__avatar img {
	background: #fff;
	border-radius: 50%;
	display: block;
	height: 26px;
	padding: 1px;
	width: 26px;
}

.mybot-widget__title {
	flex: 1 1 auto;
	font-weight: 600;
}

.mybot-widget__minimize {
	background: transparent;
	border: 0;
	color: #fff;
	cursor: pointer;
	font-size: 22px;
	line-height: 1;
	opacity: 0.85;
	padding: 0 4px;
}

.mybot-widget__minimize:hover {
	opacity: 1;
}

/* ===== Language switch buttons ===== */
.mybot-lang {
	background: rgba(255, 255, 255, 0.18);
	border-radius: 999px;
	display: flex;
	flex: 0 0 auto;
	gap: 2px;
	padding: 2px;
}

.mybot-lang__btn {
	background: transparent;
	border: 0;
	border-radius: 999px;
	color: #fff;
	cursor: pointer;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.02em;
	line-height: 1;
	opacity: 0.75;
	padding: 5px 8px;
	transition: background 0.15s ease, opacity 0.15s ease;
	white-space: nowrap;
}

.mybot-lang__btn:hover {
	opacity: 1;
}

.mybot-lang__btn.is-active {
	background: #fff;
	color: var(--mybot-color);
	opacity: 1;
}

.mybot-widget--dark .mybot-lang {
	background: rgba(255, 255, 255, 0.12);
}

@media screen and (max-width: 400px) {
	.mybot-lang__btn {
		font-size: 10px;
		padding: 5px 6px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.mybot-lang__btn {
		transition: none;
	}
}

/* ===== Message area ===== */
.mybot-widget__messages {
	background: #f7f8fa;
	display: flex;
	/*
	 * `height` is the size this area asks for and `flex-shrink` is what lets it give way when the
	 * composer grows past the widget's ceiling. It is also a scroll container, which is what makes
	 * shrinking it safe: a flex item with `overflow-y: auto` may shrink below its content height,
	 * so the messages scroll instead of overflowing the widget.
	 */
	flex: 1 1 auto;
	flex-direction: column;
	gap: 10px;
	height: var(--mybot-height);
	overflow-y: auto;
	padding: 14px;
}

.mybot-message {
	border-radius: 12px;
	max-width: 84%;
	padding: 9px 13px;
	word-wrap: break-word;
}

.mybot-message__text {
	white-space: pre-wrap;
}

.mybot-message--bot {
	align-self: flex-start;
	background: #fff;
	border: 1px solid #e5e7eb;
	color: #1f2937;
}

.mybot-message--user {
	align-self: flex-end;
	background: var(--mybot-color);
	color: #fff;
}

.mybot-message--pending {
	align-self: flex-start;
	color: #6b7280;
	font-style: italic;
}

/* ===== Reference sources ===== */
.mybot-sources {
	border-top: 1px solid #e5e7eb;
	font-size: 12px;
	margin-top: 8px;
	padding-top: 6px;
}

.mybot-sources__title {
	color: #6b7280;
	display: block;
	font-weight: 600;
	margin-bottom: 4px;
}

.mybot-sources__list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.mybot-sources__list li {
	margin-bottom: 3px;
}

.mybot-sources__list a {
	color: var(--mybot-color);
	text-decoration: none;
}

.mybot-sources__list a:hover {
	text-decoration: underline;
}

/* ===== Feedback ===== */
.mybot-feedback {
	display: flex;
	gap: 6px;
	margin-top: 8px;
}

.mybot-feedback button {
	background: #fff;
	border: 1px solid #d1d5db;
	border-radius: 12px;
	color: #4b5563;
	cursor: pointer;
	font-size: 11px;
	padding: 3px 9px;
}

.mybot-feedback button:hover {
	border-color: var(--mybot-color);
	color: var(--mybot-color);
}

.mybot-feedback button[disabled] {
	cursor: default;
	opacity: 0.55;
}

.mybot-feedback__done {
	color: #6b7280;
	font-size: 11px;
	margin-top: 6px;
}

/*
 * ===== Hand over to a human =====
 *
 * Sits inside the bot bubble, under the answer, because that is where the dead end happened.
 * A separate box elsewhere in the panel would read as a different conversation.
 */
.mybot-support {
	border-top: 1px solid #e5e7eb;
	margin-top: 10px;
	padding-top: 10px;
}

.mybot-support__title {
	color: #111827;
	font-size: 13px;
	font-weight: 600;
	margin-bottom: 4px;
}

.mybot-support__intro {
	color: #4b5563;
	font-size: 12px;
	line-height: 1.5;
	margin: 0 0 9px;
}

.mybot-support__field {
	display: block;
	margin-bottom: 7px;
}

.mybot-support__field span {
	color: #6b7280;
	display: block;
	font-size: 11px;
	margin-bottom: 2px;
}

.mybot-support__field input,
.mybot-support__field textarea {
	background: #fff;
	border: 1px solid #d1d5db;
	border-radius: 8px;
	box-sizing: border-box;
	font-size: 12px;
	padding: 6px 9px;
	width: 100%;
}

.mybot-support__field textarea {
	min-height: 54px;
	resize: vertical;
}

.mybot-support__field input:focus,
.mybot-support__field textarea:focus {
	border-color: var(--mybot-color);
	outline: 2px solid rgba(37, 99, 235, 0.15);
}

.mybot-support__actions {
	display: flex;
	gap: 6px;
	margin-top: 9px;
}

.mybot-support__send {
	background: var(--mybot-color);
	border: 0;
	border-radius: 8px;
	color: #fff;
	cursor: pointer;
	font-size: 12px;
	font-weight: 600;
	padding: 7px 13px;
}

.mybot-support__send[disabled] {
	cursor: default;
	opacity: 0.6;
}

.mybot-support__later {
	background: transparent;
	border: 0;
	color: #6b7280;
	cursor: pointer;
	font-size: 12px;
	padding: 7px 6px;
	text-decoration: underline;
}

/* ===== The visitor's own card (1.17.0) =====
 *
 * Same visual language as the hand-over form above — a card inside the conversation, not a modal — because
 * it IS the same kind of thing: a form the visitor may fill in or ignore, drawn where they are already
 * looking. It differs in one way that matters: this card exists in the conversation even when the bot
 * answered perfectly, so it must never look like a warning or an interruption.
 */
.mybot-contact {
	border-top: 1px solid #e5e7eb;
	margin-top: 10px;
	padding-top: 10px;
}

.mybot-contact__title {
	color: #111827;
	font-size: 13px;
	font-weight: 600;
	margin-bottom: 4px;
}

/* After it is saved the title IS the answer, so it stops being a heading. */
.mybot-contact__title--done {
	color: #166534;
	font-weight: 600;
	margin: 0;
}

.mybot-contact__intro {
	color: #4b5563;
	font-size: 12px;
	line-height: 1.5;
	margin: 0 0 9px;
}

.mybot-contact__field {
	display: block;
	margin-bottom: 7px;
}

.mybot-contact__caption {
	color: #6b7280;
	display: block;
	font-size: 11px;
	margin-bottom: 2px;
}

.mybot-contact__field input,
.mybot-contact__field textarea {
	background: #fff;
	border: 1px solid #d1d5db;
	border-radius: 8px;
	box-sizing: border-box;
	font-size: 12px;
	padding: 6px 9px;
	width: 100%;
}

.mybot-contact__field textarea {
	min-height: 54px;
	resize: vertical;
}

.mybot-contact__field input:focus,
.mybot-contact__field textarea:focus {
	border-color: var(--mybot-color);
	outline: 2px solid rgba(37, 99, 235, 0.15);
}

/*
 * The honeypot: present for a bot, gone for a person. `position: absolute` + `left: -9999px` rather than
 * `display: none`, because the fields a bot fills are the ones a browser still renders — and this one is not
 * `type="hidden"` on purpose, since many bots skip those.
 */
.mybot-contact__trap {
	left: -9999px;
	position: absolute;
}

.mybot-contact__consent {
	align-items: flex-start;
	color: #4b5563;
	cursor: pointer;
	display: flex;
	font-size: 11px;
	gap: 6px;
	line-height: 1.5;
	margin: 10px 0 0;
}

.mybot-contact__consent input {
	margin: 1px 0 0;
}

.mybot-contact__actions {
	align-items: center;
	display: flex;
	gap: 6px;
	margin-top: 9px;
}

.mybot-contact__send {
	background: var(--mybot-color);
	border: 0;
	border-radius: 8px;
	color: #fff;
	cursor: pointer;
	font-size: 12px;
	font-weight: 600;
	padding: 7px 13px;
}

.mybot-contact__send[disabled] {
	cursor: default;
	opacity: 0.6;
}

.mybot-contact__later {
	background: transparent;
	border: 0;
	color: #6b7280;
	cursor: pointer;
	font-size: 12px;
	padding: 7px 6px;
	text-decoration: underline;
}

.mybot-contact__status {
	font-size: 11px;
	margin: 7px 0 0;
	min-height: 15px;
}

.mybot-contact__status--error {
	color: #b91c1c;
}

.mybot-support__status {
	color: #6b7280;
	font-size: 11px;
	margin: 7px 0 0;
	min-height: 14px;
}

.mybot-support__status--error {
	color: #b91c1c;
}

.mybot-support__done {
	color: #065f46;
	font-size: 12px;
	margin: 0;
}

.mybot-widget--dark .mybot-support {
	border-top-color: #374151;
}

.mybot-widget--dark .mybot-support__title {
	color: #f9fafb;
}

.mybot-widget--dark .mybot-support__intro,
.mybot-widget--dark .mybot-support__field span,
.mybot-widget--dark .mybot-support__status {
	color: #9ca3af;
}

.mybot-widget--dark .mybot-support__field input,
.mybot-widget--dark .mybot-support__field textarea {
	background: #1f2937;
	border-color: #4b5563;
	color: #f9fafb;
}

.mybot-widget--dark .mybot-support__done {
	color: #6ee7b7;
}

/* The visitor card, in the dark theme (1.17.0): the same rules as the hand-over form above. */
.mybot-widget--dark .mybot-contact {
	border-top-color: #374151;
}

.mybot-widget--dark .mybot-contact__title {
	color: #f9fafb;
}

.mybot-widget--dark .mybot-contact__intro,
.mybot-widget--dark .mybot-contact__caption,
.mybot-widget--dark .mybot-contact__consent,
.mybot-widget--dark .mybot-contact__status {
	color: #9ca3af;
}

.mybot-widget--dark .mybot-contact__field input,
.mybot-widget--dark .mybot-contact__field textarea {
	background: #1f2937;
	border-color: #4b5563;
	color: #f9fafb;
}

.mybot-widget--dark .mybot-contact__title--done {
	color: #6ee7b7;
}


/* ===== Composer: the row of icons and the pill the visitor types in =====
 *
 * REDESIGNED 1.15.0, to the shape the owner asked for and sent a picture of (the composer of a chat app
 * they use): **flat coloured icons in a row along the bottom**, and **the field as a filled pill**.
 *
 * What changed, and what did not:
 *
 *   - the microphone and the picture button lost their **outlines**. They were 36px circles with a grey
 *     border, which reads as a form control from 2010; a chat app draws them as plain icons that light up
 *     a soft circle when touched (`:hover`), which is what this stylesheet now does;
 *   - the field lost its border and gained a **filled** background, the same idea: a pill with a tint is a
 *     writing surface, an outlined box is an input on a form;
 *   - **no class name, attribute or label changed**, so the script, the twelve languages and every guard
 *     rule that reads this file (including `R15`'s `[hidden]` rule) keep working on the same names. A
 *     redesign that renames things is a redesign that breaks the accessibility labels nobody looks at.
 *
 * ⚠️ Two lines here are load-bearing and must survive every future restyle:
 *   `align-items: flex-end` — a six-line question must leave the icons on its LAST line, not floating in
 *   the middle of a tall box;
 *   the `[hidden]` rules further down — `display: flex` overrides the browser's own `[hidden]`, so a
 *   button that cannot work would be drawn for everybody (docs/08 muc 6.42).
 */
.mybot-widget__form {
	align-items: flex-end;
	background: #fff;
	border-top: 1px solid #e5e7eb;
	display: flex;
	gap: 6px;
	padding: 8px 10px;
}

.mybot-widget__input {
	background: #f0f2f5;
	border: 1px solid transparent;
	border-radius: 22px;
	/*
	 * Declared, not inherited: the script sets this element's height from its content, and that only
	 * lands on the intended size if the box model is known. A theme with a global `content-box` rule
	 * would otherwise add 18px of padding on top of every measurement.
	 */
	box-sizing: border-box;
	flex: 1 1 auto;
	font-size: 14px;
	/*
	 * A fixed line height, because the script that grows this box measures `scrollHeight` and
	 * compares it with `max-height`: the two only agree if a line is a known number of pixels.
	 * `max-height` is the ceiling that script reads — it is deliberately the only place this number
	 * lives (docs/08 muc 6.34), so it can be changed here without touching the JavaScript.
	 * `overflow-y` is `auto` from the start so the field is still usable with JavaScript disabled,
	 * where it never grows and simply scrolls.
	 */
	line-height: 20px;
	max-height: 132px;
	min-width: 0;
	overflow-wrap: break-word;
	overflow-y: auto;
	padding: 9px 14px;
	resize: none;
	transition: background-color 0.15s ease, border-color 0.15s ease;
}

/*
 * Focus: the pill turns white and takes the site's colour as a ring. `border-color` is animated from
 * `transparent` rather than from grey, so the pill does not appear to grow a border when it is touched.
 */
.mybot-widget__input:focus {
	background: #fff;
	border-color: var(--mybot-color);
	box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
	outline: none;
}

.mybot-widget__send {
	align-items: center;
	background: var(--mybot-color);
	border: 0;
	border-radius: 50%;
	color: #fff;
	cursor: pointer;
	display: flex;
	height: 40px;
	justify-content: center;
	/*
	 * Quiet until there is something to send (1.16.0). The owner asked for the box to "strengthen" when the
	 * customer types; this is the half of that state which lives on the button. It stays CLICKABLE while it
	 * is muted — a disabled-looking control that still answers a click is honest, while a truly `disabled`
	 * one would be a button that does nothing, which is the defect this project keeps recording (6.42).
	 */
	opacity: 0.55;
	padding: 0;
	transition: opacity 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
	width: 40px;
}

/* An icon-only button: the drawing is the whole content, and it takes its colour from `currentColor`. */
.mybot-widget__send-icon {
	align-items: center;
	display: flex;
	justify-content: center;
	line-height: 0;
}

.mybot-widget__send-icon svg {
	display: block;
}

/*
 * The strengthened state: a question is written, so the pill turns white and the arrow comes up to full
 * colour with a soft shadow. This is what "the text box will strengthen" means in pixels, and it is why
 * `growComposer()` toggles one class instead of the script styling things by hand.
 */
.mybot-widget__form.is-typing .mybot-widget__send {
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
	opacity: 1;
}

.mybot-widget__form.is-typing .mybot-widget__input {
	background: #fff;
}

.mybot-widget__send:hover {
	filter: brightness(1.08);
	opacity: 1;
}

.mybot-widget__send:disabled {
	cursor: not-allowed;
	filter: none;
	opacity: 0.4;
}

/*
 * The widget's own "visually hidden" rule (1.16.0).
 *
 * Every WordPress theme is *supposed* to ship `.screen-reader-text`, and this widget used to rely on that
 * for the label above the field. Since 1.16.0 one of those hidden labels is the word **"Send"** — so on the
 * one theme that does not define the class, the owner's request ("the send button will have the icon not
 * text") would be undone by the theme, and a stray "Send" would sit next to the arrow. The rule is declared
 * here instead, scoped to the widget, where it cannot go missing.
 */
.mybot-widget .screen-reader-text {
	border: 0;
	clip-path: inset( 50% );
	height: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute;
	white-space: nowrap;
	width: 1px;
}

/*
 * The two icon buttons, one rule each for the parts that differ and one shared shape.
 *
 * ⚠️ The **height is written once, here, and the send button carries the same number**: the three controls
 * sit on one line, and a difference of one pixel between them is visible to everybody and explainable to
 * nobody. `tools/check-widget-clicks.mjs` R9 checks that the three still agree.
 */
.mybot-widget__voice,
.mybot-widget__attach,
.mybot-widget__contact {
	align-items: center;
	background: transparent;
	border: 0;
	border-radius: 50%;
	color: var(--mybot-color);
	cursor: pointer;
	display: flex;
	font-size: 18px;
	height: 40px;
	justify-content: center;
	line-height: 1;
	padding: 0;
	transition: background-color 0.15s ease;
	width: 40px;
}

/*
 * ⚠️ `[hidden]` is repeated here on purpose. The rules above set `display: flex`, and a `display`
 * declaration OVERRIDES the browser's own `[hidden] { display: none }` — so without these lines the
 * microphone would be visible in every browser, including Firefox where pressing it can do nothing at
 * all, and the picture button would be offered on sites whose model cannot read a picture. That is the
 * failure this widget's markup is written to avoid (docs/08 muc 6.42), and it is one CSS line away at all
 * times. `tools/check-attachments.mjs` R9 and R15 fail the build if either line goes.
 */
.mybot-widget__voice[hidden],
.mybot-widget__attach[hidden] {
	display: none;
}

.mybot-widget__voice:hover,
.mybot-widget__attach:hover,
.mybot-widget__contact:hover {
	background: rgba(0, 0, 0, 0.06);
}

.mybot-widget__voice:focus-visible,
.mybot-widget__attach:focus-visible,
.mybot-widget__contact:focus-visible {
	background: rgba(0, 0, 0, 0.06);
	box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
	outline: none;
}

.mybot-widget__voice:disabled,
.mybot-widget__attach:disabled,
.mybot-widget__contact:disabled {
	cursor: not-allowed;
	opacity: 0.5;
}

/* While it is listening: filled, and the colour a person reads as "live". */
.mybot-widget__voice.is-listening {
	background: #dc2626;
	color: #fff;
}

/*
 * The picture button (1.14.0).
 *
 * Leftmost in the composer, on purpose: attach-then-write is the order an attachment is thought of, and a
 * control that appears between the words and Send is one people press by accident. Its shape — flat,
 * coloured, borderless, 40px, in a row with the microphone — is set once in the shared rule above
 * (1.15.0), because two copies of a shape is two shapes the day one of them is edited.
 */

/*
 * The file input is opened by the button and never shown. `display: none` rather than `hidden`,
 * because `.click()` on a `display: none` input still opens the browser's picker in every browser this
 * widget supports, while a `<input type="file">` that is merely off-screen can be focused by Tab and
 * read aloud by a screen reader as a second, unlabelled "choose file" control.
 */
.mybot-widget__file {
	display: none;
}

/*
 * The picture that is about to be sent.
 *
 * It sits between the conversation and the composer, in the same column width, so what the visitor is
 * about to send is visible at the same time as the question they are typing about it.
 *
 * Restyled 1.15.0 with the composer: the thumbnail lost its outline and the remove button lost its
 * border, so the strip reads as part of the same writing surface rather than as a second form.
 */
.mybot-widget__staged {
	align-items: center;
	background: #f7f8fa;
	border-top: 1px solid #e5e7eb;
	display: flex;
	gap: 10px;
	padding: 8px 10px;
}

.mybot-widget__staged[hidden] {
	display: none;
}

.mybot-widget__staged-image {
	border-radius: 10px;
	display: block;
	height: 52px;
	object-fit: cover;
	width: 52px;
}

.mybot-widget__staged-remove {
	align-items: center;
	background: rgba(0, 0, 0, 0.06);
	border: 0;
	border-radius: 50%;
	color: #4b5563;
	cursor: pointer;
	display: flex;
	font-size: 15px;
	height: 28px;
	justify-content: center;
	line-height: 1;
	padding: 0;
	width: 28px;
}

.mybot-widget__staged-remove:hover {
	background: rgba(220, 38, 38, 0.12);
	color: #dc2626;
}

.mybot-widget__staged-remove:focus-visible {
	box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.25);
	outline: none;
}

.mybot-widget__staged-remove:disabled {
	cursor: not-allowed;
	opacity: 0.6;
}

/*
 * The picture inside the visitor's own bubble.
 *
 * `max-width: 100%` and the fixed ceiling are both needed: the bubble is as wide as the conversation
 * column, and a picture wider than that has to fit rather than stretch the column, which would move
 * every other bubble on the screen.
 */
.mybot-message__image {
	border-radius: 8px;
	display: block;
	margin-bottom: 6px;
	max-height: 220px;
	max-width: 100%;
	object-fit: contain;
	width: auto;
}

/* ===== Dark theme ===== */
.mybot-widget--dark {
	background: #111827;
}

.mybot-widget--dark .mybot-widget__messages {
	background: #1f2937;
}

.mybot-widget--dark .mybot-message--bot {
	background: #374151;
	border-color: #4b5563;
	color: #f9fafb;
}

.mybot-widget--dark .mybot-widget__form {
	background: #111827;
	border-top-color: #374151;
}

/*
 * The composer, in the dark theme (1.15.0).
 *
 * The pill is one step LIGHTER than the form behind it, which is how a filled writing surface reads on a
 * dark background: the light theme fills it darker than white, and the dark theme has to do the opposite
 * or the field disappears into the panel.
 */
.mybot-widget--dark .mybot-widget__input {
	background: #374151;
	border-color: transparent;
	color: #f9fafb;
}

.mybot-widget--dark .mybot-widget__input:focus {
	background: #1f2937;
	border-color: var(--mybot-color);
}

.mybot-widget--dark .mybot-widget__voice,
.mybot-widget--dark .mybot-widget__attach,
.mybot-widget--dark .mybot-widget__contact {
	color: #e5e7eb;
}

.mybot-widget--dark .mybot-widget__voice:hover,
.mybot-widget--dark .mybot-widget__attach:hover,
.mybot-widget--dark .mybot-widget__contact:hover,
.mybot-widget--dark .mybot-widget__voice:focus-visible,
.mybot-widget--dark .mybot-widget__attach:focus-visible,
.mybot-widget--dark .mybot-widget__contact:focus-visible {
	background: rgba(255, 255, 255, 0.1);
}

.mybot-widget--dark .mybot-feedback button {
	background: #1f2937;
	border-color: #4b5563;
	color: #d1d5db;
}

/* The staged picture, in the dark theme: same structure, one step lighter than the form. */
.mybot-widget--dark .mybot-widget__staged {
	background: #1f2937;
	border-top-color: #374151;
}

.mybot-widget--dark .mybot-widget__staged-remove {
	background: rgba(255, 255, 255, 0.1);
	color: #e5e7eb;
}

.mybot-widget--dark .mybot-widget__staged-remove:hover {
	background: rgba(220, 38, 38, 0.25);
	color: #fecaca;
}

/* ===== Floating launcher ===== */
.mybot-launcher {
	bottom: 22px;
	position: fixed;
	z-index: 999998;
}

.mybot-launcher--bottom-right {
	right: 22px;
}

.mybot-launcher--bottom-left {
	left: 22px;
}

.mybot-launcher__button {
	align-items: center;
	background: var(--mybot-color);
	border: 0;
	border-radius: 50%;
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
	cursor: pointer;
	display: flex;
	height: 58px;
	justify-content: center;
	transition: transform 0.15s ease;
	width: 58px;
}

.mybot-launcher__button:hover {
	transform: translateY(-2px);
}

.mybot-launcher__icon {
	align-items: center;
	display: flex;
	justify-content: center;
}

.mybot-launcher__icon img {
	background: #fff;
	border-radius: 50%;
	display: block;
	height: 36px;
	padding: 2px;
	width: 36px;
}

/* Open: the mark gives way to the close glyph, painted over the button colour. */
.mybot-launcher__icon.is-open img {
	display: none;
}

.mybot-launcher__icon.is-open::after {
	color: #fff;
	content: '\2715';
	font-size: 24px;
	line-height: 1;
}

/* ===== Launcher label and invitation bubble =====
 *
 * Both are opt-in: the label is drawn only when the owner typed one (the class is added in PHP at
 * the same moment), and the bubble only when there is text AND a delay above zero. With no label the
 * button above is untouched, so every site that shipped before this still looks the same.
 *
 * The style is a class rather than an inline style, so both layouts stay in the stylesheet where
 * they can be seen and changed together (docs/08 muc 6.47).
 */
.mybot-launcher__label {
	color: #fff;
	display: block;
	font-size: 12px;
	font-weight: 600;
	line-height: 1.1;
	max-width: 108px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* Text under the icon: a taller pill that still reads as one round control. */
.mybot-launcher--label-below .mybot-launcher__button {
	border-radius: 22px;
	flex-direction: column;
	gap: 4px;
	height: auto;
	padding: 8px 12px 9px;
	width: auto;
}

/* Text beside the icon: the button grows sideways, which reads best in a wide corner. */
.mybot-launcher--label-beside .mybot-launcher__button {
	border-radius: 999px;
	flex-direction: row;
	gap: 9px;
	height: auto;
	padding: 8px 16px 8px 10px;
	width: auto;
}

.mybot-launcher--label-beside .mybot-launcher__label {
	font-size: 14px;
	max-width: 180px;
}

.mybot-launcher__teaser {
	align-items: flex-start;
	background: #fff;
	border-radius: 12px;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
	display: flex;
	gap: 6px;
	max-width: 260px;
	padding: 12px 30px 12px 14px;
	position: absolute;
	bottom: calc(100% + 12px);
}

.mybot-launcher--bottom-right .mybot-launcher__teaser {
	right: 0;
}

.mybot-launcher--bottom-left .mybot-launcher__teaser {
	left: 0;
}

.mybot-launcher__teaser-open {
	background: transparent;
	border: 0;
	color: #1f2937;
	cursor: pointer;
	font: inherit;
	font-size: 14px;
	line-height: 1.4;
	padding: 0;
	text-align: left;
}

.mybot-launcher__teaser-close {
	background: transparent;
	border: 0;
	color: #6b7280;
	cursor: pointer;
	font-size: 18px;
	line-height: 1;
	padding: 0 2px;
	position: absolute;
	right: 6px;
	top: 4px;
}

.mybot-launcher__teaser-close:hover {
	color: #111827;
}

/* ===== Floating panel ===== */
.mybot-floating-panel {
	bottom: 92px;
	position: fixed;
	z-index: 999999;
}

.mybot-floating-panel[data-mybot-panel="bottom-right"] {
	right: 22px;
}

.mybot-floating-panel[data-mybot-panel="bottom-left"] {
	left: 22px;
}

.mybot-floating-panel .mybot-widget {
	width: min(380px, calc(100vw - 44px));
}

@media screen and (max-width: 480px) {
	.mybot-floating-panel {
		bottom: 84px;
		left: 12px;
		right: 12px;
	}

	.mybot-floating-panel .mybot-widget {
		width: 100%;
	}

	.mybot-widget__messages {
		height: min(var(--mybot-height), 60vh);
	}

	.mybot-launcher {
		bottom: 16px;
	}

	.mybot-launcher--bottom-right {
		right: 16px;
	}

	.mybot-launcher--bottom-left {
		left: 16px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.mybot-launcher__button {
		transition: none;
	}

	.mybot-launcher__button:hover {
		transform: none;
	}
}
