/* Diesendorf Assistent */
.dia {
	--dia-accent: #1a5fb4;
	--dia-on-accent: #fff;
	--dia-bg: #ffffff;
	--dia-soft: #f3f5f8;
	--dia-line: #e3e7ee;
	--dia-text: #1f2937;
	--dia-muted: #6b7280;
	position: fixed;
	right: 20px;
	bottom: calc(20px + var(--dia-lift, 0px));
	z-index: 99990;
	font-family: inherit;
	font-size: 15px;
	line-height: 1.45;
	color: var(--dia-text);
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 12px;
}
.dia *, .dia *::before, .dia *::after { box-sizing: border-box; }

/* Schutz gegen Theme-Stile (Jupiter X / Elementor setzen Buttons global) */
.dia button, .dia a, .dia input, .dia textarea, .dia label {
	text-transform: none !important;
	letter-spacing: normal !important;
	text-shadow: none !important;
	min-height: 0;
	line-height: 1.35;
	font-family: inherit;
}
.dia button { margin: 0; box-shadow: none; }

/* Avatar */
.dia-avatar {
	display: inline-block;
	flex: none;
	border-radius: 50%;
	background-color: #d9dde5;
	background-repeat: no-repeat;
	background-size: 118% auto;
	background-position: 50% 12%;
}
.dia-avatar-md { width: 44px; height: 44px; margin-right: 10px; border: 2px solid rgba(255, 255, 255, .85); }
.dia-avatar-lg { width: 100%; height: 100%; }

