/*
 * Laktose-Rechner – kompakt, schlicht, kontrastreich, barrierefrei.
 * Erbt Schrift und Textfarbe vom Theme. Akzentfarbe: --lr-accent (Plugin-Einstellungen).
 * Einspaltig auf allen Bildschirmgrößen (Angaben, Mahlzeit, Ergebnis untereinander).
 */
.lr-wrap {
	--lr-accent: #0b6b3a;
	--lr-on-accent: #ffffff;
	--lr-focus: #1b4dff;
	--lr-line: rgba(0, 0, 0, 0.28);
	--lr-soft: rgba(0, 0, 0, 0.04);
	--lr-ok: #0b6b3a;
	--lr-warn: #8a4b00;
	--lr-bad: #a40e26;
	--lr-radius: 4px;
	max-width: 44rem;
	margin: 0 auto;
	font: inherit;
	font-size: .95em;
	color: inherit;
	line-height: 1.45;
	box-sizing: border-box;
}
.lr-wrap *, .lr-wrap *::before, .lr-wrap *::after { box-sizing: border-box; }
.lr-wrap [hidden] { display: none !important; }

.lr-sr {
	position: absolute !important;
	width: 1px; height: 1px;
	margin: -1px; padding: 0; border: 0;
	overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

.lr-head { margin: 0 0 .5rem; display: flex; flex-wrap: wrap; align-items: baseline; gap: .1rem .75rem; }
.lr-title { margin: 0; font-size: 1.3em; line-height: 1.2; }
.lr-lead { margin: 0; font-size: .85em; opacity: .9; }
.lr-meta { display: block; font-size: .85em; opacity: .85; }
.lr-error { display: block; color: var(--lr-bad); font-size: .85em; margin-top: .15rem; font-weight: 600; }

/* Layout */
.lr-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: .5rem; align-items: start; }
.lr-col { display: flex; flex-direction: column; gap: .5rem; min-width: 0; }

/* Karten */
.lr-card {
	border: 1px solid var(--lr-line);
	border-left: 5px solid var(--lr-accent);
	border-radius: var(--lr-radius);
	padding: .6rem .8rem;
	margin: 0;
}
.lr-card > h3 { margin: 0 0 .4rem; font-size: 1em; line-height: 1.2; }

/* Formulare */
.lr-grid { display: grid; gap: .6rem .75rem; }
.lr-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.lr-grid-age { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.lr-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.lr-field { margin: 0 0 .5rem; display: flex; flex-direction: column; gap: .2rem; min-width: 0; }
.lr-grid > .lr-field { margin: 0; }
.lr-field > label { font-weight: 600; font-size: .9em; }

.lr-wrap input[type="text"],
.lr-wrap input[type="number"],
.lr-wrap select {
	width: 100%;
	min-height: 2.5rem;
	padding: .3rem .6rem;
	font: inherit;
	color: inherit;
	background: transparent;
	border: 2px solid var(--lr-line);
	border-radius: var(--lr-radius);
}
.lr-wrap input[aria-invalid="true"] { border-color: var(--lr-bad); }

.lr-wrap :focus-visible { outline: 3px solid var(--lr-focus); outline-offset: 2px; }

.lr-fieldset { border: 0; padding: 0; margin: .25rem 0 .5rem; min-width: 0; }
.lr-fieldset legend { font-weight: 600; font-size: .9em; padding: 0; margin-bottom: .3rem; }

/* Segment-Auswahl Verträglichkeit */
.lr-seg { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .4rem; }
.lr-segopt { position: relative; }
.lr-segopt input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; z-index: 1; }
.lr-segopt label {
	display: flex; flex-direction: column; align-items: center; justify-content: center;
	min-height: 2.3rem; padding: .15rem .3rem;
	text-align: center; line-height: 1.15;
	border: 2px solid var(--lr-line); border-radius: var(--lr-radius);
}
.lr-segopt label strong { font-size: .85em; }
.lr-segopt label span { font-size: .78em; opacity: .85; }
.lr-segopt input:checked + label { background: var(--lr-accent); border-color: var(--lr-accent); color: var(--lr-on-accent); }
.lr-segopt input:checked + label strong::before { content: "✔ "; }
.lr-segopt input:checked + label span { opacity: 1; }
.lr-segopt input:focus-visible + label { outline: 3px solid var(--lr-focus); outline-offset: 2px; }
.lr-toldesc { margin-top: .3rem; min-height: 1.3em; }

