:root {
	--cmp-color-bg: #ffffff;
	--cmp-color-text: #1a1a1a;
	--cmp-color-muted: #555555;
	--cmp-color-border: #d8d8d8;
	--cmp-color-primary: #1a1a1a;
	--cmp-color-primary-text: #ffffff;
	--cmp-color-focus: #1a73e8;
	--cmp-radius: 8px;
	--cmp-btn-radius: var(--cmp-radius);
	--cmp-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
	--cmp-z: 999999;
	--cmp-font-family:
		-apple-system,
		BlinkMacSystemFont,
		'Segoe UI',
		Roboto,
		Helvetica,
		Arial,
		sans-serif;
	--cmp-font-size: 15px;
}

#cmp-banner,
#cmp-customize,
.cmp-backdrop,
#cmp-floating-button {
	box-sizing: border-box;
	font-family: var(--cmp-font-family);
	font-size: var(--cmp-font-size);
	line-height: 1.5;
	color: var(--cmp-color-text);
}

#cmp-banner *,
#cmp-customize *,
#cmp-floating-button * {
	box-sizing: border-box;
}

/*
 * An ID selector (e.g. #cmp-customize { display: flex }) outranks the UA stylesheet's
 * [hidden] { display: none }, so without this the dialog would stay visually visible
 * even while the `hidden` attribute is set. Keep this ahead of any positioning rules.
 */
#cmp-banner[hidden],
#cmp-customize[hidden],
.cmp-backdrop[hidden],
#cmp-floating-button[hidden] {
	display: none;
}

.cmp-backdrop {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.4);
	z-index: var(--cmp-z);
}

#cmp-banner {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: calc(var(--cmp-z) + 1);
	display: flex;
	justify-content: center;
	padding: 16px;
}

#cmp-banner[data-cmp-position='top_bar'] {
	top: 0;
	bottom: auto;
}

#cmp-banner[data-cmp-position='centered_modal'] {
	top: 0;
	bottom: 0;
	align-items: center;
}

.cmp-banner__panel {
	width: 100%;
	max-width: 720px;
	background: var(--cmp-color-bg);
	border: 1px solid var(--cmp-color-border);
	border-radius: var(--cmp-radius);
	box-shadow: var(--cmp-shadow);
	padding: 20px;
}

.cmp-banner__logo {
	display: block;
	width: var(--cmp-logo-width, 160px);
	height: auto;
	max-height: 64px;
	margin: 0 0 12px;
}

.cmp-banner__title {
	margin: 0 0 8px;
	font-size: 17px;
}

.cmp-banner__text {
	margin: 0 0 16px;
	color: var(--cmp-color-muted);
}

.cmp-banner__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	justify-content: flex-end;
}

#cmp-customize {
	position: fixed;
	inset: 0;
	z-index: calc(var(--cmp-z) + 2);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
}

.cmp-customize__panel {
	width: 100%;
	max-width: 560px;
	max-height: 90vh;
	background: var(--cmp-color-bg);
	border-radius: var(--cmp-radius);
	box-shadow: var(--cmp-shadow);
	padding: 24px;
	display: flex;
	flex-direction: column;
}

.cmp-customize__logo {
	display: block;
	width: var(--cmp-logo-width, 160px);
	height: auto;
	max-height: 64px;
	margin: 0 0 12px;
}

.cmp-customize__title {
	margin: 0 0 8px;
	font-size: 18px;
}

.cmp-customize__text {
	margin: 0 0 20px;
	color: var(--cmp-color-muted);
}

.cmp-customize__categories {
	list-style: none;
	margin: 0;
	padding: 0;
	/* The only part of the panel that scrolls: min-height: 0 overrides a flex
	 * item's default min-height (its content's own height), which is what would
	 * otherwise stop it from shrinking below that and let the panel grow past
	 * max-height instead — pushing .cmp-customize__actions off-screen. */
	overflow-y: auto;
	min-height: 0;
	flex: 1 1 auto;
}

.cmp-customize__category {
	border-top: 1px solid var(--cmp-color-border);
	padding: 14px 0;
}

.cmp-customize__category:last-child {
	border-bottom: 1px solid var(--cmp-color-border);
}

.cmp-customize__category-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}

.cmp-customize__badge {
	font-size: 12px;
	color: var(--cmp-color-muted);
	white-space: nowrap;
}

.cmp-customize__description {
	margin: 8px 0 0;
	color: var(--cmp-color-muted);
	font-size: 14px;
}

.cmp-customize__services-details {
	margin-top: 10px;
}

.cmp-customize__services-summary {
	cursor: pointer;
	color: var(--cmp-color-muted);
	font-size: 13px;
	font-weight: 600;
	list-style: none;
	display: flex;
	align-items: center;
	gap: 4px;
}

/* Hide the native marker so the custom arrow below is the only one — browsers
 * differ on how to suppress it (webkit uses the pseudo-element, others the
 * `list-style` above, which alone isn't enough in Chromium/Safari). */
