/* LT Spesen-Abrechnungsbeleg
 * Alle Regeln sind unter .ltsb gekapselt und gegen Theme-Styles abgesichert
 * (Themes setzen oft grosse Innenabstände, Rundungen und Höhen auf Eingabefelder).
 */
.ltsb {
	--ltsb-red: #c90c0f;
	--ltsb-ink: #1d1d1f;
	--ltsb-muted: #6b6b70;
	--ltsb-line: #d6d6da;
	--ltsb-bg: #ffffff;
	--ltsb-soft: #f4f4f5;
	color: var(--ltsb-ink);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-size: 15px;
	line-height: 1.4;
	text-align: left;
}
.ltsb, .ltsb *, .ltsb *::before, .ltsb *::after { box-sizing: border-box; }

/* Volle Breite: aus dem schmalen Inhaltsbereich des Themes ausbrechen.
 * Breite und linker Versatz werden per JS exakt auf das Browserfenster gesetzt. */
.ltsb.ltsb-full {
	position: relative;
	max-width: none;
	padding: 0 24px;
}
.ltsb.ltsb-full .ltsb-form { max-width: 1600px; margin: 0 auto; }
.ltsb.ltsb-normal { max-width: 100%; }

.ltsb .ltsb-form {
	background: var(--ltsb-bg);
	border: 1px solid var(--ltsb-line);
	border-radius: 10px;
	padding: 28px 32px 24px;
	margin: 0;
}

/* Sprachschalter – nur am Bildschirm, nie im Ausdruck */
.ltsb .ltsb-lang {
	display: flex;
	justify-content: flex-end;
	gap: 0;
	margin: -8px 0 14px;
}
.ltsb .ltsb-form .ltsb-lang-btn {
	font: inherit !important;
	font-size: 12px !important;
	font-weight: 600 !important;
	line-height: 1 !important;
	letter-spacing: .04em !important;
	min-width: 40px;
	height: 28px !important;
	min-height: 0 !important;
	padding: 0 10px !important;
	margin: 0 0 0 -1px !important;
	border: 1px solid var(--ltsb-line) !important;
	border-radius: 0 !important;
	background: #fff !important;
	color: var(--ltsb-muted) !important;
	box-shadow: none !important;
	text-transform: none !important;
	cursor: pointer;
	width: auto !important;
}
.ltsb .ltsb-form .ltsb-lang-btn:first-child { border-radius: 4px 0 0 4px !important; margin-left: 0 !important; }
.ltsb .ltsb-form .ltsb-lang-btn:last-child { border-radius: 0 4px 4px 0 !important; }
.ltsb .ltsb-form .ltsb-lang-btn:hover { background: var(--ltsb-soft) !important; color: var(--ltsb-ink) !important; }
.ltsb .ltsb-form .ltsb-lang-btn.is-active {
	background: var(--ltsb-ink) !important;
	border-color: var(--ltsb-ink) !important;
	color: #fff !important;
	position: relative;
	z-index: 1;
}

.ltsb .ltsb-head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 20px;
	margin: 0 0 22px;
}
.ltsb .ltsb-title {
	font-family: inherit;
	font-size: 28px;
	font-weight: 700;
	margin: 6px 0 0;
	padding: 0;
	line-height: 1.15;
	color: var(--ltsb-ink);
	letter-spacing: -0.01em;
	text-transform: none;
}
.ltsb .ltsb-logo { height: 52px; width: auto; max-width: 240px; object-fit: contain; margin: 0; }

