.ny-chat {
	--ny-chat-accent: #246b45;
	--ny-chat-accent-strong: #17472f;
	--ny-chat-border: #d7ddd9;
	--ny-chat-error: #a61b1b;
	--ny-chat-surface: #ffffff;
	--ny-chat-surface-muted: #f4f7f5;
	--ny-chat-text: #17211b;
	--ny-chat-text-muted: #5e6a63;
	--ny-chat-font-size: 16px;
	bottom: 24px;
	color: var(--ny-chat-text);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	position: fixed;
	right: 24px;
	z-index: 999999;
}

.ny-chat *,
.ny-chat *::before,
.ny-chat *::after {
	box-sizing: border-box;
}

.ny-chat__launcher {
	align-items: center;
	background: var(--ny-chat-accent);
	border: 0;
	border-radius: 999px;
	color: #ffffff;
	cursor: pointer;
	display: flex;
	font-size: 15px;
	font-weight: 700;
	gap: 8px;
	min-height: 48px;
	padding: 10px 16px;
}

.ny-chat__launcher:hover,
.ny-chat__launcher:focus-visible {
	background: var(--ny-chat-accent-strong);
}

.ny-chat__preview-badge {
	background: rgba(255, 255, 255, 0.18);
	border-radius: 999px;
	font-size: 11px;
	font-weight: 600;
	padding: 3px 7px;
}

.ny-chat__panel {
	background: var(--ny-chat-surface);
	border: 1px solid var(--ny-chat-border);
	border-radius: 12px;
	bottom: 0;
	display: flex;
	flex-direction: column;
	font-size: var(--ny-chat-font-size);
	max-height: min(680px, calc(100vh - 48px));
	overflow: hidden;
	position: absolute;
	right: 0;
	width: min(390px, calc(100vw - 32px));
}

.ny-chat__panel[hidden] {
	display: none;
}

.ny-chat__header {
	align-items: flex-start;
	background: var(--ny-chat-accent);
	color: #ffffff;
	display: flex;
	justify-content: space-between;
	padding: 16px;
}

.ny-chat__header h2 {
	color: inherit;
	font-size: 1.125em;
	line-height: 1.25;
	margin: 0;
}

.ny-chat__header p {
	color: inherit;
	font-size: 0.8em;
	margin: 4px 0 0;
	opacity: 0.85;
}

.ny-chat__icon-button {
	background: transparent;
	border: 0;
	color: #ffffff;
	cursor: pointer;
	font-size: 24px;
	line-height: 1;
	padding: 2px 6px;
}

.ny-chat__body {
	display: grid;
	gap: 14px;
	overflow-y: auto;
	padding: 16px;
}

.ny-chat__status {
	background: var(--ny-chat-surface-muted);
	border-radius: 6px;
	font-size: 0.875em;
	padding: 10px;
}

.ny-chat__status[data-result="success"] {
	border-left: 3px solid var(--ny-chat-accent);
}

.ny-chat__status[data-result="error"] {
	border-left: 3px solid var(--ny-chat-error);
}

.ny-chat__welcome {
	color: var(--ny-chat-text);
	font-size: 1em;
	font-weight: 600;
	line-height: 1.5;
	white-space: pre-line;
}

.ny-chat__notice {
	font-size: 0.875em;
}

.ny-chat__notice p {
	color: var(--ny-chat-text-muted);
	font-size: 0.8125em;
	margin: 6px 0 0;
}

.ny-chat__messages {
	display: grid;
	gap: 8px;
	list-style: none;
	margin: 0;
	padding: 0;
}

.ny-chat__message {
	background: var(--ny-chat-surface-muted);
	border-radius: 8px;
	margin-left: 36px;
	padding: 9px 11px;
}

.ny-chat__message p {
	font-size: 1em;
	line-height: 1.5;
	margin: 0;
	overflow-wrap: anywhere;
	white-space: pre-wrap;
}

.ny-chat__message span {
	color: var(--ny-chat-text-muted);
	display: block;
	font-size: 0.7em;
	margin-top: 4px;
	text-align: right;
}

.ny-chat__composer {
	border-top: 1px solid var(--ny-chat-border);
	display: grid;
	gap: 8px;
	grid-template-columns: 1fr auto auto;
	padding: 12px;
}

.ny-chat__composer textarea {
	border: 1px solid var(--ny-chat-border);
	border-radius: 6px;
	font: inherit;
	grid-column: 1 / -1;
	padding: 8px;
	resize: none;
}

.ny-chat__composer button,
.ny-chat__attachment-button,
.ny-chat__debug button {
	border: 1px solid var(--ny-chat-border);
	border-radius: 6px;
	font: inherit;
	padding: 6px 10px;
}

#ny-chat-send {
	align-self: end;
	font-size: 12px;
	grid-column: 3;
	grid-row: 2;
	padding: 4px 7px;
}

.ny-chat__attachment-button {
	align-self: end;
	cursor: pointer;
	font-size: 12px;
	grid-column: 2;
	grid-row: 2;
	padding: 4px 7px;
}

.ny-chat__message img {
	border-radius: 6px;
	display: block;
	margin-top: 6px;
	max-height: 240px;
	max-width: 100%;
}

.ny-chat__guest-identity {
	background: var(--ny-chat-surface-muted);
	border: 1px solid var(--ny-chat-border);
	border-radius: 6px;
	display: grid;
	gap: 6px;
	padding: 10px;
}

.ny-chat__guest-identity[hidden] {
	display: none;
}

.ny-chat__guest-identity p {
	font-size: 12px;
	margin: 0 0 4px;
}

.ny-chat__guest-identity input {
	border: 1px solid var(--ny-chat-border);
	border-radius: 5px;
	font: inherit;
	padding: 6px;
}

.ny-chat__guest-identity div {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-top: 4px;
}

.ny-chat__debug {
	border-top: 1px solid var(--ny-chat-border);
	font-size: 12px;
	max-height: 250px;
	overflow: auto;
	padding: 10px 12px;
}

.ny-chat__debug > summary {
	cursor: pointer;
	font-weight: 700;
}

.ny-chat__debug-toolbar {
	align-items: center;
	display: flex;
	gap: 8px;
	margin-top: 10px;
}

.ny-chat__debug-toolbar label {
	margin-right: auto;
}

.ny-chat__debug-events {
	display: grid;
	gap: 6px;
	list-style-position: inside;
	margin: 10px 0 0;
	padding: 0;
}

.ny-chat__debug-events summary {
	cursor: pointer;
	overflow-wrap: anywhere;
}

.ny-chat__debug-events pre {
	background: var(--ny-chat-surface-muted);
	border-radius: 4px;
	font-size: 11px;
	margin: 6px 0;
	overflow: auto;
	padding: 8px;
	white-space: pre-wrap;
}

@media (max-width: 480px) {
	.ny-chat {
		bottom: 16px;
		right: 16px;
	}

	.ny-chat__panel {
		max-height: calc(100vh - 32px);
	}
}
