/* Chip AI Assistant by Gorman Web: the chat window (design from the Chip mockup) */
#chip-root {
	--ink: #141414;
	--olive: #7E8B52;
	--olive-dark: #55602F;
	--olive-hover: #4A5428;
	--olive-light: #A3B06F;
	--mist: #EEF0E6;
	--paper: #F7F8F3;
	--line: #DDE1D0;
	font-family: Inter, "Helvetica Neue", Arial, sans-serif;
	font-size: 15px;
	line-height: 1.5;
	color: var(--ink);
	-webkit-font-smoothing: antialiased;
	text-align: left;
}
#chip-root *, #chip-root *::before, #chip-root *::after { box-sizing: border-box; }
/* Keep the theme's button, link and form styles out of the chat window. */
#chip-root button, #chip-root input, #chip-root a { margin: 0; font-family: inherit; letter-spacing: normal; text-transform: none; text-shadow: none; min-height: 0; min-width: 0; }
#chip-root button { -webkit-appearance: none; appearance: none; }
#chip-root p, #chip-root ul, #chip-root li { font-family: inherit; letter-spacing: normal; }
#chip-root [hidden] { display: none !important; }
#chip-root svg { display: block; }
#chip-root .chip-nw { white-space: nowrap; }
#chip-root .chip-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Launcher */
#chip-root .chip-launcher {
	position: fixed; right: 24px; bottom: 24px; z-index: 2147483000;
	width: 64px; height: 64px; padding: 0; border-radius: 50%; border: 0; cursor: pointer;
	background: var(--olive-dark); color: #fff;
	display: grid; place-items: center;
	box-shadow: 0 10px 28px rgba(20, 20, 20, 0.28), 0 2px 6px rgba(20, 20, 20, 0.18);
	transition: transform 0.2s ease, background 0.2s ease;
}
#chip-root .chip-launcher:hover { transform: translateY(-2px); background: var(--olive-hover); }
#chip-root .chip-launcher:focus-visible { outline: 3px solid var(--olive-light); outline-offset: 3px; }
#chip-root .chip-launcher .chip-face { width: 40px; height: 40px; }
#chip-root .chip-launcher .chip-close-icon { display: none; width: 24px; height: 24px; }
#chip-root.chip-open .chip-launcher .chip-face { display: none; }
#chip-root.chip-open .chip-launcher .chip-close-icon { display: block; }
#chip-root .chip-badge {
	position: absolute; top: -2px; right: -2px; min-width: 22px; height: 22px; padding: 0 6px;
	border-radius: 11px; background: #D9482B; color: #fff; border: 2px solid #fff;
	font: 700 12px/18px Inter, Arial, sans-serif; text-align: center;
}
#chip-root.chip-open .chip-badge { display: none; }

/* Greeting bubble */
#chip-root .chip-teaser {
	position: fixed; right: 24px; bottom: 100px; z-index: 2147483000;
	max-width: 270px; margin: 0; padding: 14px 40px 14px 16px; border-radius: 14px 14px 4px 14px;
	background: #fff; color: var(--ink); border: 1px solid var(--line);
	box-shadow: 0 12px 30px rgba(20, 20, 20, 0.18);
	font-size: 14.5px; line-height: 1.45; cursor: pointer;
	opacity: 0; transform: translateY(8px); pointer-events: none;
	transition: opacity 0.25s ease, transform 0.25s ease;
}
#chip-root .chip-teaser.chip-show { opacity: 1; transform: none; pointer-events: auto; }
#chip-root .chip-teaser strong { font-family: Outfit, Inter, sans-serif; font-weight: 700; }
#chip-root .chip-teaser-x {
	position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 50%;
	background: transparent; color: #6B6F63; cursor: pointer; font-size: 18px; line-height: 1;
	display: grid; place-items: center;
}
#chip-root .chip-teaser-x:hover { background: var(--mist); }
#chip-root.chip-open .chip-teaser { display: none; }