.cmp-customize__services-summary::-webkit-details-marker {
	display: none;
}

.cmp-customize__services-summary::before {
	content: '';
	width: 0;
	height: 0;
	border-left: 4px solid currentColor;
	border-top: 4px solid transparent;
	border-bottom: 4px solid transparent;
	transition: transform 0.15s ease;
	flex-shrink: 0;
}

.cmp-customize__services-details[open] .cmp-customize__services-summary::before {
	transform: rotate(90deg);
}

.cmp-customize__services {
	list-style: none;
	margin: 12px 0 0;
	padding: 0 0 0 16px;
	border-left: 2px solid var(--cmp-color-border);
}

.cmp-customize__service {
	padding: 8px 0;
}

.cmp-customize__service:not(:last-child) {
	border-bottom: 1px solid var(--cmp-color-border);
}

.cmp-customize__service-purpose {
	margin: 4px 0 0;
	color: var(--cmp-color-muted);
	font-size: 13px;
}

.cmp-toggle--small .cmp-toggle__track {
	width: 32px;
	height: 18px;
}

.cmp-toggle--small .cmp-toggle__track::before {
	width: 14px;
	height: 14px;
}

.cmp-toggle--small .cmp-toggle__input:checked + .cmp-toggle__track::before {
	transform: translateX(14px);
}

.cmp-toggle--small .cmp-toggle__label {
	font-weight: 400;
	font-size: 14px;
}

.cmp-toggle__input:indeterminate + .cmp-toggle__track {
	background: var(--cmp-color-muted);
}

.cmp-customize__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	justify-content: flex-end;
	flex-shrink: 0;
	padding-top: 16px;
	border-top: 1px solid var(--cmp-color-border);
}

.cmp-btn {
	appearance: none;
	border: 1px solid var(--cmp-color-border);
	background: var(--cmp-color-bg);
	color: var(--cmp-color-text);
	border-radius: var(--cmp-btn-radius);
	padding: 10px 16px;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
}

.cmp-btn--primary {
	background: var(--cmp-color-primary);
	color: var(--cmp-color-primary-text);
	border-color: var(--cmp-color-primary);
}

.cmp-btn:hover {
	opacity: 0.85;
}

.cmp-toggle {
	display: flex;
	align-items: center;
	gap: 10px;
	cursor: pointer;
}

.cmp-toggle__input {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

.cmp-toggle__track {
	position: relative;
	width: 40px;
	height: 22px;
	background: var(--cmp-color-border);
	border-radius: 999px;
	flex-shrink: 0;
	transition: background-color 0.15s ease;
}

.cmp-toggle__track::before {
	content: '';
	position: absolute;
	top: 2px;
	left: 2px;
	width: 18px;
	height: 18px;
	background: var(--cmp-color-bg);
	border-radius: 50%;
	transition: transform 0.15s ease;
}

.cmp-toggle__input:checked + .cmp-toggle__track {
	background: var(--cmp-color-primary);
}

.cmp-toggle__input:checked + .cmp-toggle__track::before {
	transform: translateX(18px);
}

.cmp-toggle__input:disabled + .cmp-toggle__track {
	opacity: 0.6;
}

.cmp-toggle__label {
	font-weight: 600;
}

#cmp-floating-button {
	position: fixed;
	right: 16px;
	bottom: 16px;
	z-index: var(--cmp-z);
	width: 48px;
	height: 48px;
	border-radius: 50%;
	border: 1px solid var(--cmp-color-border);
	background: var(--cmp-color-bg);
	box-shadow: var(--cmp-shadow);
	font-size: 20px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
}

#cmp-floating-button svg {
	width: 22px;
	height: 22px;
}

#cmp-floating-button img {
	width: 24px;
	height: 24px;
	object-fit: contain;
}

/* Accessible, visible focus states everywhere, not just banner elements. */
#cmp-banner :focus-visible,
#cmp-customize :focus-visible,
#cmp-floating-button:focus-visible {
	outline: 3px solid var(--cmp-color-focus);
	outline-offset: 2px;
}

@media (max-width: 600px) {
	#cmp-banner {
		padding: 0;
	}

	.cmp-banner__panel {
		max-width: none;
		border-radius: 0;
	}

	.cmp-banner__actions,
	.cmp-customize__actions {
		flex-direction: column-reverse;
	}

	.cmp-banner__actions .cmp-btn,
	.cmp-customize__actions .cmp-btn {
		width: 100%;
	}

	.cmp-customize__panel {
		padding: 20px 16px;
	}
}

@media (prefers-color-scheme: dark) {
	:root {
		--cmp-color-bg: #1e1e1e;
		--cmp-color-text: #f2f2f2;
		--cmp-color-muted: #b3b3b3;
		--cmp-color-border: #3a3a3a;
		--cmp-color-primary: #f2f2f2;
		--cmp-color-primary-text: #1a1a1a;
	}
}
