/* IMPF AI Customer Support - website chat widget.
   Everything is scoped to #impf-ai-chat-root so it cannot affect the theme.
   All colours, fonts, sizes and corners (--impf-*) are injected from
   AI Support > Chat Design. System fonts only. */

#impf-ai-chat-root {
	--impf-c-primary: #05376a;
	--impf-c-primary-strong: #0a4585;
	--impf-c-on-primary: #ffffff;
	--impf-c-header: #05376a;
	--impf-c-on-header: #ffffff;
	--impf-c-user: #05376a;
	--impf-c-on-user: #ffffff;
	--impf-c-hdr-btn: #2a5688;
	--impf-c-hdr-btn-hover: #4a6f9b;
	--impf-c-tint: #e8eef6;
	--impf-c-accent: #e85c0c;
	--impf-c-accent-strong: #ee7230;
	--impf-c-on-accent: #111111;
	--impf-c-bg: #f6f8fa;
	--impf-c-bot: #ffffff;
	--impf-c-text: #1d2b36;
	--impf-c-muted: #62717e;
	--impf-c-line: #dde4ea;
	--impf-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	--impf-fs: 15px;
	--impf-r-panel: 16px;
	--impf-r-bubble: 14px;
	--impf-r-ctl: 10px;
	--impf-w: 380px;
	--impf-h: 620px;
	--impf-off-x: 20px;
	--impf-off-y: 20px;
	position: fixed;
	bottom: var(--impf-off-y);
	z-index: 99990;
	font-family: var(--impf-font);
	font-size: var(--impf-fs);
	line-height: 1.5;
	color: var(--impf-c-text);
}
#impf-ai-chat-root.impf-chat-right { right: var(--impf-off-x); }
#impf-ai-chat-root.impf-chat-left { left: var(--impf-off-x); }
#impf-ai-chat-root *, #impf-ai-chat-root *::before, #impf-ai-chat-root *::after { box-sizing: border-box; }
#impf-ai-chat-root [hidden] { display: none !important; }
#impf-ai-chat-root button, #impf-ai-chat-root input, #impf-ai-chat-root textarea { font: inherit; color: inherit; margin: 0; }
#impf-ai-chat-root button { cursor: pointer; }
#impf-ai-chat-root :focus-visible { outline: 3px solid var(--impf-c-accent); outline-offset: 2px; }
#impf-ai-chat-root .impf-chat-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Launcher */
#impf-ai-chat-root .impf-chat-launcher { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 54px; padding: 0 22px 0 18px; border: 0; border-radius: 999px; background: var(--impf-c-primary); color: var(--impf-c-on-primary); font-weight: 600; box-shadow: 0 10px 28px -8px rgba(0, 0, 0, 0.5); transition: transform 0.15s ease, background 0.15s ease; }
#impf-ai-chat-root .impf-chat-launcher:hover { background: var(--impf-c-primary-strong); transform: translateY(-1px); }
#impf-ai-chat-root.is-open .impf-chat-launcher { display: none; }
#impf-ai-chat-root.is-icon .impf-chat-launcher { width: 58px; height: 58px; min-height: 58px; padding: 0; }
#impf-ai-chat-root.is-icon .impf-chat-launcher-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Panel */
#impf-ai-chat-root .impf-chat-panel { position: absolute; bottom: 0; width: var(--impf-w); max-width: calc(100vw - 24px); height: min(var(--impf-h), calc(100vh - var(--impf-off-y) - 20px)); display: flex; flex-direction: column; background: var(--impf-c-bot); border-radius: var(--impf-r-panel); overflow: hidden; box-shadow: 0 22px 60px -14px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(0, 0, 0, 0.06); animation: impf-chat-in 0.18s ease-out; }
#impf-ai-chat-root.impf-chat-right .impf-chat-panel { right: 0; }
#impf-ai-chat-root.impf-chat-left .impf-chat-panel { left: 0; }
@keyframes impf-chat-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* Header */
#impf-ai-chat-root .impf-chat-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; background: var(--impf-c-header); color: var(--impf-c-on-header); }
#impf-ai-chat-root .impf-chat-ident { display: flex; align-items: center; gap: 12px; min-width: 0; }
#impf-ai-chat-root .impf-chat-avatar { flex: none; width: 42px; height: 42px; border-radius: 50%; object-fit: cover; background: var(--impf-c-hdr-btn); box-shadow: 0 0 0 2px var(--impf-c-hdr-btn-hover); }
#impf-ai-chat-root .impf-chat-avatar.is-letter { display: grid; place-items: center; font-weight: 700; font-size: 18px; color: var(--impf-c-on-header); }
#impf-ai-chat-root .impf-chat-who { min-width: 0; }
#impf-ai-chat-root .impf-chat-title { font-weight: 650; font-size: 1.07em; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#impf-ai-chat-root .impf-chat-sub { display: flex; align-items: center; gap: 6px; font-size: 0.82em; line-height: 1.3; opacity: 0.88; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
#impf-ai-chat-root .impf-chat-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: #2ecc71; box-shadow: 0 0 0 2px rgba(46, 204, 113, 0.28); }
#impf-ai-chat-root .impf-chat-close { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; min-width: 34px; min-height: 34px; margin: 0; padding: 0; border: 0; border-radius: 50%; background: var(--impf-c-hdr-btn); color: var(--impf-c-on-header); line-height: 1; box-shadow: none; text-shadow: none; transition: background 0.15s ease; }
#impf-ai-chat-root .impf-chat-close svg { display: block; width: 16px; height: 16px; margin: 0; pointer-events: none; }
#impf-ai-chat-root .impf-chat-close:hover { background: var(--impf-c-hdr-btn-hover); }
#impf-ai-chat-root .impf-chat-header :focus-visible { outline-color: var(--impf-c-on-header); }

