.cpllm-chat-btn {
	cursor: pointer;
}

.cpllm-modal {
	border: none;
	padding: 0;
	background: transparent;
	max-width: min(420px, calc(100vw - 24px));
	width: 100%;
}

.cpllm-modal__panel.is-gallery-wide {
	max-width: min(920px, calc(100vw - 24px));
	width: min(920px, calc(100vw - 24px));
	max-height: min(92vh, 860px);
	max-height: min(92dvh, 860px);
	height: min(92vh, 860px);
	height: min(92dvh, 860px);
}

.cpllm-modal.is-gallery-open,
.cpllm-modal:has(.cpllm-modal__panel.is-gallery-wide) {
	max-width: min(920px, calc(100vw - 24px));
}

.cpllm-modal::backdrop {
	background: rgba(15, 18, 22, 0.55);
}

.cpllm-modal__panel {
	position: relative;
	background: #fff;
	color: #14181f;
	border-radius: 14px;
	overflow: hidden;
	box-shadow: 0 18px 48px rgba(0, 0, 0, 0.22);
	display: flex;
	flex-direction: column;
	max-height: min(80vh, 640px);
	max-height: min(80dvh, 640px);
	height: min(80vh, 640px);
	height: min(80dvh, 640px);
}

.cpllm-modal__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 14px 16px;
	border-bottom: 1px solid rgba(20, 24, 31, 0.08);
}

.cpllm-modal__title {
	margin: 0;
	font-size: 1.05rem;
	font-weight: 650;
	line-height: 1.3;
}

.cpllm-modal__header-actions {
	display: flex;
	align-items: center;
	gap: 4px;
	flex-shrink: 0;
}

.cpllm-modal__close {
	appearance: none;
	border: 0;
	background: transparent;
	font-size: 1.5rem;
	line-height: 1;
	cursor: pointer;
	color: inherit;
	opacity: 0.7;
	padding: 0 4px;
}

.cpllm-modal__close:hover,
.cpllm-modal__close:focus {
	opacity: 1;
}

.cpllm-modal__clear {
	appearance: none;
	border: 0;
	background: transparent;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	color: inherit;
	opacity: 0.6;
	padding: 4px;
	border-radius: 6px;
}

.cpllm-modal__clear:hover,
.cpllm-modal__clear:focus {
	opacity: 1;
	background: rgba(20, 24, 31, 0.06);
}

.cpllm-modal__body {
	display: flex;
	flex-direction: column;
	flex: 1;
	min-height: 0;
	overflow: hidden;
}

.cpllm-auth,
.cpllm-status {
	padding: 20px 16px 24px;
}

.cpllm-auth__help,
.cpllm-status {
	margin: 0 0 14px;
	font-size: 0.92rem;
	line-height: 1.45;
	opacity: 0.85;
}

.cpllm-auth__field {
	display: flex;
	flex-direction: column;
	gap: 6px;
	margin-bottom: 12px;
}

.cpllm-auth__field label {
	font-size: 0.85rem;
	font-weight: 600;
}

.cpllm-auth__field input {
	border: 1px solid rgba(20, 24, 31, 0.18);
	border-radius: 8px;
	padding: 10px 12px;
	font: inherit;
}

.cpllm-auth__error,
.cpllm-chat__error {
	color: #b42318;
	font-size: 0.88rem;
	margin: 0 0 10px;
}

.cpllm-auth__actions {
	margin-top: 8px;
}

.cpllm-chat {
	display: flex;
	flex-direction: column;
	flex: 1;
	min-height: 0;
	overflow: hidden;
	height: 100%;
}

