#owui-sc-root { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; --owui-sc-color: #2563eb; --owui-sc-header-text: #fff; --owui-sc-user-bg: var(--owui-sc-color); --owui-sc-user-text: #fff; --owui-sc-bot-bg: #fff; --owui-sc-bot-text: #1f2937; --owui-sc-panel-bg: #f6f7fb; --owui-sc-bubble: 58px; --owui-sc-font: 15px; --owui-sc-radius: 16px; position: fixed; bottom: 20px; z-index: 99999; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; font-size: var(--owui-sc-font); line-height: 1.45; }
#owui-sc-root.owui-sc-right { right: 20px; }
#owui-sc-root.owui-sc-left { left: 20px; }

#owui-sc-root .owui-sc-bubble { width: var(--owui-sc-bubble); height: var(--owui-sc-bubble); overflow: hidden; border-radius: 50%; border: 0; background: var(--owui-sc-color); color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; box-shadow: 0 8px 24px rgba(0,0,0,.22); transition: transform .15s ease; padding: 0; }
#owui-sc-root .owui-sc-bubble:hover { transform: scale(1.06); }
#owui-sc-root .owui-sc-bubble .owui-sc-x { display: none; }
#owui-sc-root.owui-sc-open .owui-sc-bubble .owui-sc-x { display: block; }

#owui-sc-root .owui-sc-panel { position: absolute; bottom: calc(var(--owui-sc-bubble) + 14px); width: 370px; max-width: calc(100vw - 40px); height: 540px; max-height: calc(100vh - 110px); background: #fff; border-radius: var(--owui-sc-radius); box-shadow: 0 16px 48px rgba(0,0,0,.25); display: none; flex-direction: column; overflow: hidden; }
#owui-sc-root.owui-sc-right .owui-sc-panel { right: 0; }
#owui-sc-root.owui-sc-left .owui-sc-panel { left: 0; }
#owui-sc-root.owui-sc-open .owui-sc-panel { display: flex; animation: owui-sc-in .18s ease-out; }
@keyframes owui-sc-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

#owui-sc-root .owui-sc-head { background: var(--owui-sc-color); color: var(--owui-sc-header-text); padding: 12px 14px; display: flex; align-items: center; gap: 10px; }
#owui-sc-root .owui-sc-head .owui-sc-titles { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
#owui-sc-root .owui-sc-head strong { font-size: 16px; }
#owui-sc-root .owui-sc-head small { font-size: 12px; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#owui-sc-root .owui-sc-avatar { width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,.2); display: flex; align-items: center; justify-content: center; flex: none; overflow: hidden; }
#owui-sc-root .owui-sc-avatar img, #owui-sc-root .owui-sc-bubble img { width: 100%; height: 100%; object-fit: cover; }
#owui-sc-root .owui-sc-dot { width: 10px; height: 10px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 0 3px rgba(255,255,255,.25); }
#owui-sc-root .owui-sc-head button { background: transparent; border: 0; color: var(--owui-sc-header-text); font-size: 22px; line-height: 1; cursor: pointer; opacity: .85; padding: 2px 6px; }
#owui-sc-root .owui-sc-head button:hover { opacity: 1; }
#owui-sc-root .owui-sc-new { font-size: 18px !important; }

#owui-sc-root .owui-sc-msgs { flex: 1; overflow-y: auto; padding: 16px; background: var(--owui-sc-panel-bg); display: flex; flex-direction: column; gap: 10px; }
#owui-sc-root .owui-sc-msg { display: flex; }
#owui-sc-root .owui-sc-user { justify-content: flex-end; }
#owui-sc-root .owui-sc-bubble-text { max-width: 85%; padding: 10px 14px; border-radius: calc(var(--owui-sc-radius) - 2px); background: var(--owui-sc-bot-bg); color: var(--owui-sc-bot-text); box-shadow: 0 1px 2px rgba(0,0,0,.06); word-wrap: break-word; overflow-wrap: anywhere; }
#owui-sc-root .owui-sc-user .owui-sc-bubble-text { background: var(--owui-sc-user-bg); color: var(--owui-sc-user-text); border-bottom-right-radius: 4px; }
#owui-sc-root .owui-sc-bot .owui-sc-bubble-text { border-bottom-left-radius: 4px; }
#owui-sc-root .owui-sc-bubble-text p { margin: 0 0 6px; }
#owui-sc-root .owui-sc-bubble-text p:last-child { margin-bottom: 0; }
#owui-sc-root .owui-sc-bubble-text ul { margin: 4px 0 6px 18px; padding: 0; }
#owui-sc-root .owui-sc-bubble-text li { margin: 2px 0; }
#owui-sc-root .owui-sc-bubble-text a { color: var(--owui-sc-color); text-decoration: underline; }
#owui-sc-root .owui-sc-user .owui-sc-bubble-text a { color: var(--owui-sc-user-text); }
#owui-sc-root .owui-sc-caret { display: inline-block; width: 2px; height: 1em; background: var(--owui-sc-color); vertical-align: text-bottom; margin-left: 2px; animation: owui-sc-blink .8s infinite; }
@keyframes owui-sc-blink { 50% { opacity: 0; } }

#owui-sc-root .owui-sc-typing .owui-sc-bubble-text { display: flex; gap: 4px; padding: 14px 16px; }
#owui-sc-root .owui-sc-typing span { width: 7px; height: 7px; border-radius: 50%; background: #9ca3af; animation: owui-sc-bounce 1.2s infinite; }
#owui-sc-root .owui-sc-typing span:nth-child(2) { animation-delay: .2s; }
#owui-sc-root .owui-sc-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes owui-sc-bounce { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-6px); } }