/* Privacy notice */
#impf-ai-chat-root .impf-chat-consent { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; padding: 28px 28px 36px; overflow-y: auto; text-align: center; background: var(--impf-c-bot); }
#impf-ai-chat-root .impf-chat-consent[hidden] { display: none; }
#impf-ai-chat-root .impf-chat-consent-title { margin: 0 0 10px; font-size: 1.2em; font-weight: 650; line-height: 1.3; color: var(--impf-c-text); text-align: center; }
#impf-ai-chat-root .impf-chat-consent-text { max-width: 300px; margin: 0 auto 24px; color: var(--impf-c-muted); line-height: 1.55; text-align: center; white-space: pre-wrap; }
#impf-ai-chat-root .impf-chat-consent .impf-chat-primary { display: inline-flex; align-items: center; justify-content: center; min-width: 180px; min-height: 46px; padding: 0 32px; border-radius: var(--impf-r-ctl); font-size: 1em; letter-spacing: 0.01em; text-align: center; box-shadow: 0 6px 16px -6px rgba(0, 0, 0, 0.35); transition: background 0.15s ease, transform 0.15s ease; }
#impf-ai-chat-root .impf-chat-consent .impf-chat-primary:hover { transform: translateY(-1px); }
#impf-ai-chat-root .impf-chat-consent .impf-chat-consent-text { margin-bottom: 0; }
#impf-ai-chat-root .impf-chat-consent .impf-chat-primary, #impf-ai-chat-root .impf-chat-ended .impf-chat-primary { margin-top: 26px; color: #ffffff; }

#impf-ai-chat-root .impf-chat-primary { min-height: 42px; padding: 0 20px; border: 0; border-radius: var(--impf-r-ctl); background: var(--impf-c-accent); color: var(--impf-c-on-accent); font-weight: 600; }
#impf-ai-chat-root .impf-chat-primary:hover { background: var(--impf-c-accent-strong); }
#impf-ai-chat-root .impf-chat-primary:disabled { opacity: 0.6; cursor: default; }
#impf-ai-chat-root .impf-chat-secondary { min-height: 42px; padding: 0 16px; border: 1px solid var(--impf-c-line); border-radius: var(--impf-r-ctl); background: var(--impf-c-bot); color: var(--impf-c-text); }
#impf-ai-chat-root .impf-chat-secondary:hover { background: var(--impf-c-tint); }