.ltsb .ltsb-meta {
	display: grid;
	grid-template-columns: repeat(6, minmax(0, 1fr));
	gap: 14px 20px;
	margin: 0 0 22px;
	max-width: 1100px;
}
.ltsb .ltsb-meta .m-name,
.ltsb .ltsb-meta .m-vorname,
.ltsb .ltsb-meta .m-periode { grid-column: span 2; }
.ltsb .ltsb-meta .m-adresse { grid-column: span 3; }
.ltsb .ltsb-meta .m-plz { grid-column: span 1; }
.ltsb .ltsb-meta .m-ort { grid-column: span 2; }
.ltsb .ltsb-meta .m-sup { grid-column: span 3; }
.ltsb .ltsb-req { color: var(--ltsb-red); font-weight: 700; }
.ltsb .ltsb-req-hint { grid-column: 1 / -1; margin: -4px 0 0; color: var(--ltsb-red); font-size: 13px; font-weight: 600; min-height: 0; }
.ltsb .ltsb-req-hint:empty { display: none; }
.ltsb .ltsb-form input.is-missing { border-color: var(--ltsb-red) !important; background-color: #fff6f6 !important; }
.ltsb .ltsb-actions.is-incomplete .ltsb-btn-primary,
.ltsb .ltsb-actions.is-incomplete .ltsb-btn:not(.ltsb-btn-ghost) { opacity: .45; }
.ltsb .ltsb-actions-hint { width: 100%; margin: 0; font-size: 13px; color: var(--ltsb-muted); }
.ltsb .ltsb-actions:not(.is-incomplete) .ltsb-actions-hint { display: none; }
.ltsb .ltsb-field { display: flex; flex-direction: column; gap: 4px; margin: 0; padding: 0; font-weight: 400; }
.ltsb .ltsb-field > span { font-size: 13px; font-weight: 600; color: var(--ltsb-muted); line-height: 1.3; }
.ltsb .ltsb-field em { font-style: normal; font-weight: 400; }

/* Eingabefelder – gegen Theme-Vorgaben abgesichert */
.ltsb .ltsb-form input,
.ltsb .ltsb-form select {
	font-family: inherit !important;
	font-size: 15px !important;
	line-height: 1.3 !important;
	color: var(--ltsb-ink) !important;
	width: 100% !important;
	max-width: none !important;
	min-width: 0 !important;
	height: 40px !important;
	min-height: 0 !important;
	padding: 0 10px !important;
	margin: 0 !important;
	border: 1px solid var(--ltsb-line) !important;
	border-radius: 4px !important;
	background-color: #fff !important;
	box-shadow: none !important;
	outline: none;
	letter-spacing: normal !important;
	text-transform: none !important;
	transition: border-color .15s, box-shadow .15s;
}
.ltsb .ltsb-form select {
	-webkit-appearance: none !important;
	-moz-appearance: none !important;
	appearance: none !important;
	padding-right: 24px !important;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%236b6b70' stroke-width='1.5'/%3E%3C/svg%3E") !important;
	background-repeat: no-repeat !important;
	background-position: right 8px center !important;
	background-size: 10px 6px !important;
	cursor: pointer;
}
.ltsb .ltsb-form input[type="date"] { padding-right: 6px !important; }
.ltsb .ltsb-form input[type="date"]::-webkit-calendar-picker-indicator { margin-left: 2px; padding: 0; cursor: pointer; }
.ltsb .ltsb-form input:focus,
.ltsb .ltsb-form select:focus {
	border-color: var(--ltsb-red) !important;
	box-shadow: 0 0 0 3px rgba(201, 12, 15, .15) !important;
}
.ltsb .ltsb-form input:disabled { background-color: var(--ltsb-soft) !important; color: var(--ltsb-muted) !important; cursor: not-allowed; }
.ltsb .ltsb-form input.is-invalid { border-color: var(--ltsb-red) !important; }
.ltsb .ltsb-form input::placeholder { color: #a0a0a6; opacity: 1; }

/* Tabelle */
.ltsb .ltsb-table-wrap { overflow-x: auto; margin: 0; padding: 0; }
.ltsb .ltsb-table {
	width: 100%;
	border-collapse: collapse;
	border-spacing: 0;
	table-layout: fixed;
	min-width: 1080px;
	margin: 0;
	border: 0;
	background: transparent;
	font-size: 15px;
}
.ltsb .ltsb-table th,
.ltsb .ltsb-table td {
	border: 1px solid var(--ltsb-line);
	padding: 4px;
	vertical-align: middle;
	background: transparent;
	text-align: left;
	line-height: 1.3;
}
.ltsb .ltsb-table thead th {
	background: var(--ltsb-soft);
	font-size: 12px;
	font-weight: 700;
	text-align: center;
	line-height: 1.25;
	padding: 8px 4px;
	color: var(--ltsb-ink);
	text-transform: none;
	letter-spacing: 0;
}
/* In der Tabelle wirken die Felder wie Zellen einer Tabelle */
.ltsb .ltsb-table td input,
.ltsb .ltsb-table td select {
	height: 36px !important;
	padding: 0 8px !important;
	border-color: transparent !important;
	border-radius: 3px !important;
	background-color: transparent !important;
}
.ltsb .ltsb-table td select { padding-right: 22px !important; background-color: transparent !important; }
.ltsb .ltsb-table td input:hover,
.ltsb .ltsb-table td select:hover { border-color: var(--ltsb-line) !important; }
.ltsb .ltsb-table td input:focus,
.ltsb .ltsb-table td select:focus { border-color: var(--ltsb-red) !important; background-color: #fff !important; }
.ltsb .ltsb-table td input:disabled { background-color: transparent !important; }
.ltsb .ltsb-table td input:disabled:hover { border-color: transparent !important; }

/* Spaltenbreiten (Betreff nimmt den Rest) */
.ltsb .ltsb-table .c-nr { width: 62px; text-align: center; color: var(--ltsb-muted); }
.ltsb .ltsb-table .c-km { width: 80px; }
.ltsb .ltsb-table .c-datum { width: 150px; }
.ltsb .ltsb-table .c-betreff { width: auto; }
.ltsb .ltsb-table .c-kst { width: 80px; }
.ltsb .ltsb-table .c-konto { width: 90px; }
.ltsb .ltsb-table .c-whrg { width: 88px; }
.ltsb .ltsb-table .c-betrag { width: 130px; }
.ltsb .ltsb-table .c-kurs { width: 96px; }
.ltsb .ltsb-table .c-chf { width: 130px; }

.ltsb .ltsb-table .f-km,
.ltsb .ltsb-table .f-betrag,
.ltsb .ltsb-table .f-kurs { text-align: right !important; }
.ltsb .ltsb-table .f-kst,
.ltsb .ltsb-table .f-konto { text-align: center !important; }
.ltsb .ltsb-table td.c-chf,
.ltsb .ltsb-table tfoot .c-km,
.ltsb .ltsb-table tfoot .c-kurs { text-align: right; }
.ltsb .ltsb-table td.c-chf { font-variant-numeric: tabular-nums; padding-right: 12px; }
.ltsb .ltsb-table .needs-kurs .f-kurs { border-color: var(--ltsb-red) !important; }

.ltsb .ltsb-table tfoot td { padding: 10px 8px; font-variant-numeric: tabular-nums; }
.ltsb .ltsb-table tfoot .c-kurs,
.ltsb .ltsb-table tfoot .c-chf { padding-right: 12px; }
.ltsb .ltsb-table .ltsb-km .c-nr { border: 0; }
.ltsb .ltsb-table .ltsb-km .c-label { color: var(--ltsb-muted); }
.ltsb .ltsb-table .ltsb-total td { border: 0; }
.ltsb .ltsb-table .ltsb-total .c-kurs,
.ltsb .ltsb-table .ltsb-total .c-chf { font-weight: 700; font-size: 18px; }
.ltsb .ltsb-table .ltsb-total .c-kurs { text-align: left; border-top: 1px solid var(--ltsb-line); }
.ltsb .ltsb-table .ltsb-total .c-chf { border: 2px solid var(--ltsb-ink); }

/* „+ Zeile hinzufügen“ */
.ltsb .ltsb-add { display: flex; align-items: center; gap: 14px; margin: 10px 0 0; }
.ltsb .ltsb-form .ltsb-add-row {
	font: inherit !important;
	font-size: 14px !important;
	font-weight: 600 !important;
	line-height: 1.2 !important;
	height: auto !important;
	min-height: 34px;
	padding: 6px 14px !important;
	margin: 0 !important;
	border: 1px dashed #b9b9bf !important;
	border-radius: 6px !important;
	background: #fff !important;
	color: var(--ltsb-ink) !important;
	box-shadow: none !important;
	text-transform: none !important;
	letter-spacing: 0 !important;
	cursor: pointer;
	width: auto !important;
}
.ltsb .ltsb-form .ltsb-add-row:hover { border-style: solid !important; border-color: var(--ltsb-ink) !important; background: var(--ltsb-soft) !important; }
.ltsb .ltsb-add-hint { font-size: 13px; color: var(--ltsb-red); }

/* Unterschriften */
.ltsb .ltsb-signs {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 16px;
	margin: 28px 0 0;
	max-width: 820px;
}
.ltsb .ltsb-sign {
	border: 1px solid var(--ltsb-line);
	border-radius: 8px;
	padding: 14px 16px 16px;
	display: flex;
	flex-direction: column;
	gap: 12px;
	min-width: 0;
}
.ltsb .ltsb-sign-title {
	font-family: inherit;
	font-size: 15px;
	font-weight: 700;
	margin: 0;
	padding: 0;
	color: var(--ltsb-ink);
	line-height: 1.3;
	text-transform: none;
	letter-spacing: 0;
}
.ltsb .ltsb-sign-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.ltsb .ltsb-sigpad { display: flex; flex-direction: column; gap: 4px; position: relative; }
.ltsb .ltsb-sig-label { font-size: 13px; font-weight: 600; color: var(--ltsb-muted); line-height: 1.3; }
.ltsb .ltsb-sig-area {
	position: relative;
	height: 130px;
	border: 1px dashed #b9b9bf;
	border-radius: 4px;
	background:
		linear-gradient(to right, #c8c8cd, #c8c8cd) no-repeat 12px calc(100% - 32px) / calc(100% - 24px) 1px,
		#fcfcfd;
	overflow: hidden;
}
.ltsb .ltsb-sig-area canvas {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	display: block;
	touch-action: none;
	cursor: crosshair;
	z-index: 1;
}
.ltsb .ltsb-sig-hint {
	position: absolute;
	left: 12px;
	right: 12px;
	bottom: 10px;
	font-size: 12px;
	color: #9a9aa0;
	pointer-events: none;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.ltsb .has-ink .ltsb-sig-hint { visibility: hidden; }
.ltsb .ltsb-sigpad:focus-within .ltsb-sig-area,
.ltsb .ltsb-sigpad.has-ink .ltsb-sig-area { border-style: solid; }
.ltsb .ltsb-form .ltsb-sig-clear {
	position: absolute;
	top: 0;
	right: 0;
	font: inherit !important;
	font-size: 12px !important;
	color: var(--ltsb-muted) !important;
	background: none !important;
	border: 0 !important;
	padding: 0 !important;
	margin: 0 !important;
	height: auto !important;
	min-height: 0 !important;
	width: auto !important;
	box-shadow: none !important;
	text-decoration: underline;
	text-transform: none !important;
	letter-spacing: 0 !important;
	cursor: pointer;
	visibility: hidden;
}
.ltsb .has-ink .ltsb-sig-clear { visibility: visible; }
.ltsb .ltsb-form .ltsb-sig-clear:hover { color: var(--ltsb-red) !important; }

/* Klarname unter der Unterschrift */
.ltsb .ltsb-klar {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: -6px 0 0;
	font-size: 12px;
	color: var(--ltsb-muted);
}
.ltsb .ltsb-klar > span { flex: 0 0 auto; font-weight: 600; }
.ltsb .ltsb-klar output { color: var(--ltsb-ink); }
.ltsb .ltsb-klar output.is-empty { color: #a0a0a6; font-style: italic; }
.ltsb .ltsb-form .ltsb-klar input {
	height: 30px !important;
	font-size: 13px !important;
	padding: 0 8px !important;
}

/* Bank */
.ltsb .ltsb-bank {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	gap: 14px 20px;
	border: 0;
	padding: 0;
	margin: 4px 0 26px;
	max-width: 820px;
	min-width: 0;
}
.ltsb .ltsb-bank legend { font-weight: 700; font-size: 15px; margin: 0 0 10px; padding: 0; border: 0; color: var(--ltsb-ink); }
.ltsb .ltsb-iban-hint { color: var(--ltsb-red); font-size: 12px; min-height: 1em; }

.ltsb .ltsb-note { color: var(--ltsb-muted); font-size: 13px; margin: 18px 0 0; }

.ltsb .ltsb-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 20px 0 0; }
.ltsb .ltsb-btn {
	font-family: inherit !important;
	font-size: 15px !important;
	font-weight: 600 !important;
	height: auto !important;
	min-height: 42px;
	padding: 9px 18px !important;
	border-radius: 6px !important;
	border: 1px solid var(--ltsb-ink) !important;
	background: #fff !important;
	color: var(--ltsb-ink) !important;
	cursor: pointer;
	line-height: 1.2 !important;
	text-transform: none !important;
	letter-spacing: 0 !important;
	box-shadow: none !important;
	width: auto;
	margin: 0;
}
.ltsb .ltsb-btn:hover { background: var(--ltsb-soft) !important; }
.ltsb .ltsb-btn-primary { background: var(--ltsb-red) !important; border-color: var(--ltsb-red) !important; color: #fff !important; }
.ltsb .ltsb-btn-primary:hover { background: #a90a0d !important; border-color: #a90a0d !important; }
.ltsb .ltsb-btn-ghost { border-color: transparent !important; color: var(--ltsb-muted) !important; margin-left: auto; }

.ltsb .ltsb-cleared {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 8px 16px;
	margin: 18px 0 0;
	padding: 12px 16px;
	border-radius: 6px;
	background: #eef6ee;
	border: 1px solid #b9d9b9;
	color: #1f4d1f;
	font-size: 14px;
}
.ltsb .ltsb-cleared[hidden] { display: none; }
.ltsb .ltsb-form .ltsb-undo {
	font: inherit !important;
	font-size: 14px !important;
	font-weight: 600 !important;
	color: #1f4d1f !important;
	background: none !important;
	border: 0 !important;
	padding: 0 !important;
	margin: 0 !important;
	height: auto !important;
	min-height: 0 !important;
	width: auto !important;
	box-shadow: none !important;
	text-decoration: underline;
	text-transform: none !important;
	cursor: pointer;
}
.ltsb .ltsb-form .ltsb-undo[hidden] { display: none; }

.ltsb .ltsb-foot {
	max-width: 1600px;
	margin: 14px auto 0;
	text-align: center;
	font-size: 13px;
	color: var(--ltsb-muted);
}
.ltsb .ltsb-foot a { color: var(--ltsb-muted); text-decoration: underline; text-underline-offset: 2px; }
.ltsb .ltsb-foot a:hover { color: var(--ltsb-red); }

.ltsb-notice { padding: 14px 16px; border-left: 4px solid #c90c0f; background: #f7f7f8; }

/* Vollbild-Modus (Subdomain) */
body.ltsb-fullpage { margin: 0; background: #f2f2f4; }
.ltsb-page { padding: 32px 0 24px; }
.ltsb-footer { max-width: 1600px; margin: 14px auto 0; font: 13px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; color: #6b6b70; text-align: center; }
.ltsb-footer a { color: inherit; }

@media (max-width: 1100px) and (min-width: 861px) {
	.ltsb .ltsb-signs { grid-template-columns: minmax(0, 1fr); }
}

/* Mobile: Zeilen als Karten */
@media (max-width: 860px) {
	.ltsb.ltsb-full { padding: 0 12px; }
	.ltsb .ltsb-form { padding: 18px 16px; }
	.ltsb .ltsb-title { font-size: 22px; }
	.ltsb .ltsb-logo { height: 36px; }
	.ltsb .ltsb-bank, .ltsb .ltsb-signs { grid-template-columns: minmax(0, 1fr); }
	.ltsb .ltsb-meta { grid-template-columns: 110px minmax(0, 1fr); gap: 12px; }
	.ltsb .ltsb-meta .ltsb-field { grid-column: 1 / -1; }
	.ltsb .ltsb-meta .m-plz { grid-column: 1; }
	.ltsb .ltsb-meta .m-ort { grid-column: 2; }
	.ltsb .ltsb-table-wrap { overflow: visible; }
	.ltsb .ltsb-table { min-width: 0; table-layout: auto; }
	.ltsb .ltsb-table thead { display: none; }
	.ltsb .ltsb-table, .ltsb .ltsb-table tbody, .ltsb .ltsb-table tfoot, .ltsb .ltsb-table tr { display: block; width: 100%; }
	.ltsb .ltsb-table tbody tr {
		display: grid;
		grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
		gap: 8px 12px;
		border: 1px solid var(--ltsb-line);
		border-radius: 8px;
		padding: 12px;
		margin-bottom: 12px;
	}
	.ltsb .ltsb-table tbody td { display: flex; flex-direction: column; gap: 2px; border: 0; padding: 0; width: auto !important; }
	.ltsb .ltsb-table tbody td::before { content: attr(data-label); font-size: 12px; font-weight: 600; color: var(--ltsb-muted); }
	.ltsb .ltsb-table tbody td.c-nr { grid-column: 1 / -1; text-align: left; font-weight: 700; color: var(--ltsb-ink); flex-direction: row; gap: 6px; }
	.ltsb .ltsb-table tbody td.c-nr::before { font-size: inherit; color: var(--ltsb-muted); }
	.ltsb .ltsb-table tbody td.c-betreff { grid-column: 1 / -1; }
	.ltsb .ltsb-table tbody td.c-chf { text-align: left; padding: 0; font-weight: 700; justify-content: flex-end; }
	.ltsb .ltsb-table td input, .ltsb .ltsb-table td select { height: 40px !important; border-color: var(--ltsb-line) !important; background-color: #fff !important; }
	.ltsb .ltsb-table td input:disabled { background-color: var(--ltsb-soft) !important; }
	.ltsb .ltsb-table tfoot tr { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; border-top: 1px solid var(--ltsb-line); padding: 8px 0; }
	.ltsb .ltsb-table tfoot td { display: block; width: auto !important; border: 0 !important; padding: 2px 0 !important; white-space: nowrap; text-align: left !important; }
	.ltsb .ltsb-table tfoot td:empty, .ltsb .ltsb-table tfoot .c-nr, .ltsb .ltsb-table .ltsb-km .c-label, .ltsb .ltsb-table .ltsb-total .c-kurs { display: none; }
	.ltsb .ltsb-table tfoot td[data-label]::before { content: attr(data-label) ": "; color: var(--ltsb-muted); font-weight: 400; font-size: 14px; }
	.ltsb .ltsb-table .ltsb-total { justify-content: flex-end; }
	.ltsb .ltsb-table .ltsb-total .c-chf { border: 0 !important; font-size: 20px; }
	.ltsb .ltsb-lang { margin-top: 0; }
	.ltsb .ltsb-add { margin-top: 0; }
	.ltsb .ltsb-form .ltsb-add-row { width: 100% !important; min-height: 42px; }
	.ltsb .ltsb-btn { flex: 1 1 auto; }
	.ltsb .ltsb-btn-ghost { margin-left: 0; }
}

@media print {
	.ltsb .ltsb-lang, .ltsb .ltsb-add, .ltsb .ltsb-actions, .ltsb .ltsb-cleared, .ltsb .ltsb-sig-clear, .ltsb .ltsb-foot { display: none !important; }
	.ltsb.ltsb-full { width: auto !important; margin-left: 0 !important; padding: 0; }
}