.cpllm-chat__messages {
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
	padding: 14px 16px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	background: linear-gradient(180deg, #f7f8fa 0%, #ffffff 48%);
}

.cpllm-msg {
	max-width: 88%;
	padding: 10px 12px;
	border-radius: 12px;
	font-size: 0.93rem;
	line-height: 1.45;
	white-space: pre-wrap;
	word-break: break-word;
}

.cpllm-msg--assistant {
	align-self: flex-start;
	background: #eef2f7;
	color: #14181f;
	border-bottom-left-radius: 4px;
}

.cpllm-msg--user {
	align-self: flex-end;
	background: #1f4b99;
	color: #fff;
	border-bottom-right-radius: 4px;
}

.cpllm-msg__role {
	display: block;
	font-size: 0.72rem;
	font-weight: 700;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	opacity: 0.65;
	margin-bottom: 4px;
}

.cpllm-msg--user .cpllm-msg__role {
	opacity: 0.8;
}

.cpllm-msg--change {
	box-shadow: inset 3px 0 0 #c9852a;
}

.cpllm-msg--skill {
	box-shadow: inset 3px 0 0 #2a7a5c;
}

.cpllm-msg__image-link {
	display: block;
	margin-top: 8px;
}

.cpllm-msg__image {
	display: block;
	max-width: 100%;
	max-height: 260px;
	width: auto;
	border-radius: 8px;
	border: 1px solid rgba(20, 24, 31, 0.12);
	cursor: zoom-in;
}

.cpllm-msg__update-wrap {
	margin-top: 10px;
}

.cpllm-msg__update-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 14px;
	border-radius: 999px;
	border: 1px solid rgba(31, 75, 153, 0.35);
	background: #fff;
	color: #1f4b99;
	font-size: 0.82rem;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.cpllm-msg__update-btn:hover:not(:disabled) {
	background: #1f4b99;
	color: #fff;
}

.cpllm-msg__update-btn:disabled {
	cursor: default;
}

.cpllm-msg__update-btn.is-busy {
	opacity: 0.75;
	border-color: rgba(20, 24, 31, 0.2);
	color: #6b7280;
}

.cpllm-msg__update-btn.is-done {
	background: #ecfdf3;
	border-color: #34a853;
	color: #1c7a3c;
}

.cpllm-msg__update-btn.is-error {
	border-color: #c0392b;
	color: #c0392b;
}

.cpllm-typing {
	align-self: flex-start;
	max-width: 88%;
}

.cpllm-typing[hidden] {
	display: none !important;
}

.cpllm-typing__bubble {
	display: inline-flex;
	flex-direction: column;
	gap: 6px;
	padding: 10px 12px;
	border-radius: 12px;
	border-bottom-left-radius: 4px;
	background: #eef2f7;
	color: #14181f;
}

.cpllm-typing__dots {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	height: 12px;
	padding: 0 2px;
}

.cpllm-typing__dots span {
	display: block;
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #8b95a5;
	animation: cpllm-typing-pulse 1.4s infinite ease-in-out both;
}

.cpllm-typing__dots span:nth-child(1) {
	animation-delay: 0s;
}

.cpllm-typing__dots span:nth-child(2) {
	animation-delay: 0.16s;
}

.cpllm-typing__dots span:nth-child(3) {
	animation-delay: 0.32s;
}

@keyframes cpllm-typing-pulse {
	0%,
	80%,
	100% {
		transform: translateY(0) scale(0.72);
		opacity: 0.45;
	}
	40% {
		transform: translateY(-3px) scale(1);
		opacity: 1;
	}
}

.cpllm-chat__skills {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	padding: 10px 14px;
	border-top: 1px solid rgba(20, 24, 31, 0.06);
	background: #fff;
	flex-shrink: 0;
}

.cpllm-skill-btn {
	appearance: none;
	border: 1px solid rgba(31, 75, 153, 0.35);
	border-radius: 999px;
	padding: 7px 12px;
	font: inherit;
	font-size: 0.85rem;
	font-weight: 600;
	cursor: pointer;
	background: #f3f6fb;
	color: #1f4b99;
}

.cpllm-skill-btn:hover,
.cpllm-skill-btn:focus {
	background: #e7eef9;
}

.cpllm-skill-btn:disabled {
	opacity: 0.55;
	cursor: not-allowed;
}

.cpllm-chat__composer {
	display: flex;
	gap: 8px;
	padding: 12px 14px 14px;
	border-top: 1px solid rgba(20, 24, 31, 0.08);
	background: #fff;
	flex-shrink: 0;
}

.cpllm-chat__error {
	flex-shrink: 0;
	padding: 0 14px;
}

.cpllm-chat__composer textarea {
	flex: 1;
	resize: none;
	min-height: 42px;
	max-height: 110px;
	border: 1px solid rgba(20, 24, 31, 0.18);
	border-radius: 10px;
	padding: 10px 12px;
	font: inherit;
}

.cpllm-chat__composer button,
.cpllm-auth__actions button {
	appearance: none;
	border: 0;
	border-radius: 10px;
	padding: 10px 14px;
	font: inherit;
	font-weight: 650;
	cursor: pointer;
	background: #1f4b99;
	color: #fff;
}

.cpllm-chat__composer button:disabled,
.cpllm-auth__actions button:disabled {
	opacity: 0.55;
	cursor: not-allowed;
}

.wcsb-product--client .wcsb-product__actions {
	position: relative;
	z-index: 2;
}

.cpllm-gallery-overlay {
	position: absolute;
	inset: 0;
	z-index: 5;
	display: flex;
	flex-direction: column;
	background: #fff;
	overflow: hidden;
}

.cpllm-gallery-overlay[hidden] {
	display: none !important;
}

.cpllm-gallery-overlay__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 14px 16px;
	border-bottom: 1px solid rgba(20, 24, 31, 0.08);
	flex-shrink: 0;
}