/* Chat view */
#impf-ai-chat-root .impf-chat-view { display: flex; flex-direction: column; flex: 1; min-height: 0; }
#impf-ai-chat-root .impf-chat-log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; background: var(--impf-c-bg); overscroll-behavior: contain; }
#impf-ai-chat-root .impf-chat-msg { display: flex; flex-direction: column; gap: 3px; max-width: 88%; }
#impf-ai-chat-root .impf-chat-msg.is-user { align-self: flex-end; align-items: flex-end; }
#impf-ai-chat-root .impf-chat-msg.is-assistant { align-self: flex-start; align-items: flex-start; }
#impf-ai-chat-root .impf-chat-agent { padding: 0 4px; font-size: 0.73em; font-weight: 650; letter-spacing: 0.03em; text-transform: uppercase; color: var(--impf-c-primary); }
#impf-ai-chat-root .impf-chat-launcher { position: relative; }
#impf-ai-chat-root .impf-chat-badge { position: absolute; top: -6px; right: -6px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: #e5484d; color: #fff; font-size: 12px; font-weight: 700; line-height: 22px; text-align: center; box-shadow: 0 0 0 2px #fff; font-variant-numeric: tabular-nums; }
#impf-ai-chat-root .impf-chat-badge[hidden] { display: none; }
#impf-ai-chat-root .impf-chat-time { padding: 0 4px; font-size: 0.73em; line-height: 1.2; color: var(--impf-c-muted); font-variant-numeric: tabular-nums; }
#impf-ai-chat-root .impf-chat-bubble { padding: 9px 13px; border-radius: var(--impf-r-bubble); white-space: pre-wrap; overflow-wrap: anywhere; }
#impf-ai-chat-root .is-user .impf-chat-bubble { background: var(--impf-c-user); color: var(--impf-c-on-user); border-bottom-right-radius: 4px; }
#impf-ai-chat-root .is-assistant .impf-chat-bubble { background: var(--impf-c-bot); color: var(--impf-c-text); border: 1px solid var(--impf-c-line); border-bottom-left-radius: 4px; }
#impf-ai-chat-root .impf-chat-bubble a { color: inherit; text-decoration: underline; }
#impf-ai-chat-root .impf-chat-notice { align-self: center; max-width: 92%; padding: 7px 12px; border-radius: var(--impf-r-ctl); background: var(--impf-c-tint); color: var(--impf-c-text); font-size: 0.87em; text-align: center; }
#impf-ai-chat-root .impf-chat-notice.is-error { background: #fbeaea; color: #7a1f17; }

/* Typing dots */
#impf-ai-chat-root .impf-chat-typing { display: inline-flex; gap: 4px; align-items: center; min-height: 38px; }
#impf-ai-chat-root .impf-chat-typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--impf-c-muted); animation: impf-chat-dot 1.1s infinite ease-in-out; }
#impf-ai-chat-root .impf-chat-typing i:nth-child(3) { animation-delay: 0.15s; }
#impf-ai-chat-root .impf-chat-typing i:nth-child(4) { animation-delay: 0.3s; }
@keyframes impf-chat-dot { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }

/* Suggested questions */
#impf-ai-chat-root .impf-chat-chips { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; margin-top: 4px; width: 100%; max-width: 100%; min-width: 0; }
#impf-ai-chat-root .impf-chat-chips-title { font-size: 0.8em; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--impf-c-muted); }
#impf-ai-chat-root .impf-chat-chip { display: block; box-sizing: border-box; width: auto; max-width: 100%; min-width: 0; height: auto; padding: 8px 14px; border: 1.5px solid var(--impf-c-primary); border-radius: 18px; background: var(--impf-c-bot); color: var(--impf-c-text); text-align: left; font-weight: 500; line-height: 1.35; white-space: normal; overflow-wrap: anywhere; word-break: normal; text-transform: none; letter-spacing: normal; }
#impf-ai-chat-root .impf-chat-chip:hover { background: var(--impf-c-primary); color: var(--impf-c-on-primary); }

/* Hand-over contact form */
#impf-ai-chat-root .impf-chat-contact { align-self: stretch; padding: 14px; background: var(--impf-c-bot); border: 1px solid var(--impf-c-line); border-radius: var(--impf-r-bubble); display: flex; flex-direction: column; gap: 10px; }
#impf-ai-chat-root .impf-chat-contact-title { font-weight: 600; }
#impf-ai-chat-root .impf-chat-field label { display: block; margin-bottom: 3px; font-size: 0.87em; color: var(--impf-c-muted); }
#impf-ai-chat-root .impf-chat-field input { width: 100%; min-height: 40px; padding: 0 12px; border: 1px solid var(--impf-c-line); border-radius: var(--impf-r-ctl); background: var(--impf-c-bot); color: var(--impf-c-text); }
#impf-ai-chat-root .impf-chat-hint { font-size: 0.8em; color: var(--impf-c-muted); }
#impf-ai-chat-root .impf-chat-field-error { min-height: 0; font-size: 0.87em; color: #a3251b; }
#impf-ai-chat-root .impf-chat-contact-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Rating: a small inline row under the latest answer */
#impf-ai-chat-root .impf-chat-rate { align-self: flex-start; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 0 0 0 2px; color: var(--impf-c-muted); font-size: 0.82em; }
#impf-ai-chat-root .impf-chat-rate-text { margin-right: 2px; }
#impf-ai-chat-root .impf-chat-rate-btn { display: inline-flex; align-items: center; gap: 5px; min-height: 28px; padding: 0 11px; border: 1px solid var(--impf-c-line); border-radius: 999px; background: var(--impf-c-bot); color: var(--impf-c-text); font-size: 1em; font-weight: 500; transition: background 0.12s ease, border-color 0.12s ease; }
#impf-ai-chat-root .impf-chat-rate-btn svg { flex: none; }
#impf-ai-chat-root .impf-chat-rate-btn:hover:not(:disabled) { border-color: var(--impf-c-primary); background: var(--impf-c-tint); }
#impf-ai-chat-root .impf-chat-rate-btn:disabled { opacity: 0.55; cursor: default; }
#impf-ai-chat-root .impf-chat-rate.is-done { color: var(--impf-c-text); font-weight: 500; }

