.twc-root {
	--twc-color: #00679e;
	position: fixed;
	bottom: 20px;
	z-index: 99999;
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
	font-size: 15px;
	line-height: 1.4;
	color: #1f2933;
}
.twc-root *, .twc-root *::before, .twc-root *::after { box-sizing: border-box; }
.twc-pos-right { right: 20px; }
.twc-pos-left { left: 20px; }

.twc-toggle {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 56px;
	height: 56px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--twc-color);
	color: #fff;
	cursor: pointer;
	box-shadow: 0 4px 14px rgba(0, 0, 0, .3);
}
.twc-pos-right .twc-toggle { margin-left: auto; }
.twc-toggle:focus-visible,
.twc-hbtn:focus-visible,
.twc-send:focus-visible,
.twc-input:focus-visible,
.twc-intro input:focus-visible,
.twc-intro textarea:focus-visible,
.twc-skip:focus-visible,
.twc-start:focus-visible {
	outline: 3px solid #ffbf47;
	outline-offset: 2px;
}

.twc-badge {
	position: absolute;
	top: -4px;
	right: -4px;
	min-width: 20px;
	height: 20px;
	padding: 0 5px;
	border-radius: 10px;
	background: #c62828;
	color: #fff;
	font-size: 12px;
	font-weight: 700;
	line-height: 20px;
	text-align: center;
}

.twc-panel {
	display: flex;
	flex-direction: column;
	width: 360px;
	max-width: calc(100vw - 40px);
	height: 540px;
	max-height: calc(100vh - 110px);
	margin-bottom: 12px;
	background: #fff;
	border-radius: 12px;
	overflow: hidden;
	box-shadow: 0 8px 30px rgba(0, 0, 0, .28);
}
.twc-panel[hidden], .twc-root [hidden] { display: none !important; }

.twc-header {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 12px 14px;
	background: var(--twc-color);
	color: #fff;
}
.twc-title { flex: 1; font-weight: 600; font-size: 16px; }
.twc-hbtn {
	margin: 0;
	padding: 4px 8px;
	border: 1px solid rgba(255, 255, 255, .6);
	border-radius: 6px;
	background: transparent;
	color: #fff;
	font: inherit;
	font-size: 13px;
	cursor: pointer;
}
.twc-hbtn:hover { background: rgba(255, 255, 255, .18); }
.twc-close { font-size: 20px; line-height: 1; padding: 2px 9px; }

.twc-log {
	flex: 1;
	padding: 12px;
	overflow-y: auto;
	background: #f4f6f8;
	display: flex;
	flex-direction: column;
	gap: 8px;
}
.twc-msg {
	max-width: 85%;
	padding: 8px 11px;
	border-radius: 12px;
	word-wrap: break-word;
	overflow-wrap: anywhere;
}
.twc-text { white-space: pre-wrap; }
.twc-who { font-size: 12px; font-weight: 600; margin-bottom: 2px; color: #52606d; }
.twc-time { margin-top: 3px; font-size: 11px; opacity: .65; text-align: right; }
.twc-me { align-self: flex-end; background: var(--twc-color); color: #fff; border-bottom-right-radius: 3px; }
.twc-agent { align-self: flex-start; background: #fff; border: 1px solid #d9e0e6; border-bottom-left-radius: 3px; }
.twc-system { align-self: stretch; max-width: 100%; background: transparent; color: #52606d; text-align: center; font-size: 14px; }
.twc-pending { opacity: .6; }

.twc-wait {
	padding: 10px 14px;
	background: #fff4d6;
	border-top: 1px solid #f0d78c;
	color: #4d3b00;
	font-size: 13px;
}
.twc-wait-title { display: block; font-size: 14px; margin-bottom: 2px; }
.twc-wait-time { margin-top: 4px; font-size: 12px; opacity: .8; }

.twc-status {
	padding: 8px 14px;
	background: #fdecea;
	color: #8a1c14;
	font-size: 13px;
}

.twc-form {
	padding: 10px;
	border-top: 1px solid #d9e0e6;
	background: #fff;
}
/* Start-Formular */
.twc-intro {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 12px;
	padding: 14px;
	overflow-y: auto;
	background: #fff;
}
.twc-welcome { margin: 0; color: #323f4b; }
.twc-note {
	padding: 8px 10px;
	border-radius: 8px;
	background: #eef2f6;
	color: #323f4b;
	font-size: 13px;
}
.twc-field { display: flex; flex-direction: column; gap: 4px; }
.twc-label, .twc-legend { font-size: 13px; font-weight: 600; color: #323f4b; }
.twc-fieldset { margin: 0; padding: 0; border: 0; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.twc-legend { padding: 0; margin-bottom: 4px; }
.twc-radios { display: flex; gap: 18px; }
.twc-radio { font-size: 14px; cursor: pointer; }
.twc-intro input[type="text"],
.twc-intro input[type="email"],
.twc-intro textarea {
	width: 100%;
	padding: 8px 10px;
	border: 1px solid #aeb8c2;
	border-radius: 8px;
	font: inherit;
	color: inherit;
	background: #fff;
}
.twc-intro textarea { min-height: 76px; resize: vertical; }
.twc-intro [aria-invalid="true"] { border-color: #c62828; }
.twc-ferr { font-size: 13px; color: #8a1c14; }
.twc-skip {
	align-self: flex-start;
	margin: 6px 0 0;
	padding: 7px 12px;
	border: 1px solid var(--twc-color);
	border-radius: 8px;
	background: #fff;
	color: var(--twc-color);
	font: inherit;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
}
.twc-start {
	margin: 0;
	padding: 10px 14px;
	border: 0;
	border-radius: 8px;
	background: var(--twc-color);
	color: #fff;
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}
.twc-start:disabled { opacity: .6; cursor: default; }
.twc-ticket { display: flex; flex-direction: column; }

.twc-consent { font-size: 13px; color: #323f4b; }
.twc-consent a { color: var(--twc-color); text-decoration: underline; }
.twc-row { display: flex; gap: 8px; align-items: flex-end; }
.twc-input {
	flex: 1;
	min-height: 38px;
	max-height: 120px;
	padding: 8px 10px;
	border: 1px solid #aeb8c2;
	border-radius: 8px;
	font: inherit;
	color: inherit;
	background: #fff;
	resize: none;
}
.twc-send {
	margin: 0;
	padding: 9px 14px;
	border: 0;
	border-radius: 8px;
	background: var(--twc-color);
	color: #fff;
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}
.twc-send:disabled { opacity: .55; cursor: default; }

@media (max-width: 480px) {
	.twc-root { bottom: 12px; }
	.twc-pos-right { right: 12px; }
	.twc-pos-left { left: 12px; }
	.twc-panel { width: calc(100vw - 24px); max-width: none; height: calc(100vh - 90px); }
}
@media (prefers-reduced-motion: no-preference) {
	.twc-panel { animation: twc-in .15s ease-out; }
	@keyframes twc-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
}

.twc-wait-queue { margin-top: 6px; font-size: 13px; font-weight: 600; white-space: pre-line; }
.twc-wait-queue[hidden], .twc-closed[hidden] { display: none; }
.twc-closed {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 12px 14px;
	background: #eef1f4;
	border-top: 1px solid #d5dae0;
	color: #333;
	font-size: 13px;
}
.twc-newchat {
	align-self: flex-start;
	padding: 8px 14px;
	border: 0;
	border-radius: 8px;
	background: var(--twc-color);
	color: #fff;
	font: inherit;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
}
.twc-newchat:focus-visible { outline: 2px solid var(--twc-color); outline-offset: 2px; }