/* Checkboxen */
.lr-checks { display: flex; flex-wrap: wrap; gap: .25rem 1rem; margin: 0; }
.lr-check { display: flex; gap: .45rem; align-items: center; margin: 0; min-height: 1.9rem; }
.lr-check input { flex: 0 0 auto; width: 1.2rem; height: 1.2rem; margin: 0; accent-color: var(--lr-accent); }
.lr-check label { cursor: pointer; font-size: .9em; }

/* Buttons */
.lr-btn {
	min-height: 2.5rem;
	padding: .3rem .9rem;
	font: inherit;
	font-weight: 600;
	color: var(--lr-on-accent);
	background: var(--lr-accent);
	border: 2px solid var(--lr-accent);
	border-radius: var(--lr-radius);
	cursor: pointer;
}
.lr-btn:hover { filter: brightness(1.1); }
.lr-btn-sec { color: inherit; background: transparent; border-color: var(--lr-line); }
.lr-btn-sec:hover { border-color: currentColor; filter: none; }

/* Combobox */
.lr-combo { position: relative; display: flex; gap: .4rem; }
.lr-combo input { flex: 1 1 auto; min-width: 0; }
.lr-combo .lr-btn { flex: 0 0 auto; }
.lr-listbox {
	position: absolute; z-index: 20; top: 100%; left: 0; right: 0;
	margin: .2rem 0 0; padding: 0; list-style: none;
	max-height: 16rem; overflow: auto;
	background-color: #fff; color: #111;
	border: 2px solid var(--lr-line);
	border-radius: var(--lr-radius);
	box-shadow: 0 6px 18px rgba(0, 0, 0, .18);
}
.lr-opt { display: flex; justify-content: space-between; gap: .75rem; padding: .5rem .7rem; cursor: pointer; }
.lr-opt:hover { background: rgba(0, 0, 0, .06); }
.lr-opt[aria-selected="true"] { background: var(--lr-accent); color: var(--lr-on-accent); }
.lr-opt[aria-selected="true"] .lr-meta { opacity: 1; }
.lr-opt .lr-meta { white-space: nowrap; }

/* Mahlzeit */
.lr-items { list-style: none; margin: .25rem 0 0; padding: 0; }
.lr-item {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto auto auto;
	gap: .5rem .75rem;
	align-items: center;
	padding: .3rem 0;
	border-top: 1px solid var(--lr-line);
}
.lr-item-name strong { display: block; font-size: .95em; line-height: 1.2; }
.lr-item-amount { display: flex; align-items: center; gap: .3rem; }
.lr-item-amount input { width: 5.5rem !important; }
.lr-unit { font-size: .85em; opacity: .85; }
.lr-item-lac { font-weight: 600; white-space: nowrap; font-size: .9em; }
.lr-remove { min-width: 2.5rem; padding: .3rem .5rem; }

.lr-details { margin: .5rem 0 0; border-top: 1px solid var(--lr-line); padding-top: .25rem; }
.lr-details > summary { cursor: pointer; font-weight: 600; font-size: .9em; min-height: 2.25rem; display: flex; align-items: center; }