/* Input */
#impf-ai-chat-root .impf-chat-form { padding: 10px 12px 10px; background: var(--impf-c-bot); border-top: 1px solid var(--impf-c-line); }
#impf-ai-chat-root .impf-chat-trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
#impf-ai-chat-root .impf-chat-inputrow { position: relative; display: block; }
#impf-ai-chat-root .impf-chat-input { display: block; width: 100%; min-height: 46px; max-height: 120px; padding: 12px 54px 12px 14px; border: 1px solid var(--impf-c-line); border-radius: var(--impf-r-ctl); resize: none; background: var(--impf-c-bot); color: var(--impf-c-text); line-height: 1.35; }
#impf-ai-chat-root .impf-chat-input::placeholder { color: var(--impf-c-muted); opacity: 1; }
#impf-ai-chat-root .impf-chat-send { position: absolute; right: 7px; bottom: 7px; display: grid; place-items: center; width: 32px; height: 32px; min-height: 0; padding: 0; border: 0; border-radius: 50%; background: var(--impf-c-accent); color: #ffffff; }
#impf-ai-chat-root .impf-chat-send:hover { background: var(--impf-c-accent-strong); }
#impf-ai-chat-root .impf-chat-send:disabled { opacity: 0.55; cursor: default; }
#impf-ai-chat-root .impf-chat-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 30px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--impf-c-line); }
#impf-ai-chat-root .impf-chat-talk { display: inline-flex; align-items: center; gap: 7px; min-height: 30px; padding: 0 12px 0 10px; border: 1px solid var(--impf-c-line); border-radius: 999px; background: var(--impf-c-bot); color: var(--impf-c-text); font-size: 0.84em; font-weight: 550; transition: background 0.12s ease, border-color 0.12s ease; }
#impf-ai-chat-root .impf-chat-talk svg { flex: none; color: var(--impf-c-primary); }
#impf-ai-chat-root .impf-chat-talk:hover:not(:disabled) { border-color: var(--impf-c-primary); background: var(--impf-c-tint); }
#impf-ai-chat-root .impf-chat-talk:disabled { opacity: 0.55; cursor: default; }
#impf-ai-chat-root .impf-chat-counter { font-size: 0.8em; color: var(--impf-c-muted); }

/* Phones, small tablets and landscape phones: the window fills the screen */
@media (max-width: 640px), (max-height: 520px) and (max-width: 940px) {
	#impf-ai-chat-root { bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
	#impf-ai-chat-root.impf-chat-right { right: calc(12px + env(safe-area-inset-right, 0px)); }
	#impf-ai-chat-root.impf-chat-left { left: calc(12px + env(safe-area-inset-left, 0px)); }
	#impf-ai-chat-root.is-open { inset: 0; bottom: 0; right: 0; left: 0; width: 100%; height: 100vh; height: 100dvh; }
	#impf-ai-chat-root .impf-chat-panel { position: fixed; inset: 0; left: 0; right: 0; top: 0; bottom: 0; width: 100%; max-width: none; height: 100vh; height: 100dvh; border-radius: 0; box-shadow: none; animation: none; }
	#impf-ai-chat-root .impf-chat-header { padding-top: calc(14px + env(safe-area-inset-top, 0px)); padding-left: calc(16px + env(safe-area-inset-left, 0px)); padding-right: calc(16px + env(safe-area-inset-right, 0px)); }
	#impf-ai-chat-root .impf-chat-log { -webkit-overflow-scrolling: touch; }
	#impf-ai-chat-root .impf-chat-panel > :last-child { padding-bottom: env(safe-area-inset-bottom, 0px); }
	#impf-ai-chat-root .impf-chat-input, #impf-ai-chat-root .impf-chat-field input { font-size: 16px; } /* stops iOS zoom on focus */
}
@media (max-width: 640px) {
	#impf-ai-chat-root.is-nomobile { display: none; }
}

@media (prefers-reduced-motion: reduce) {
	#impf-ai-chat-root .impf-chat-panel, #impf-ai-chat-root .impf-chat-launcher, #impf-ai-chat-root .impf-chat-typing i { animation: none; transition: none; }
}