#owui-sc-root .owui-sc-form { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px; border-top: 1px solid #e5e7eb; background: #fff; }
#owui-sc-root .owui-sc-form textarea { flex: 1; resize: none; border: 1px solid #d1d5db; border-radius: 12px; padding: 10px 12px; font: inherit; max-height: 120px; outline: none; background: #fff; color: #111; }
#owui-sc-root .owui-sc-form textarea:focus { border-color: var(--owui-sc-color); }
#owui-sc-root .owui-sc-form button { width: 42px; height: 42px; border: 0; border-radius: 50%; background: var(--owui-sc-color); color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; flex: none; }
#owui-sc-root .owui-sc-form button:disabled { opacity: .5; cursor: default; }

}
#owui-sc-root .owui-sc-powered { text-align: center; font-size: 11px; color: #9ca3af; padding: 4px 0 6px; background: #fff; }
#owui-sc-root .owui-sc-powered a { color: inherit; text-decoration: none; }
#owui-sc-root .owui-sc-powered a:hover { text-decoration: underline; }
#owui-sc-root .owui-sc-head small .owui-sc-dot { display: inline-block; width: 8px; height: 8px; margin-right: 2px; vertical-align: middle; box-shadow: none; }
#owui-sc-root .owui-sc-bubble .owui-sc-icon { display: flex; width: 100%; height: 100%; align-items: center; justify-content: center; }
#owui-sc-root.owui-sc-open .owui-sc-bubble .owui-sc-icon { display: none; }

/* ---------- phones & small tablets: full-screen sheet ---------- */
@media (max-width: 640px) {
	#owui-sc-root { bottom: calc(16px + env(safe-area-inset-bottom)); }
	#owui-sc-root.owui-sc-right { right: calc(16px + env(safe-area-inset-right)); }
	#owui-sc-root.owui-sc-left { left: calc(16px + env(safe-area-inset-left)); }
	/* bottom sheet: ~75% of the visible screen, rounded top, dimmed backdrop; grows to full visible height while the keyboard is open */
	#owui-sc-root .owui-sc-panel {
		position: fixed; left: 0; right: 0; bottom: 0; top: auto;
		width: 100%; max-width: none; max-height: none;
		height: var(--owui-sc-sheet, 75vh);
		border-radius: calc(var(--owui-sc-radius) + 4px) calc(var(--owui-sc-radius) + 4px) 0 0;
		box-shadow: 0 -8px 32px rgba(0,0,0,.25);
	}
	#owui-sc-root .owui-sc-panel::before { content: ""; position: absolute; top: 6px; left: 50%; width: 40px; height: 4px; margin-left: -20px; border-radius: 2px; background: rgba(255,255,255,.55); z-index: 2; }
	#owui-sc-root.owui-sc-open .owui-sc-panel { animation: owui-sc-up .25s ease-out; }
	@keyframes owui-sc-up { from { transform: translateY(40px); opacity: .7; } to { transform: none; opacity: 1; } }
	#owui-sc-root .owui-sc-backdrop { display: none; position: fixed; inset: 0; background: rgba(15,23,42,.45); }
	#owui-sc-root.owui-sc-open .owui-sc-backdrop { display: block; animation: owui-sc-fade .25s ease-out; }
	@keyframes owui-sc-fade { from { opacity: 0; } to { opacity: 1; } }
	#owui-sc-root .owui-sc-head { padding-top: 14px; }
	/* bubble hidden while the sheet is open — the header has the close button */
	#owui-sc-root.owui-sc-open .owui-sc-bubble { display: none; }
	#owui-sc-root .owui-sc-head { padding: 14px 14px 12px; min-height: 60px; }
	#owui-sc-root .owui-sc-head button { min-width: 44px; min-height: 44px; font-size: 26px; padding: 0; display: flex; align-items: center; justify-content: center; }
	#owui-sc-root .owui-sc-new { font-size: 20px !important; }
	#owui-sc-root .owui-sc-msgs { padding: 14px 12px; gap: 12px; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
	#owui-sc-root .owui-sc-bubble-text { max-width: 88%; font-size: max(var(--owui-sc-font), 15px); }
	#owui-sc-root .owui-sc-form { padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); gap: 10px; }
	#owui-sc-root .owui-sc-form textarea { font-size: 16px; padding: 12px 14px; min-height: 46px; } /* 16px stops iOS auto-zoom */
	#owui-sc-root .owui-sc-form button { width: 46px; height: 46px; }
	#owui-sc-root .owui-sc-powered { padding-bottom: calc(6px + env(safe-area-inset-bottom)); font-size: 11px !important; line-height: 1.3; }
	#owui-sc-root .owui-sc-head small { font-size: 12px !important; }
}
/* body scroll lock while the sheet is open on phones */
html.owui-sc-lock, html.owui-sc-lock body { overflow: hidden !important; height: 100%; overscroll-behavior: none; touch-action: none; }
html.owui-sc-lock #owui-sc-root .owui-sc-msgs, html.owui-sc-lock #owui-sc-root .owui-sc-form textarea { touch-action: auto; }
/* landscape phones: keep header compact */
@media (max-width: 900px) and (max-height: 480px) {
	#owui-sc-root .owui-sc-head { min-height: 48px; padding-top: 8px; padding-bottom: 8px; }
	#owui-sc-root .owui-sc-head small { display: none; }
	#owui-sc-root .owui-sc-panel { height: var(--owui-sc-sheet, 100vh); border-radius: 0; }
}
@media (min-width: 641px) { #owui-sc-root .owui-sc-backdrop { display: none !important; } }