/* Startknopf */
.dia .dia-launcher {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	height: 54px;
	padding: 0 20px 0 16px;
	border: 0 !important;
	border-radius: 999px !important;
	background: var(--dia-accent) !important;
	color: var(--dia-on-accent) !important;
	font: inherit;
	font-size: 16px !important;
	font-weight: 600 !important;
	cursor: pointer;
	box-shadow: 0 6px 20px rgba(15, 23, 42, .22);
	transition: transform .15s ease, box-shadow .15s ease;
}
.dia-launcher.dia-has-avatar { padding: 0 20px 0 5px; }
.dia-launcher-pic { position: relative; width: 46px; height: 46px; flex: none; }
.dia-launcher-badge {
	position: absolute; right: -3px; bottom: -3px;
	width: 22px; height: 22px; border-radius: 50%;
	background: #F39200; color: #fff;
	display: flex; align-items: center; justify-content: center;
	border: 2px solid var(--dia-accent);
}
.dia-launcher-badge svg { width: 13px; height: 13px; }
.dia-launcher:hover { transform: translateY(-1px); box-shadow: 0 10px 26px rgba(15, 23, 42, .26); }
.dia-launcher:focus-visible, .dia button:focus-visible, .dia a:focus-visible, .dia input:focus-visible, .dia textarea:focus-visible {
	outline: 3px solid var(--dia-accent);
	outline-offset: 2px;
}
.dia-launcher:focus-visible { outline-color: #111827; }
.dia button:focus:not(:focus-visible), .dia a:focus:not(:focus-visible) { outline: none; }
.dia-is-open .dia-launcher-label { display: none; }
.dia-is-open .dia-launcher { padding: 0 15px; }
.dia-is-open .dia-launcher.dia-has-avatar { padding: 0 4px; }

/* Hinweis-Blase */
.dia-teaser {
	display: flex;
	align-items: flex-start;
	max-width: 260px;
	background: var(--dia-bg);
	border: 1px solid var(--dia-line);
	border-radius: 14px 14px 4px 14px;
	box-shadow: 0 6px 20px rgba(15, 23, 42, .14);
	animation: dia-in .25s ease both;
}
.dia-teaser-text { flex: 1; text-align: left; border: 0; background: none; padding: 12px 4px 12px 14px; font: inherit; color: inherit; cursor: pointer; }
.dia-teaser-x { border: 0; background: none; font-size: 20px; line-height: 1; padding: 8px 10px; color: var(--dia-muted); cursor: pointer; }

/* Fenster */
.dia-panel {
	width: 380px;
	max-width: calc(100vw - 24px);
	height: 600px;
	max-height: calc(100vh - 110px - var(--dia-lift, 0px));
	background: var(--dia-bg);
	border-radius: 18px;
	box-shadow: 0 18px 50px rgba(15, 23, 42, .28);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	animation: dia-in .22s ease both;
}
.dia-panel[hidden] { display: none; }

.dia-head {
	display: flex;
	align-items: center;
	gap: 4px;
	padding: 14px 10px 14px 18px;
	background: var(--dia-accent);
	color: var(--dia-on-accent);
}
.dia-head-text { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.dia-head-text strong { font-size: 16px; }
.dia-status { font-size: 12.5px; opacity: .88; }
.dia .dia-icon-btn {
	display: inline-flex; align-items: center; justify-content: center; padding: 0 !important;
	width: 36px; height: 36px; border: 0 !important; border-radius: 10px !important;
	background: transparent; color: inherit; cursor: pointer;
}
.dia-icon-btn:hover { background: rgba(255, 255, 255, .16); }

.dia-log {
	flex: 1;
	overflow-y: auto;
	padding: 16px 14px 8px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	background: var(--dia-soft);
	overscroll-behavior: contain;
	position: relative;
}

.dia-msg {
	max-width: 86%;
	padding: 10px 13px;
	border-radius: 14px;
	white-space: pre-line;
	animation: dia-in .2s ease both;
	word-wrap: break-word;
}
.dia-bot { align-self: flex-start; background: var(--dia-bg); border: 1px solid var(--dia-line); border-bottom-left-radius: 4px; }
.dia-bot a { color: var(--dia-accent); font-weight: 600; text-decoration: underline; }
.dia-user { align-self: flex-end; background: var(--dia-accent); color: var(--dia-on-accent); border-bottom-right-radius: 4px; }

.dia-typing { display: inline-flex; gap: 4px; padding: 13px 14px; }
.dia-typing span { width: 7px; height: 7px; border-radius: 50%; background: #9ca3af; animation: dia-dot 1s infinite ease-in-out; }
.dia-typing span:nth-child(2) { animation-delay: .15s; }
.dia-typing span:nth-child(3) { animation-delay: .3s; }

.dia-choices { display: flex; flex-wrap: wrap; gap: 7px; padding-left: 2px; }
.dia .dia-chip {
	border: 1.5px solid var(--dia-accent) !important;
	background: var(--dia-bg);
	color: var(--dia-accent);
	border-radius: 999px !important;
	line-height: 1.3;
	padding: 7px 13px;
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	text-align: left;
	transition: background .12s ease, color .12s ease;
}
.dia .dia-chip:hover:not([disabled]), .dia .dia-chip:focus-visible { background: var(--dia-accent) !important; color: var(--dia-on-accent) !important; }
.dia .dia-chip-primary { background: var(--dia-accent) !important; color: var(--dia-on-accent) !important; }
.dia-used { display: none; } /* gewählte Antwort steht schon als Nachricht im Verlauf */

.dia-actions { display: flex; flex-direction: column; gap: 7px; align-self: stretch; }
.dia-action {
	display: flex; align-items: center; justify-content: center; gap: 8px;
	padding: 11px 14px; border-radius: 12px;
	background: var(--dia-accent); color: var(--dia-on-accent) !important;
	font-weight: 600; text-decoration: none !important;
}
.dia-action-wa { background: #1f8f4e; color: #fff !important; }
.dia-action:hover { filter: brightness(1.07); }

/* Formular */
.dia-form {
	background: var(--dia-bg);
	border: 1px solid var(--dia-line);
	border-radius: 14px;
	padding: 14px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	animation: dia-in .2s ease both;
}
.dia-field { display: flex; flex-direction: column; gap: 4px; }
.dia-field label { font-size: 13px; font-weight: 600; color: var(--dia-text); }
.dia-field input, .dia-field textarea {
	width: 100%;
	font: inherit;
	font-size: 16px; /* verhindert Zoom auf iPhone */
	padding: 9px 11px;
	border: 1px solid #cbd2dc;
	border-radius: 9px;
	background: #fff;
	color: var(--dia-text);
	margin: 0;
	box-shadow: none;
}
.dia-field textarea { resize: vertical; min-height: 70px; }
.dia-consent { display: flex; gap: 9px; align-items: flex-start; font-size: 12.5px; color: var(--dia-muted); }
.dia-consent input { margin: 3px 0 0; width: 17px; height: 17px; flex: none; accent-color: var(--dia-accent); }
.dia-consent a { color: var(--dia-accent); }
.dia-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }
.dia-error { color: #b42318; font-size: 13.5px; }
.dia-error:empty { display: none; }
.dia .dia-submit {
	border: 0 !important; border-radius: 11px !important; font-size: 15px; padding: 12px 16px;
	background: var(--dia-accent); color: var(--dia-on-accent);
	font: inherit; font-weight: 700; cursor: pointer;
}
.dia-submit[disabled] { opacity: .7; cursor: default; }
.dia-done { opacity: .75; }

.dia-foot { padding: 8px 14px 10px; font-size: 11.5px; color: var(--dia-muted); text-align: center; border-top: 1px solid var(--dia-line); background: var(--dia-bg); }

@keyframes dia-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes dia-dot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

/* Handy: Fenster nimmt fast den ganzen Bildschirm ein */
@media (max-width: 520px) {
	.dia { right: 12px; bottom: calc(12px + var(--dia-lift, 0px)); }
	.dia-launcher-label { display: none; }
	.dia-launcher { padding: 0 15px; }
	.dia .dia-launcher.dia-has-avatar { padding: 0 4px; height: 58px; }
	.dia-launcher.dia-has-avatar .dia-launcher-pic { width: 50px; height: 50px; }
	.dia-is-open .dia-launcher { display: none; }
	.dia-is-open { left: 0; right: 0; top: 0; bottom: 0; }
	.dia-is-open .dia-panel { width: 100%; max-width: none; height: 100%; max-height: none; border-radius: 0; }
}

@media (prefers-reduced-motion: reduce) {
	.dia *, .dia { animation: none !important; transition: none !important; }
}

@media print { .dia { display: none !important; } }
