/* KH Kundenbereich – gemeinsame Gestaltung (Backend + Kundenbereich) */
:root {
	--rc-navy: #2b2b2b;
	--rc-navy-2: #3c3c3c;
	--rc-blau: #8a6a33;
	--rc-blau-hell: #f4eee2;
	--rc-bernstein: #c9a96e;
	--rc-bernstein-hell: #f8f1e3;
	--rc-rot: #c2412d;
	--rc-rot-hell: #fbe9e6;
	--rc-gruen: #2f8a5b;
	--rc-gruen-hell: #e2f3ea;
	--rc-flaeche: #f6f4f0;
	--rc-weiss: #ffffff;
	--rc-linie: #e4ded3;
	--rc-text: #262421;
	--rc-leise: #6b665e;
	--rc-titel: 'KHKB Montserrat', 'Montserrat', 'Segoe UI', sans-serif;
	--rc-text-font: 'KHKB Poppins', 'Poppins', 'Segoe UI', sans-serif;
	--rc-radius: 14px;
	--rc-radius-klein: 8px;
}

/* ---------- Laufzeit-Leiste ---------- */
.khkb-leiste { --pin: var(--rc-blau); font-family: var(--rc-text-font); margin: 6px 0 2px; }
.khkb-leiste__bahn {
	position: relative;
	height: 10px;
	border-radius: 999px;
	background: repeating-linear-gradient(90deg, #ece7de 0 calc(8.333% - 2px), #f9f7f3 calc(8.333% - 2px) 8.333%);
	margin: 26px 8px 0;
}
.khkb-leiste__fill {
	position: absolute;
	inset: 0 auto 0 0;
	border-radius: 999px;
	background: linear-gradient(90deg, #8fb6cc, var(--rc-blau));
}
.khkb-leiste__pin {
	position: absolute;
	top: 50%;
	width: 18px;
	height: 18px;
	margin: -9px 0 0 -9px;
	border-radius: 50%;
	background: var(--rc-weiss);
	border: 4px solid var(--rc-blau);
	box-sizing: border-box;
}
.khkb-leiste__pin--frist { border-color: var(--rc-bernstein); width: 22px; height: 22px; margin: -11px 0 0 -11px; border-width: 5px; }
.khkb-leiste__pin--ende { border-color: var(--rc-navy); border-radius: 4px; }
.khkb-leiste.ist-gekuendigt .khkb-leiste__pin--ende { border-color: var(--rc-rot); }
.khkb-leiste.ist-akut .khkb-leiste__pin--frist { border-color: var(--rc-rot); box-shadow: 0 0 0 5px rgba(194, 65, 45, .18); }
.khkb-leiste__heute { position: absolute; top: -24px; bottom: -6px; width: 0; border-left: 2px solid var(--rc-navy); }
.khkb-leiste__heute em {
	position: absolute;
	top: -2px;
	left: 0;
	transform: translateX(-50%);
	font-style: normal;
	font-size: 11px;
	font-weight: 600;
	line-height: 1;
	color: var(--rc-weiss);
	background: var(--rc-navy);
	padding: 3px 7px;
	border-radius: 999px;
	white-space: nowrap;
}
.khkb-leiste__enden { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--rc-leise); margin: 7px 0 0; }
.khkb-leiste__legende { display: flex; flex-wrap: wrap; gap: 8px 26px; margin: 12px 0 0; padding: 0; }
.khkb-leiste__legende > div { display: flex; align-items: center; gap: 9px; margin: 0; }
.khkb-leiste__legende > div::before { content: ''; width: 11px; height: 11px; border-radius: 50%; border: 3px solid var(--rc-blau); flex: none; box-sizing: border-box; }
.khkb-leiste__legende .ist-frist::before { border-color: var(--rc-bernstein); }
.khkb-leiste__legende .ist-ende::before { border-color: var(--rc-navy); border-radius: 3px; }
.khkb-leiste.ist-gekuendigt .ist-ende::before { border-color: var(--rc-rot); }
.khkb-leiste__legende dt { font-size: 12px; color: var(--rc-leise); margin: 0; font-weight: 400; }
.khkb-leiste__legende dd { margin: 0; font-weight: 600; font-size: 14px; color: var(--rc-text); }
.khkb-leiste__legende small { font-weight: 500; font-size: 12px; color: var(--rc-leise); margin-left: 4px; }
.khkb-leiste.ist-bald .ist-frist dd small { color: #9a5b00; }
.khkb-leiste.ist-akut .ist-frist dd, .khkb-leiste.ist-akut .ist-frist small { color: var(--rc-rot); }

/* ---------- Unterschriftenfeld (Backend + Kundenbereich) ---------- */
.khkb-sigpad { position: relative; border: 2px dashed #c3d2de; border-radius: 12px; background: #fff; overflow: hidden; touch-action: none; }
.khkb-sigpad canvas { display: block; width: 100%; cursor: crosshair; touch-action: none; }
.khkb-sigpad::after { content: ""; position: absolute; left: 24px; right: 24px; bottom: 38px; border-bottom: 1px solid var(--rc-linie); pointer-events: none; }
.khkb-sigpad__hint { position: absolute; inset: 0; display: grid; place-items: center; color: var(--rc-leise); pointer-events: none; font-size: 14px; padding: 0 16px; text-align: center; font-family: var(--rc-text-font); }
.khkb-sigpad__clear { position: absolute; top: 8px; right: 8px; border: 1px solid var(--rc-linie); background: #fff; border-radius: 8px; padding: 4px 10px; font: inherit; font-size: 13px; color: var(--rc-leise); cursor: pointer; }
.khkb-sigpad__clear:hover { color: var(--rc-navy); border-color: #b3ac9f; }
.khkb-sigpad.is-signed { border-style: solid; border-color: var(--rc-blau); }
.khkb-sigpad.is-invalid { border-color: var(--rc-rot); }
.khkb-sigpad__hint[hidden], [data-khkb-sigerror][hidden] { display: none; }
.khkb-field-error, .khkb-feldfehler { display: block; color: var(--rc-rot); font-size: 13px; margin: 6px 0 0; }

/* Tabellen im Vertragstext (Zeilen „| … | … |“ in der Vorlage) */
.khkb-ctable { overflow-x: auto; margin: 4px 0 18px; -webkit-overflow-scrolling: touch; }
.khkb-ctable table { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 1.45; }
.khkb-ctable th, .khkb-ctable td { text-align: left; vertical-align: top; padding: 8px 10px; border-bottom: 1px solid var(--rc-linie, #e4ded3); }
.khkb-ctable th { background: var(--rc-flaeche, #f6f4f0); font-weight: 600; white-space: nowrap; }
.khkb-ctable tr:last-child td { border-bottom: 0; }

/* ---------- Nachrichten (Chat) – Backend und Kundenbereich ---------- */
.khkb-chat__verlauf { display: flex; flex-direction: column; gap: 8px; max-height: min(62vh, 640px); overflow-y: auto; padding: 4px 2px 12px; margin: 0 0 14px; overscroll-behavior: contain; }
.khkb-chat__leer { color: var(--rc-leise); text-align: center; padding: 26px 10px; margin: 0; }
.khkb-chat__tag { text-align: center; margin: 8px 0 2px; }
.khkb-chat__tag span { display: inline-block; font-size: 12px; color: var(--rc-leise); background: var(--rc-flaeche); border-radius: 999px; padding: 3px 12px; }
.khkb-chat__msg { display: flex; }
.khkb-chat__msg.ist-mein { justify-content: flex-end; }
.khkb-chat__blase { max-width: min(78%, 560px); background: var(--rc-flaeche); border: 1px solid var(--rc-linie); border-radius: 16px 16px 16px 4px; padding: 9px 13px 7px; font-size: 14.5px; line-height: 1.5; color: var(--rc-text); overflow-wrap: anywhere; }
.khkb-chat__msg.ist-mein .khkb-chat__blase { background: var(--rc-blau-hell); border-color: transparent; border-radius: 16px 16px 4px 16px; }
.khkb-chat__wer { font-size: 12px; font-weight: 600; color: var(--rc-leise); margin-bottom: 2px; }
.khkb-chat__text a { color: var(--rc-blau); }
.khkb-chat__bild { display: block; margin: 6px 0 4px; }
.khkb-chat__bild img { display: block; max-width: 100%; max-height: 260px; border-radius: 10px; object-fit: cover; }
.khkb-chat__datei { display: inline-flex; gap: 6px; align-items: center; margin-top: 6px; font-size: 13.5px; color: var(--rc-blau); text-decoration: none; font-weight: 500; }
.khkb-chat__datei small { color: var(--rc-leise); font-weight: 400; }
.khkb-chat__zeit { font-size: 11.5px; color: var(--rc-leise); text-align: right; margin-top: 3px; }
.khkb-chat__blase form { display: inline; }
.khkb-chat__blase form button { font-size: 11.5px; padding: 0; margin-top: 2px; }
.khkb-chat__form textarea { width: 100%; min-height: 84px; border: 1px solid var(--rc-linie); border-radius: 12px; padding: 11px 13px; font: inherit; font-size: 15px; resize: vertical; box-sizing: border-box; }
.khkb-chat__leiste { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; }
.khkb-chat__anhang { position: relative; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: 14px; color: var(--rc-blau); font-weight: 500; max-width: 100%; }
.khkb-chat__anhang input[type=file] { font-size: 13px; max-width: 220px; color: var(--rc-leise); }
.khkb-chat__ohne { font-size: 13px; color: var(--rc-leise); }
.khkb-chat__leiste .khkb-knopf, .khkb-chat__leiste .khkb-btn { margin-left: auto; min-width: 120px; }
.khkb-nachr-liste tr.ist-neu .row-title { font-weight: 700; }
@media (max-width: 600px) {
	.khkb-chat__blase { max-width: 88%; }
	.khkb-chat__verlauf { max-height: 60vh; }
	.khkb-chat__leiste .khkb-knopf, .khkb-chat__leiste .khkb-btn { width: 100%; margin-left: 0; }
	.khkb-chat__anhang input[type=file] { max-width: 100%; }
}
.khkb-nachr-hinweis__knopf { margin: 12px 0 0; }