/* Live preview inside AI Support > Chat Design (never used on the website) */
#impf-ai-chat-root.is-preview { position: relative; inset: auto; height: auto; bottom: auto; right: auto; left: auto; z-index: 0; display: flex; flex-direction: column; align-items: flex-end; gap: 18px; width: 100%; }
#impf-ai-chat-root.is-preview.impf-chat-left { align-items: flex-start; }
#impf-ai-chat-root.is-preview .impf-chat-panel { position: relative; inset: auto; right: auto; left: auto; bottom: auto; width: var(--impf-w); max-width: 100%; height: 520px; border-radius: var(--impf-r-panel); animation: none; }
#impf-ai-chat-root.is-preview .impf-chat-input { display: flex; align-items: center; color: var(--impf-c-muted); }
#impf-ai-chat-root.is-preview .impf-chat-launcher { cursor: default; }

/* Chat actions: new chat / end chat */
#impf-ai-chat-root .impf-chat-actions { display: flex; justify-content: flex-end; align-items: center; gap: 6px; flex-wrap: wrap; padding: 6px 12px; border-bottom: 1px solid var(--impf-c-line); background: var(--impf-c-bot); font-size: 0.84em; }
#impf-ai-chat-root .impf-chat-actions[hidden] { display: none; }
#impf-ai-chat-root .impf-chat-action { min-height: 28px; padding: 0 11px; border: 1px solid var(--impf-c-line); border-radius: 999px; background: var(--impf-c-bot); color: var(--impf-c-text); font-size: 1em; font-weight: 550; cursor: pointer; }
#impf-ai-chat-root .impf-chat-action:hover { border-color: var(--impf-c-primary); background: var(--impf-c-tint); }
#impf-ai-chat-root .impf-chat-action.is-danger { color: #7a1f17; }
#impf-ai-chat-root .impf-chat-end-q { margin-right: auto; font-weight: 550; }
#impf-ai-chat-root .impf-chat-ended { align-self: center; display: flex; flex-direction: column; align-items: center; gap: 0; padding: 8px 0; }
#impf-ai-chat-root .impf-chat-ended .impf-chat-primary { min-height: 44px; padding: 0 28px; }
#impf-ai-chat-root .impf-chat-meta.is-no-talk { min-height: 0; margin-top: 0; padding-top: 0; border-top: 0; }

/* Message box: still scrolls, but the scrollbar is hidden */
#impf-ai-chat-root .impf-chat-input { scrollbar-width: none; -ms-overflow-style: none; }
#impf-ai-chat-root .impf-chat-input::-webkit-scrollbar { display: none; width: 0; height: 0; }

/* Chat scrollbar (AI Support > Chat Design > Chat scrollbar): slim by default */
#impf-ai-chat-root .impf-chat-log, #impf-ai-chat-root .impf-chat-consent { scrollbar-width: thin; scrollbar-color: var(--impf-c-scroll, #05376a) transparent; }
#impf-ai-chat-root .impf-chat-log::-webkit-scrollbar, #impf-ai-chat-root .impf-chat-consent::-webkit-scrollbar { width: 6px; }
#impf-ai-chat-root .impf-chat-log::-webkit-scrollbar-track, #impf-ai-chat-root .impf-chat-consent::-webkit-scrollbar-track { background: transparent; }
#impf-ai-chat-root .impf-chat-log::-webkit-scrollbar-thumb, #impf-ai-chat-root .impf-chat-consent::-webkit-scrollbar-thumb { background: var(--impf-c-scroll, #05376a); border-radius: 999px; }
#impf-ai-chat-root .impf-chat-log::-webkit-scrollbar-thumb:hover { background: var(--impf-c-scroll, #05376a); opacity: 0.85; }
#impf-ai-chat-root.is-scroll-default .impf-chat-log { scrollbar-width: auto; scrollbar-color: auto; }
#impf-ai-chat-root.is-scroll-default .impf-chat-log::-webkit-scrollbar { width: auto; }
#impf-ai-chat-root.is-scroll-default .impf-chat-log::-webkit-scrollbar-track { background: revert; }
#impf-ai-chat-root.is-scroll-default .impf-chat-log::-webkit-scrollbar-thumb { background: revert; border-radius: revert; }
#impf-ai-chat-root.is-scroll-hidden .impf-chat-log { scrollbar-width: none; -ms-overflow-style: none; }
#impf-ai-chat-root.is-scroll-hidden .impf-chat-log::-webkit-scrollbar { display: none; width: 0; }

/* New-reply pop-up above the chat button */