/* Ergebnis */
.lr-sum { display: flex; flex-wrap: wrap; align-items: center; gap: .15rem .75rem; }
.lr-sum > .lr-meta, .lr-sum > .lr-barwrap { flex: 1 1 100%; margin: 0; }
.lr-big { font-size: 1.25em; margin: 0; }
.lr-chip { display: inline-block; margin: 0; padding: .05rem .55rem; border: 2px solid currentColor; border-radius: 999px; font-weight: 600; font-size: .8em; }
.lr-barwrap { margin: .35rem 0 0; }
.lr-bar { position: relative; height: .75rem; border: 2px solid var(--lr-line); border-radius: 999px; overflow: hidden; background: var(--lr-soft); }
.lr-bar-fill { height: 100%; background: var(--lr-accent); transition: width .25s ease; }
.lr-bar-mark { position: absolute; top: -2px; bottom: -2px; width: 3px; background: #111; box-shadow: 0 0 0 1px #fff; }
.lr-bar-scale { display: flex; justify-content: space-between; font-size: .75em; opacity: .8; margin-top: .1rem; }

.lr-notice {
	margin: 0 0 .5rem;
	padding: .5rem .75rem;
	border: 2px solid var(--lr-line);
	border-radius: var(--lr-radius);
	background: var(--lr-soft);
	font-size: .85em;
}
.lr-notice > summary { cursor: pointer; font-weight: 700; min-height: 2rem; display: flex; align-items: center; }
.lr-notice p { margin: 0 0 .5rem; }
.lr-notice p:last-child { margin-bottom: .25rem; }
.lr-ack { margin: .4rem 0 .5rem; font-weight: 600; align-items: flex-start; flex-wrap: wrap; }
.lr-ack label { flex: 1 1 12rem; font-size: .85em; }
.lr-wrap .lr-ack .lr-linkbtn {
	flex: 0 0 auto;
	display: inline-block;
	width: auto; height: auto; min-height: 2rem;
	margin: 0; padding: .1rem .25rem;
	font: inherit; font-size: .85em; font-weight: 600; line-height: 1.3;
	letter-spacing: normal; text-transform: none; text-shadow: none;
	color: inherit !important;
	background: none !important;
	border: 0 !important; border-radius: 0; box-shadow: none !important;
	text-decoration: underline;
	-webkit-appearance: none; appearance: none;
	cursor: pointer;
}
.lr-ack input { margin-top: .15rem; }

.lr-box { margin: 0 0 .6rem; padding: .65rem .8rem; border: 2px solid var(--lr-line); border-left-width: 7px; border-radius: var(--lr-radius); font-size: .92em; }
.lr-box p { margin: 0 0 .35rem; }
.lr-box p:last-child { margin-bottom: 0; }
.lr-box .lr-big { font-size: 1.15em; }
.lr-box-title { font-weight: 700; font-size: 1.05em; }
.lr-ok { border-color: var(--lr-ok); }
.lr-warn { border-color: var(--lr-warn); }
.lr-bad { border-color: var(--lr-bad); }
.lr-info { border-color: var(--lr-line); }
.lr-ok .lr-box-title::before { content: "✔ "; }
.lr-warn .lr-box-title::before { content: "⚠ "; }
.lr-bad .lr-box-title::before { content: "✖ "; }
.lr-info .lr-box-title::before { content: "ℹ "; }
.lr-dose > .lr-meta { margin: 0 0 .3rem; }

/* Tabellen */
.lr-table-scroll { overflow-x: auto; margin: 0 0 1rem; }
.lr-table { width: 100%; border-collapse: collapse; font-size: .9em; }
.lr-table th, .lr-table td { padding: .35rem .5rem; border-bottom: 1px solid var(--lr-line); text-align: left; vertical-align: top; }
.lr-table thead th { border-bottom: 2px solid currentColor; }
.lr-table tfoot th, .lr-table tfoot td { border-top: 2px solid currentColor; font-weight: 700; }
.lr-table tbody th { font-weight: 600; }

/* SEO-Bereich */
.lr-seo { margin-top: 2rem; }
.lr-seo h2 { margin-top: 1.75rem; }
.lr-seo h3 { margin-top: 1.25rem; font-size: 1.1em; }
.lr-stand { font-size: .9em; opacity: .85; }
.lr-legal { padding: .85rem 1rem; border: 2px solid var(--lr-line); border-radius: var(--lr-radius); background: var(--lr-soft); font-size: .95em; }
.lr-legal p:last-child { margin-bottom: 0; }
.lr-noscript { padding: .85rem; border: 2px solid var(--lr-line); }

@media (max-width: 40rem) {
	.lr-grid-2, .lr-grid-4 { grid-template-columns: 1fr; }
	.lr-seg { grid-template-columns: 1fr 1fr; }
	.lr-item { grid-template-columns: minmax(0, 1fr) auto auto; }
	.lr-item-name { grid-column: 1 / -1; }
	.lr-item-lac { grid-column: 2 / 3; justify-self: end; }
	.lr-card { padding: .75rem; }
	.lr-opt { flex-direction: column; gap: 0; }
}

@media (prefers-reduced-motion: reduce) {
	.lr-bar-fill { transition: none; }
}

@media print {
	.lr-combo, .lr-remove, .lr-details > summary { display: none; }
}