/* Panel */
#chip-root .chip-panel {
	position: fixed; right: 24px; bottom: 100px; z-index: 2147483001;
	width: 384px; height: min(620px, calc(100vh - 128px));
	display: flex; flex-direction: column; overflow: hidden;
	background: var(--paper); border-radius: 18px;
	box-shadow: 0 24px 60px rgba(20, 20, 20, 0.3), 0 4px 14px rgba(20, 20, 20, 0.14);
	opacity: 0; transform: translateY(12px) scale(0.98); transform-origin: bottom right;
	pointer-events: none; visibility: hidden;
	transition: opacity 0.22s ease, transform 0.22s ease, visibility 0s linear 0.22s;
}
#chip-root.chip-open .chip-panel {
	opacity: 1; transform: none; pointer-events: auto; visibility: visible;
	transition: opacity 0.22s ease, transform 0.22s ease, visibility 0s;
}

#chip-root .chip-head { display: flex; align-items: center; gap: 12px; padding: 16px 14px 16px 18px; background: var(--ink); color: #fff; }
#chip-root .chip-avatar { flex: none; width: 44px; height: 44px; border-radius: 12px; background: var(--olive-dark); display: grid; place-items: center; }
#chip-root .chip-avatar svg { width: 34px; height: 34px; }
#chip-root .chip-head-text { flex: 1; min-width: 0; }
#chip-root .chip-name { margin: 0; padding: 0; color: #fff; font: 700 19px/1.15 Outfit, Inter, sans-serif; letter-spacing: 0.2px; }
#chip-root .chip-sub { margin: 3px 0 0; padding: 0; font-size: 12.5px; line-height: 1.4; color: rgba(255, 255, 255, 0.72); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#chip-root .chip-sub .chip-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--olive-light); margin-right: 6px; vertical-align: 0; }
#chip-root .chip-x {
	flex: none; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 10px; cursor: pointer;
	background: rgba(255, 255, 255, 0.08); color: #fff; display: grid; place-items: center;
}
#chip-root .chip-x:hover { background: rgba(255, 255, 255, 0.16); }
#chip-root .chip-x:focus-visible { outline: 2px solid var(--olive-light); outline-offset: 2px; }
#chip-root .chip-x svg { width: 18px; height: 18px; }

#chip-root .chip-log { flex: 1; overflow-y: auto; padding: 18px 16px 8px; scroll-behavior: smooth; overscroll-behavior: contain; }
#chip-root .chip-row { display: flex; gap: 8px; margin: 0 0 12px; align-items: flex-end; }
#chip-root .chip-row.chip-user { justify-content: flex-end; }
#chip-root .chip-mini { flex: none; width: 28px; height: 28px; border-radius: 8px; background: var(--olive-dark); display: grid; place-items: center; }
#chip-root .chip-mini svg { width: 22px; height: 22px; }
#chip-root .chip-bubble { max-width: 82%; padding: 11px 14px; border-radius: 16px; font-size: 14.5px; line-height: 1.5; text-wrap: pretty; overflow-wrap: anywhere; }
#chip-root .chip-bot .chip-bubble { background: #fff; color: var(--ink); border: 1px solid var(--line); border-bottom-left-radius: 5px; }
#chip-root .chip-user .chip-bubble { background: var(--olive-dark); color: #fff; border-bottom-right-radius: 5px; white-space: pre-wrap; }
#chip-root .chip-bubble p { margin: 0 0 8px; padding: 0; font-size: inherit; line-height: inherit; color: inherit; }
#chip-root .chip-bubble p:last-child { margin-bottom: 0; }
#chip-root .chip-bubble ul { margin: 6px 0 8px; padding: 0 0 0 18px; list-style: disc; }
#chip-root .chip-bubble li { margin: 3px 0; padding: 0; font-size: inherit; line-height: inherit; color: inherit; }
#chip-root .chip-bubble ul:last-child { margin-bottom: 0; }
#chip-root .chip-bubble strong { font-weight: 700; }
#chip-root .chip-bubble a { color: var(--olive-dark); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }

#chip-root .chip-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: -4px 0 12px 36px; }
#chip-root .chip-act {
	display: inline-flex; align-items: center; gap: 7px; padding: 9px 13px; border-radius: 8px;
	font: 600 13.5px/1 Outfit, Inter, sans-serif; text-decoration: none; cursor: pointer;
	border: 1.5px solid var(--olive-dark); background: var(--olive-dark); color: #fff;
}
#chip-root .chip-act.chip-alt { background: #fff; color: var(--olive-dark); }
#chip-root .chip-act:hover { filter: brightness(1.08); color: #fff; }
#chip-root .chip-act.chip-alt:hover { color: var(--olive-dark); }
#chip-root .chip-act:focus-visible { outline: 2px solid var(--olive); outline-offset: 2px; }
#chip-root .chip-act svg { width: 15px; height: 15px; flex: none; }

#chip-root .chip-typing { display: inline-flex; gap: 4px; padding: 14px 16px; }
#chip-root .chip-typing span { width: 7px; height: 7px; border-radius: 50%; background: #9AA08A; animation: chip-bounce 1.1s infinite ease-in-out; }
#chip-root .chip-typing span:nth-child(2) { animation-delay: 0.15s; }
#chip-root .chip-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes chip-bounce { 0%, 60%, 100% { transform: translateY(0); opacity: 0.5; } 30% { transform: translateY(-5px); opacity: 1; } }

#chip-root .chip-quick { display: flex; flex-wrap: wrap; gap: 7px; padding: 4px 16px 12px; }
#chip-root .chip-quick:empty { display: none; }
#chip-root .chip-q {
	padding: 8px 12px; border-radius: 999px; cursor: pointer;
	border: 1.5px solid var(--olive); background: #fff; color: var(--olive-dark);
	font: 600 13px/1.2 Inter, Arial, sans-serif; transition: background 0.15s ease, color 0.15s ease;
}
#chip-root .chip-q:hover { background: var(--olive-dark); border-color: var(--olive-dark); color: #fff; }
#chip-root .chip-q:focus-visible { outline: 2px solid var(--olive); outline-offset: 2px; }

#chip-root .chip-form { display: flex; gap: 8px; margin: 0; padding: 12px 12px 6px; border-top: 1px solid var(--line); background: #fff; }
#chip-root .chip-input {
	flex: 1; min-width: 0; height: 46px; margin: 0; padding: 0 14px; border-radius: 12px;
	border: 1.5px solid var(--line); background: var(--paper); color: var(--ink); box-shadow: none;
	font: 400 15px Inter, Arial, sans-serif;
}
#chip-root .chip-input:focus { outline: none; border-color: var(--olive); background: #fff; }
#chip-root .chip-send {
	flex: none; width: 46px; height: 46px; padding: 0; border: 0; border-radius: 12px; cursor: pointer;
	background: var(--olive-dark); color: #fff; display: grid; place-items: center;
}
#chip-root .chip-send:hover { background: var(--olive-hover); }
#chip-root .chip-send:focus-visible { outline: 2px solid var(--olive); outline-offset: 2px; }
#chip-root .chip-send:disabled { opacity: 0.6; cursor: default; }
#chip-root .chip-send svg { width: 20px; height: 20px; }
#chip-root .chip-note { margin: 0; padding: 4px 12px 10px; background: #fff; text-align: center; font-size: 11.5px; line-height: 1.5; color: #7A7E70; }
#chip-root .chip-note a { color: #7A7E70; text-decoration: underline; text-underline-offset: 2px; }
#chip-root .chip-note a:hover { color: var(--olive-dark); }

@media (max-width: 520px) {
	#chip-root .chip-launcher { right: 16px; bottom: 16px; width: 60px; height: 60px; }
	#chip-root .chip-teaser { right: 16px; bottom: 88px; max-width: calc(100vw - 32px); }
	#chip-root .chip-panel { right: 0; bottom: 0; width: 100%; height: 100%; height: 100dvh; border-radius: 0; padding-bottom: env(safe-area-inset-bottom); }
	#chip-root .chip-head { padding-top: max(16px, env(safe-area-inset-top)); }
	#chip-root.chip-open .chip-launcher { display: none; }
	#chip-root .chip-input { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
	#chip-root .chip-panel, #chip-root .chip-teaser, #chip-root .chip-launcher { transition: none; }
	#chip-root .chip-typing span { animation: none; opacity: 0.8; }
	#chip-root .chip-log { scroll-behavior: auto; }
}
@media print { #chip-root { display: none !important; } }