.cpllm-gallery-overlay__title {
	margin: 0;
	font-size: 1.05rem;
	font-weight: 650;
	line-height: 1.3;
	color: #14181f;
}

.cpllm-gallery-overlay__close {
	appearance: none;
	border: 0;
	background: #1f4b99;
	color: #fff;
	font-size: 1.25rem;
	line-height: 1;
	cursor: pointer;
	border-radius: 8px;
	width: 32px;
	height: 32px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0;
}

.cpllm-gallery-overlay__body {
	flex: 1;
	min-height: 0;
	overflow: auto;
	padding: 0;
	background: #fff;
	display: flex;
	flex-direction: column;
}

.cpllm-gallery-overlay__body > .cpllm-gallery {
	flex: 1;
	min-height: 0;
}

.cpllm-gallery {
	padding: 14px 16px 18px;
	position: relative;
	color: #14181f;
}

.cpllm-gallery--preview {
	display: flex;
	flex-direction: column;
	min-height: 100%;
	height: 100%;
	box-sizing: border-box;
	padding-bottom: 10px;
}

.cpllm-gallery__toolbar {
	display: flex;
	gap: 8px;
	margin: 0 0 10px;
	flex-shrink: 0;
}

.cpllm-gallery__tool-btn {
	appearance: none;
	border: 1px solid rgba(31, 75, 153, 0.28);
	border-radius: 999px;
	padding: 6px 12px;
	font: inherit;
	font-size: 0.84rem;
	font-weight: 650;
	cursor: pointer;
	background: #f3f6fb;
	color: #1f4b99;
}

.cpllm-gallery__tool-btn.is-active {
	background: #1f4b99;
	border-color: #1f4b99;
	color: #fff;
}

.cpllm-gallery__steps {
	list-style: none;
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0 0 10px;
	padding: 0;
}

.cpllm-gallery__step {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 0.78rem;
	font-weight: 650;
	color: rgba(20, 24, 31, 0.45);
}

.cpllm-gallery__step span {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 1.4rem;
	height: 1.4rem;
	border-radius: 999px;
	background: rgba(20, 24, 31, 0.1);
	font-size: 0.72rem;
}

.cpllm-gallery__step.is-active {
	color: #1f4b99;
}

.cpllm-gallery__step.is-active span {
	background: #1f4b99;
	color: #fff;
}

.cpllm-gallery__step.is-done {
	color: rgba(20, 24, 31, 0.7);
}

.cpllm-gallery__step.is-done span {
	background: rgba(31, 75, 153, 0.18);
	color: #1f4b99;
}

.cpllm-gallery__preview-wrap {
	flex: 1;
	min-height: 0;
	height: 100%;
	border: 1px solid rgba(20, 24, 31, 0.12);
	border-radius: 12px;
	overflow: hidden;
	background: #0f1219;
	position: relative;
}

.cpllm-gallery__preview-frame {
	display: block;
	width: 100%;
	height: 100%;
	min-height: 240px;
	border: 0;
	background: #fff;
	/* Let the iframe scroll/tap without fighting the parent page. */
	touch-action: pan-x pan-y;
}

