#dmglb-root {
	--a: var(--dmglb-accent, #1f6b4a);
	--gold: #e0a526;
	--ink: #1d2421;
	--soft: #f0f4f1;
	--line: #d9e1dc;
	--b: var(--dmglb-bottom-d, 90px);
	position: fixed;
	bottom: calc(var(--b) + env(safe-area-inset-bottom, 0px));
	z-index: 99990;
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	font-size: 15px;
	line-height: 1.45;
	color: var(--ink);
}
#dmglb-root.dmglb-right { right: 16px; }
#dmglb-root.dmglb-left { left: 16px; }
#dmglb-root *, #dmglb-root *::before, #dmglb-root *::after { box-sizing: border-box; }
#dmglb-root [hidden] { display: none !important; }

/* Launcher */
#dmglb-root .dmglb-launch {
	position: relative;
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0;
	padding: 12px 18px 12px 14px;
	border: 0;
	border-radius: 999px;
	background: var(--a);
	color: #fff;
	font: inherit;
	font-weight: 600;
	cursor: pointer;
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.22);
}
#dmglb-root .dmglb-launch:hover { filter: brightness(1.08); }
#dmglb-root .dmglb-dot {
	position: absolute;
	top: -2px;
	right: -2px;
	width: 13px;
	height: 13px;
	border-radius: 50%;
	background: var(--gold);
	border: 2px solid #fff;
}

/* Panel */
#dmglb-root .dmglb-panel {
	position: absolute;
	bottom: 64px;
	display: flex;
	flex-direction: column;
	width: min(360px, calc(100vw - 32px));
	max-height: max(240px, min(560px, calc(100vh - var(--b) - 90px)));
	max-height: max(240px, min(560px, calc(100dvh - var(--b) - 90px)));
	background: #fff;
	border-radius: 16px;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.26);
	overflow: hidden;
	outline: none;
}
#dmglb-root.dmglb-right .dmglb-panel { right: 0; }
#dmglb-root.dmglb-left .dmglb-panel { left: 0; }

#dmglb-root .dmglb-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 14px 14px 18px;
	background: var(--a);
	color: #fff;
	border-bottom: 3px solid var(--gold);
}
#dmglb-root .dmglb-title { font-weight: 700; font-size: 16px; }
#dmglb-root .dmglb-close {
	width: 34px;
	height: 34px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: #fff;
	font: inherit;
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
}
#dmglb-root .dmglb-close:hover { background: rgba(255, 255, 255, 0.18); }

#dmglb-root .dmglb-log {
	flex: 1;
	min-height: 160px;
	padding: 14px;
	overflow-y: auto;
	background: var(--soft);
	overscroll-behavior: contain;
}

/* Messages */
#dmglb-root .dmglb-msg {
	max-width: 88%;
	margin: 0 0 10px;
	padding: 10px 13px;
	border-radius: 14px;
	white-space: pre-line;
	overflow-wrap: anywhere;
}
#dmglb-root .dmglb-bot {
	background: #fff;
	border: 1px solid var(--line);
	border-bottom-left-radius: 4px;
}
#dmglb-root .dmglb-bot a { color: var(--a); text-decoration: underline; }
#dmglb-root .dmglb-user {
	margin-left: auto;
	background: var(--a);
	color: #fff;
	border-bottom-right-radius: 4px;
}

/* Option chips */
#dmglb-root .dmglb-opts {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 4px 0 2px;
}
#dmglb-root .dmglb-chip {
	display: inline-block;
	margin: 0;
	padding: 9px 14px;
	border: 1.5px solid var(--a);
	border-radius: 999px;
	background: #fff;
	color: var(--a);
	font: inherit;
	font-weight: 600;
	text-align: left;
	text-decoration: none;
	cursor: pointer;
}
#dmglb-root .dmglb-chip:hover { background: var(--a); color: #fff; }

/* Lead form */
#dmglb-root .dmglb-form {
	padding: 14px;
	background: #fff;
	border: 1px solid var(--line);
	border-radius: 14px;
}
#dmglb-root .dmglb-field { margin: 0 0 11px; }
#dmglb-root .dmglb-field label {
	display: block;
	margin: 0 0 4px;
	font-size: 13px;
	font-weight: 600;
}
#dmglb-root .dmglb-field input,
#dmglb-root .dmglb-field textarea {
	display: block;
	width: 100%;
	margin: 0;
	padding: 9px 10px;
	border: 1.5px solid #b9c5be;
	border-radius: 8px;
	background: #fff;
	color: var(--ink);
	font: inherit;
	font-size: 16px; /* stops iOS zooming into the field */
}
#dmglb-root .dmglb-field textarea { resize: vertical; min-height: 70px; }
#dmglb-root .dmglb-hp {
	position: absolute !important;
	left: -9999px !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
}
#dmglb-root .dmglb-consent {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	margin: 0 0 10px;
	font-size: 13px;
}
#dmglb-root .dmglb-consent input { flex: none; margin: 3px 0 0; width: 16px; height: 16px; }
#dmglb-root .dmglb-consent a { color: var(--a); text-decoration: underline; }
#dmglb-root .dmglb-err {
	margin: 0 0 10px;
	color: #b3261e;
	font-size: 13px;
	font-weight: 600;
}
#dmglb-root .dmglb-err:empty { display: none; }
#dmglb-root .dmglb-send {
	display: block;
	width: 100%;
	margin: 0;
	padding: 12px;
	border: 0;
	border-radius: 10px;
	background: var(--a);
	color: #fff;
	font: inherit;
	font-weight: 700;
	cursor: pointer;
}
#dmglb-root .dmglb-send:disabled { opacity: 0.65; cursor: default; }

/* Keyboard focus */
#dmglb-root button:focus-visible,
#dmglb-root a:focus-visible,
#dmglb-root input:focus-visible,
#dmglb-root textarea:focus-visible {
	outline: 3px solid var(--gold);
	outline-offset: 2px;
}

/* Tablets */
@media (max-width: 1024px) {
	#dmglb-root { --b: var(--dmglb-bottom-t, 80px); }
	#dmglb-root .dmglb-panel { width: min(380px, calc(100vw - 32px)); }
}

/* Phones */
@media (max-width: 600px) {
	#dmglb-root { --b: var(--dmglb-bottom-m, 70px); }
	#dmglb-root.dmglb-right { right: 12px; }
	#dmglb-root.dmglb-left { left: 12px; }
	#dmglb-root .dmglb-panel { width: calc(100vw - 24px); bottom: 62px; }
	#dmglb-root .dmglb-launch { padding: 11px 15px 11px 12px; }
	#dmglb-root .dmglb-msg { max-width: 92%; }
}

/* Short screens, such as a phone turned sideways */
@media (max-height: 500px) {
	#dmglb-root .dmglb-log { min-height: 100px; }
	#dmglb-root .dmglb-panel {
		max-height: calc(100vh - var(--b) - 20px);
		max-height: calc(100dvh - var(--b) - 20px);
	}
}

/* Touch screens: larger tap targets */
@media (pointer: coarse) {
	#dmglb-root .dmglb-chip { display: inline-flex; align-items: center; min-height: 44px; }
	#dmglb-root .dmglb-close { width: 44px; height: 44px; }
	#dmglb-root .dmglb-send { min-height: 48px; }
}

/* Gentle open animation, skipped for people who prefer less motion */
@media (prefers-reduced-motion: no-preference) {
	#dmglb-root .dmglb-panel { animation: dmglb-open 0.18s ease-out; }
	@keyframes dmglb-open {
		from { opacity: 0; transform: translateY(8px); }
		to { opacity: 1; transform: none; }
	}
}
