:root {
  color-scheme: light dark;
  --bg: #f5f7fa; --surface: #fff; --text: #1c2733; --muted: #66758a; --border: #e1e6ed;
  --accent: #2563eb; --chip: #eef2f7; --pflicht: #b45309; --pflicht-bg: #fef3c7; --frei: #15803d; --frei-bg: #dcfce7;
  --shadow: 0 1px 3px rgba(16, 24, 40, .08);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f141a; --surface: #182029; --text: #e6ebf1; --muted: #93a1b3; --border: #2a3542;
    --accent: #6ea0ff; --chip: #232e3a; --pflicht: #fbbf24; --pflicht-bg: #3a2c0c; --frei: #4ade80; --frei-bg: #123220;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 9rem; }
body { margin: 0; font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
.wrap { max-width: 900px; margin: 0 auto; padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left)); }

.top { position: sticky; top: 0; z-index: 10; background: var(--bg); border-bottom: 1px solid var(--border); padding: max(10px, env(safe-area-inset-top)) 0 10px; }
h1 { font-size: 1.25rem; margin: 0 0 10px; }
.search input {
  width: 100%; font: inherit; padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
.search input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.meta { margin: 8px 0 0; font-size: .8rem; color: var(--muted); }
.seg { display: flex; gap: 4px; margin-top: 8px; padding: 3px; background: var(--chip); border-radius: 10px; }
.seg button { flex: 1; font: inherit; font-size: .85rem; padding: 7px 6px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; }
.seg button[aria-checked="true"] { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow); }
.seg button:focus-visible { outline: 2px solid var(--accent); }

main { padding-bottom: 48px; }
.letter { margin: 24px 0 8px; font-size: .85rem; font-weight: 700; color: var(--accent); letter-spacing: .08em; }

.item { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; margin-bottom: 8px; box-shadow: var(--shadow); }
.item summary { list-style: none; cursor: pointer; padding: 14px; display: flex; gap: 10px; align-items: center; min-height: 52px; }
.item summary::-webkit-details-marker { display: none; }
.item summary::after { content: "›"; margin-left: auto; color: var(--muted); font-size: 1.4rem; transition: transform .15s; }
.item[open] summary::after { transform: rotate(90deg); }
.name { font-weight: 600; overflow-wrap: anywhere; hyphens: auto; }
.item summary > div { min-width: 0; }
.item summary .badge { flex-shrink: 0; }
.item summary::after { flex-shrink: 0; line-height: 1; }
.group { font-size: .8rem; color: var(--muted); }
.body { padding: 0 14px 14px; border-top: 1px dashed var(--border); }
.body h3 { margin: 12px 0 6px; font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: var(--chip); border-radius: 999px; padding: 3px 10px; font-size: .82rem; }
.code { font-family: ui-monospace, Menlo, Consolas, monospace; border-radius: 6px; }
.badge { font-size: .7rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.badge.ueberweisung { background: var(--pflicht-bg); color: var(--pflicht); }
.badge.direkt { background: var(--frei-bg); color: var(--frei); }
.badge.beides { display: inline-flex; padding: 0; overflow: hidden; }
.badge.beides span { padding: 2px 0; }
.badge.beides .frei { background: var(--frei-bg); color: var(--frei); padding-left: 8px; }
.badge.beides .pflicht { background: var(--pflicht-bg); color: var(--pflicht); padding-right: 8px; }
.hint { margin: 12px 0 0; font-size: .9rem; color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }
mark { background: color-mix(in srgb, var(--accent) 30%, transparent); color: inherit; border-radius: 3px; }

@media (max-width: 480px) {
  .item summary { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; align-items: start; }
  .item summary::after { grid-column: 2; grid-row: 1 / span 2; align-self: center; margin-left: 0; }
  .item summary .badge { grid-column: 1; grid-row: 2; justify-self: start; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