.cpllm-gallery__preview-empty {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 280px;
	padding: 20px;
	color: rgba(255, 255, 255, 0.75);
	text-align: center;
}

.cpllm-gallery__sec-list {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 12px;
}

.cpllm-gallery__sec-chip {
	appearance: none;
	border: 1px solid rgba(31, 75, 153, 0.28);
	border-radius: 999px;
	padding: 6px 10px;
	font: inherit;
	font-size: 0.8rem;
	font-weight: 600;
	cursor: pointer;
	background: #f3f6fb;
	color: #1f4b99;
	display: inline-flex;
	align-items: center;
	gap: 6px;
}

.cpllm-gallery__sec-chip span {
	min-width: 1.25em;
	padding: 0 5px;
	border-radius: 999px;
	background: rgba(31, 75, 153, 0.12);
	font-size: 0.72rem;
	line-height: 1.4;
	text-align: center;
}

.cpllm-gallery__section-panel {
	margin-top: 12px;
	border-top: 1px solid rgba(20, 24, 31, 0.08);
	padding-top: 10px;
}

.cpllm-gallery__section-panel-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	margin-bottom: 8px;
}

.cpllm-gallery__section-panel-head strong {
	font-size: 0.92rem;
}

.cpllm-gallery__section-back {
	appearance: none;
	border: 0;
	background: transparent;
	color: #1f4b99;
	font: inherit;
	font-size: 0.82rem;
	font-weight: 650;
	cursor: pointer;
	padding: 0;
}

.cpllm-gallery__section-strip {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 8px;
	max-height: 180px;
	overflow: auto;
	padding-bottom: 4px;
}

@media (max-width: 560px) {
	.cpllm-gallery__section-strip {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

.cpllm-gallery__page-url {
	margin: 0 0 12px;
	font-size: 0.78rem;
	color: rgba(20, 24, 31, 0.55);
	word-break: break-all;
}

.cpllm-gallery__nav {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0 0 14px;
}

.cpllm-gallery__nav-btn {
	appearance: none;
	border: 1px solid rgba(31, 75, 153, 0.28);
	border-radius: 999px;
	padding: 6px 10px;
	font: inherit;
	font-size: 0.82rem;
	font-weight: 600;
	cursor: pointer;
	background: #f3f6fb;
	color: #1f4b99;
	display: inline-flex;
	align-items: center;
	gap: 6px;
}

.cpllm-gallery__nav-btn span {
	min-width: 1.25em;
	padding: 0 5px;
	border-radius: 999px;
	background: rgba(31, 75, 153, 0.12);
	font-size: 0.75rem;
	line-height: 1.4;
	text-align: center;
}

.cpllm-gallery__nav-btn:hover,
.cpllm-gallery__nav-btn:focus {
	border-color: rgba(31, 75, 153, 0.55);
	background: #eaf0fa;
}

.cpllm-gallery__section {
	margin: 0 0 18px;
}

.cpllm-gallery__section-title {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0 0 10px;
	font-size: 0.95rem;
	font-weight: 700;
	color: #14181f;
}

.cpllm-gallery__section-count {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 22px;
	height: 22px;
	padding: 0 6px;
	border-radius: 999px;
	background: #eef2f7;
	color: #1f4b99;
	font-size: 0.75rem;
	font-weight: 700;
}

.cpllm-gallery__section--uploads {
	padding-top: 8px;
	border-top: 1px solid rgba(20, 24, 31, 0.08);
}

.cpllm-gallery__upload {
	margin-bottom: 14px;
}

.cpllm-gallery__upload-hint {
	margin: 8px 0 0;
	font-size: 0.85rem;
	color: rgba(20, 24, 31, 0.6);
}

.cpllm-gallery__selection {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px 14px;
	margin-bottom: 12px;
	padding: 10px 12px;
	border: 1px solid rgba(20, 24, 31, 0.1);
	border-radius: 10px;
	background: #f7f8fa;
}

.cpllm-gallery__select-all {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-size: 0.9rem;
	font-weight: 600;
	cursor: pointer;
}

.cpllm-gallery__delete-selected {
	appearance: none;
	border: 0;
	border-radius: 8px;
	padding: 7px 12px;
	margin-left: auto;
	font: inherit;
	font-size: 0.88rem;
	font-weight: 650;
	cursor: pointer;
	background: #b42318;
	color: #fff;
}

.cpllm-gallery__delete-selected:disabled {
	opacity: 0.45;
	cursor: not-allowed;
}

.cpllm-gallery__sr {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.cpllm-gallery__upload-btn {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	appearance: none;
	border: 0;
	border-radius: 10px;
	padding: 10px 16px;
	font: inherit;
	font-weight: 650;
	cursor: pointer;
	background: #1f4b99;
	color: #fff;
}

.cpllm-gallery__upload-btn input {
	position: absolute;
	width: 1px;
	height: 1px;
	opacity: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
}

.cpllm-gallery__error {
	margin: 10px 0 0;
	color: #b42318;
	font-size: 0.9rem;
}

.cpllm-gallery__grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 10px;
}

.cpllm-gallery__tile {
	position: relative;
}

.cpllm-gallery__tile.is-selected .cpllm-gallery__item {
	outline: 2px solid #1f4b99;
	outline-offset: 1px;
}

.cpllm-gallery__check {
	position: absolute;
	top: 6px;
	left: 6px;
	z-index: 2;
	display: inline-flex;
	width: 28px;
	height: 28px;
	cursor: pointer;
}

.cpllm-gallery__check input {
	position: absolute;
	opacity: 0;
	inset: 0;
	margin: 0;
	cursor: pointer;
}

.cpllm-gallery__check-mark {
	width: 22px;
	height: 22px;
	border-radius: 6px;
	border: 2px solid #fff;
	background: rgba(20, 24, 31, 0.45);
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.cpllm-gallery__check input:checked + .cpllm-gallery__check-mark {
	background: #1f4b99;
	border-color: #1f4b99;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23fff' stroke-width='2' d='M3.5 8.5l3 3 6-7'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: center;
	background-size: 14px 14px;
}

.cpllm-gallery__item {
	appearance: none;
	border: 1px solid rgba(20, 24, 31, 0.1);
	border-radius: 10px;
	padding: 0;
	overflow: hidden;
	background: #f4f6f9;
	cursor: pointer;
	aspect-ratio: 1 / 1;
	width: 100%;
	display: block;
}

.cpllm-gallery__item img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.cpllm-gallery__item:hover,
.cpllm-gallery__item:focus {
	outline: 2px solid rgba(31, 75, 153, 0.45);
	outline-offset: 1px;
}

.cpllm-gallery__delete {
	position: absolute;
	top: 6px;
	right: 6px;
	appearance: none;
	border: 0;
	border-radius: 999px;
	width: 28px;
	height: 28px;
	padding: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 1.1rem;
	line-height: 1;
	cursor: pointer;
	background: rgba(20, 24, 31, 0.78);
	color: #fff;
	z-index: 2;
}

.cpllm-gallery__delete:hover,
.cpllm-gallery__delete:focus {
	background: #b42318;
}

.cpllm-gallery__delete:disabled {
	opacity: 0.55;
	cursor: not-allowed;
}

.cpllm-gallery__empty,
.cpllm-gallery__status {
	margin: 14px 0 0;
	color: rgba(20, 24, 31, 0.65);
	font-size: 0.92rem;
}

.cpllm-gallery__more {
	margin-top: 14px;
	display: flex;
	justify-content: center;
}

.cpllm-gallery__more-btn {
	appearance: none;
	border: 1px solid rgba(31, 75, 153, 0.35);
	border-radius: 999px;
	padding: 8px 14px;
	font: inherit;
	font-size: 0.9rem;
	font-weight: 600;
	cursor: pointer;
	background: #f3f6fb;
	color: #1f4b99;
}

.cpllm-gallery__more-btn:disabled {
	opacity: 0.55;
	cursor: not-allowed;
}

.cpllm-gallery__viewer {
	position: absolute;
	inset: 0;
	background: rgba(10, 14, 20, 0.94);
	display: flex;
	flex-direction: column;
	padding: 44px 12px 12px;
	z-index: 6;
}

.cpllm-gallery__viewer[hidden] {
	display: none !important;
}

.cpllm-gallery__viewer-media {
	flex: 1;
	min-height: 0;
	display: flex;
	align-items: center;
	justify-content: center;
}

.cpllm-gallery__viewer img {
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
	border-radius: 8px;
}

.cpllm-gallery__viewer-close {
	position: absolute;
	top: 8px;
	right: 10px;
	appearance: none;
	border: 0;
	background: #1f4b99;
	color: #fff;
	font-size: 1.25rem;
	line-height: 1;
	cursor: pointer;
	border-radius: 8px;
	width: 32px;
	height: 32px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	z-index: 2;
}

.cpllm-gallery__viewer-prompt {
	flex-shrink: 0;
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 10px;
	margin-top: 10px;
	border-radius: 12px;
	background: #fff;
}

.cpllm-gallery__viewer-context {
	flex-shrink: 0;
	margin: 8px 0 0;
	padding: 8px 12px;
	border-radius: 8px;
	background: rgba(255, 255, 255, 0.12);
	color: rgba(255, 255, 255, 0.85);
	font-size: 0.78rem;
	line-height: 1.35;
}

.cpllm-gallery__viewer-context[hidden] {
	display: none !important;
}

.cpllm-gallery__filters {
	display: flex;
	flex-wrap: nowrap;
	gap: 6px;
	overflow-x: auto;
	padding-bottom: 2px;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: thin;
}

.cpllm-gallery__filter-chip {
	appearance: none;
	border: 1px solid rgba(20, 24, 31, 0.16);
	background: #f5f6f8;
	color: #2a2f37;
	border-radius: 999px;
	padding: 6px 12px 6px 8px;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font: inherit;
	font-size: 0.78rem;
	font-weight: 600;
	white-space: nowrap;
	flex-shrink: 0;
	cursor: pointer;
	transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.cpllm-gallery__filter-chip svg {
	flex-shrink: 0;
}

.cpllm-gallery__filter-chip:hover {
	border-color: #1f4b99;
	color: #1f4b99;
}

.cpllm-gallery__filter-chip.is-active {
	background: #1f4b99;
	border-color: #1f4b99;
	color: #fff;
}

.cpllm-gallery__upload-chip {
	border-color: #1f4b99;
	color: #1f4b99;
	background: #eef3fc;
	position: relative;
}

.cpllm-gallery__upload-chip input[type="file"] {
	position: absolute;
	inset: 0;
	opacity: 0;
	pointer-events: none;
}

.cpllm-gallery__upload-chip.is-busy {
	opacity: 0.65;
	cursor: default;
}

.cpllm-gallery__viewer-prompt-row {
	display: flex;
	gap: 8px;
}

.cpllm-gallery__viewer-prompt-row textarea {
	flex: 1;
	resize: none;
	min-height: 44px;
	max-height: 110px;
	border: 1px solid rgba(20, 24, 31, 0.18);
	border-radius: 10px;
	padding: 10px 12px;
	font: inherit;
}

.cpllm-gallery__viewer-prompt-row button {
	appearance: none;
	border: 0;
	border-radius: 10px;
	padding: 10px 14px;
	font: inherit;
	font-weight: 650;
	cursor: pointer;
	background: #1f4b99;
	color: #fff;
	align-self: flex-end;
}

.cpllm-gallery__viewer-prompt-row button:disabled {
	opacity: 0.55;
	cursor: not-allowed;
}

@media (max-width: 560px) {
	.cpllm-gallery__grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

.cpllm-gallery__text-list-label {
	margin: 12px 0 6px;
	font-size: 0.78rem;
	font-weight: 650;
	color: rgba(20, 24, 31, 0.55);
	text-transform: uppercase;
	letter-spacing: 0.02em;
}

.cpllm-gallery__text-list {
	display: flex;
	flex-direction: column;
	gap: 6px;
	max-height: 160px;
	overflow: auto;
}

.cpllm-gallery__text-row {
	appearance: none;
	display: flex;
	align-items: baseline;
	gap: 8px;
	width: 100%;
	text-align: left;
	border: 1px solid rgba(201, 133, 42, 0.35);
	background: rgba(201, 133, 42, 0.08);
	border-radius: 8px;
	padding: 7px 10px;
	font: inherit;
	cursor: pointer;
	transition: background 0.12s ease, border-color 0.12s ease;
}

.cpllm-gallery__text-row:hover {
	background: rgba(201, 133, 42, 0.16);
	border-color: #c9852a;
}

.cpllm-gallery__text-row-tag {
	flex-shrink: 0;
	font-size: 0.68rem;
	font-weight: 700;
	text-transform: uppercase;
	color: #9a6417;
	background: rgba(201, 133, 42, 0.18);
	border-radius: 999px;
	padding: 2px 6px;
}

.cpllm-gallery__text-row-preview {
	flex: 1;
	min-width: 0;
	font-size: 0.84rem;
	color: #2a2f37;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.cpllm-gallery__text-viewer {
	position: absolute;
	inset: 0;
	background: rgba(10, 14, 20, 0.94);
	display: flex;
	flex-direction: column;
	padding: 44px 12px 12px;
	z-index: 6;
}

.cpllm-gallery__text-viewer[hidden] {
	display: none !important;
}

.cpllm-gallery__text-viewer-body {
	flex: 1;
	min-height: 0;
	display: flex;
	flex-direction: column;
	gap: 8px;
	background: #fff;
	border-radius: 12px;
	padding: 16px;
	overflow: auto;
}

.cpllm-gallery__text-viewer-context {
	margin: 0;
	padding: 10px 12px;
	border-radius: 8px;
	background: rgba(20, 24, 31, 0.05);
	font-size: 0.86rem;
	line-height: 1.45;
	color: rgba(20, 24, 31, 0.65);
}

.cpllm-gallery__text-viewer-context[hidden] {
	display: none !important;
}

.cpllm-gallery__text-viewer-context mark {
	background: rgba(201, 133, 42, 0.28);
	color: #2a2f37;
	font-weight: 650;
	border-radius: 3px;
	padding: 0 2px;
}

.cpllm-gallery__text-viewer-occurrence {
	margin: 0;
	padding: 8px 12px;
	border-radius: 8px;
	background: rgba(198, 66, 66, 0.1);
	border: 1px solid rgba(198, 66, 66, 0.25);
	color: #a13d3d;
	font-size: 0.78rem;
	line-height: 1.35;
}

.cpllm-gallery__text-viewer-occurrence[hidden] {
	display: none !important;
}

.cpllm-gallery__text-viewer-label {
	font-size: 0.76rem;
	font-weight: 650;
	color: rgba(20, 24, 31, 0.55);
	text-transform: uppercase;
	letter-spacing: 0.02em;
}

.cpllm-gallery__text-viewer-current {
	margin: 0 0 6px;
	padding: 10px 12px;
	border-radius: 8px;
	background: rgba(201, 133, 42, 0.1);
	border: 1px solid rgba(201, 133, 42, 0.3);
	font-size: 0.92rem;
	color: #2a2f37;
	white-space: pre-wrap;
}

.cpllm-gallery__text-viewer-form {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.cpllm-gallery__text-viewer-form textarea {
	resize: vertical;
	min-height: 70px;
	border: 1px solid rgba(20, 24, 31, 0.18);
	border-radius: 10px;
	padding: 10px 12px;
	font: inherit;
}

.cpllm-gallery__text-viewer-form button {
	appearance: none;
	align-self: flex-end;
	border: 0;
	border-radius: 10px;
	padding: 10px 16px;
	font: inherit;
	font-weight: 650;
	cursor: pointer;
	background: #1f4b99;
	color: #fff;
}

.cpllm-gallery__text-viewer-form button:disabled {
	opacity: 0.55;
	cursor: not-allowed;
}

/* —— iPhone / small phone: Modify Page —— */
@media (max-width: 640px) {
	/* Full-bleed Modify Page so the preview gets the whole screen. */
	.cpllm-modal.is-gallery-open {
		max-width: 100%;
		width: 100%;
		height: 100%;
		max-height: 100%;
		margin: 0;
		padding: 0;
	}

	.cpllm-modal__panel.is-gallery-open {
		max-width: 100%;
		width: 100%;
		height: 100vh;
		height: 100dvh;
		max-height: 100vh;
		max-height: 100dvh;
		border-radius: 0;
		box-shadow: none;
	}

	.cpllm-gallery-overlay__header {
		padding: max(10px, env(safe-area-inset-top, 0px)) 12px 10px;
		gap: 8px;
	}

	.cpllm-gallery-overlay__title {
		font-size: 1rem;
	}

	.cpllm-gallery-overlay__close,
	.cpllm-gallery__viewer-close {
		width: 44px;
		height: 44px;
		font-size: 1.35rem;
		touch-action: manipulation;
	}

	.cpllm-gallery-overlay {
		overscroll-behavior: contain;
	}

	.cpllm-gallery-overlay.is-gallery-wide .cpllm-gallery-overlay__body {
		/* Preview mode: fill the screen; scroll inside the iframe, not the shell. */
		overflow: hidden;
		padding-bottom: 0;
	}

	.cpllm-gallery--preview {
		padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px));
		gap: 0;
		height: 100%;
		min-height: 0;
	}

	.cpllm-gallery__toolbar {
		flex-wrap: nowrap;
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
		margin-bottom: 8px;
		padding-bottom: 2px;
		scrollbar-width: none;
	}

	.cpllm-gallery__toolbar::-webkit-scrollbar {
		display: none;
	}

	.cpllm-gallery__tool-btn {
		min-height: 44px;
		padding: 10px 16px;
		font-size: 0.9rem;
		flex-shrink: 0;
		touch-action: manipulation;
	}

	/* URL is noise on a phone — keep the preview tall. */
	.cpllm-gallery__page-url {
		display: none;
	}

	.cpllm-gallery__preview-wrap {
		flex: 1 1 auto;
		min-height: 0;
		border-radius: 10px;
	}

	.cpllm-gallery__preview-frame {
		position: absolute;
		inset: 0;
		width: 100%;
		height: 100%;
		min-height: 0;
	}

	.cpllm-gallery__preview-empty {
		min-height: 180px;
		padding: 16px;
		font-size: 0.92rem;
	}

	.cpllm-gallery__viewer,
	.cpllm-gallery__text-viewer {
		padding-top: max(52px, calc(8px + env(safe-area-inset-top, 0px)));
		padding-right: max(10px, env(safe-area-inset-right, 0px));
		padding-bottom: max(10px, env(safe-area-inset-bottom, 0px));
		padding-left: max(10px, env(safe-area-inset-left, 0px));
	}

	.cpllm-gallery__viewer-prompt {
		padding: 10px;
		border-radius: 14px 14px 0 0;
	}

	.cpllm-gallery__filters {
		gap: 8px;
		padding-bottom: 4px;
	}

	.cpllm-gallery__filter-chip {
		min-height: 40px;
		padding: 8px 12px 8px 10px;
		font-size: 0.84rem;
		touch-action: manipulation;
	}

	.cpllm-gallery__viewer-prompt-row {
		flex-direction: column;
		align-items: stretch;
	}

	.cpllm-gallery__viewer-prompt-row textarea,
	.cpllm-gallery__text-viewer-form textarea {
		/* iOS zooms inputs under 16px — keep them readable without zoom jump. */
		font-size: 16px;
		min-height: 48px;
	}

	.cpllm-gallery__viewer-prompt-row button,
	.cpllm-gallery__text-viewer-form button {
		width: 100%;
		align-self: stretch;
		min-height: 48px;
		touch-action: manipulation;
	}

	.cpllm-gallery__text-viewer-body {
		padding: 14px;
		border-radius: 14px;
	}

	.cpllm-gallery__text-viewer-form textarea {
		min-height: 96px;
	}

	.cpllm-gallery__upload-btn {
		min-height: 48px;
		width: 100%;
		touch-action: manipulation;
	}

	.cpllm-gallery__grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 8px;
	}

	.cpllm-gallery__check,
	.cpllm-gallery__delete {
		width: 36px;
		height: 36px;
	}

	.cpllm-gallery__check-mark {
		width: 26px;
		height: 26px;
	}
}
