:root {
  --grund: #f6f7f9; --karte: #fff; --rand: #d6dae0; --rand-stark: #b4bcc6;
  --text: #1d2430; --leise: #5d6672; --akzent: #1f5fa8; --akzent-hell: #e8f0fa;
  --ok: #1c7a4a; --ok-hell: #e6f4ec; --warn: #8a5a00; --warn-hell: #fdf3e0;
  --fehler: #a52a2a; --fehler-hell: #fceded; --kopf: #1d2430; --feld: #fff; --zeile: #fafbfc;
  --th: #eef1f5;
}
@media (prefers-color-scheme: dark) {
  :root {
    --grund: #14181f; --karte: #1c222b; --rand: #323a46; --rand-stark: #4a5463;
    --text: #e3e8ef; --leise: #9aa5b3; --akzent: #6fa8e8; --akzent-hell: #1d2c40;
    --ok: #6cc596; --ok-hell: #16291f; --warn: #e2b45c; --warn-hell: #2e2615;
    --fehler: #f08a8a; --fehler-hell: #331b1b; --kopf: #0d1015; --feld: #12161c; --zeile: #222933;
    --th: #242b35;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--grund); color: var(--text);
       font: 15px/1.45 "Segoe UI", system-ui, sans-serif; }
a { color: var(--akzent); }
header { background: var(--kopf); color: #fff; padding: 0 16px;
         display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
header .marke { font-weight: 600; padding: 12px 0; color: #fff; text-decoration: none; }
header .marke span { color: #8fb4dd; font-weight: 400; }
header nav { display: flex; gap: 2px; flex-wrap: wrap; }
header nav a { color: #c8d2de; text-decoration: none; padding: 12px; border-bottom: 3px solid transparent; }
header nav a:hover { color: #fff; }
header nav a.aktiv { color: #fff; border-bottom-color: #6fa8e8; }
header .anmeldung { margin-left: auto; display: flex; gap: 10px; align-items: center;
                    color: #c8d2de; font-size: 13px; padding: 8px 0; }
main { padding: 16px; max-width: 1100px; margin: 0 auto; }
main.breit { max-width: none; }
h1 { font-size: 21px; margin: 4px 0 4px; }
h2 { font-size: 16px; margin: 0 0 10px; }
.unterzeile { color: var(--leise); margin: 0 0 14px; }
.karte { background: var(--karte); border: 1px solid var(--rand); border-radius: 8px;
         padding: 14px 16px; margin-bottom: 14px; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--rand); vertical-align: top; }
th { background: var(--th); font-weight: 600; font-size: 12px; white-space: nowrap; }
tbody tr:hover { background: var(--zeile); }
td.zahl, th.zahl { text-align: right; font-variant-numeric: tabular-nums; }
td.mitte, th.mitte { text-align: center; }
.scroll { overflow-x: auto; border: 1px solid var(--rand); border-radius: 8px; background: var(--karte); }
input, select { font: inherit; padding: 7px 9px; border: 1px solid var(--rand-stark); border-radius: 6px;
                background: var(--feld); color: inherit; width: 100%; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--akzent); vertical-align: middle; margin: 0; }
.felder { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.feld label { display: block; font-size: 12px; color: var(--leise); margin-bottom: 3px; }
button, .knopf { font: inherit; padding: 8px 16px; border-radius: 6px; cursor: pointer;
  border: 1px solid var(--rand-stark); background: var(--karte); color: var(--text);
  text-decoration: none; display: inline-block; }
button:hover, .knopf:hover { filter: brightness(.96); }
button.haupt { background: var(--akzent); border-color: var(--akzent); color: #fff; font-weight: 600; }
button.mini, .knopf.mini { padding: 3px 10px; font-size: 13px; }
button.dunkel { background: transparent; color: #c8d2de; border-color: #4a5463; }
.leiste { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.meldung { padding: 10px 14px; border-radius: 6px; margin-bottom: 12px; border: 1px solid; }
.meldung.ok { background: var(--ok-hell); border-color: var(--ok); color: var(--ok); }
.meldung.info { background: var(--akzent-hell); border-color: var(--akzent); color: var(--akzent); }
.meldung.fehler { background: var(--fehler-hell); border-color: var(--fehler); color: var(--fehler); }
.marker { display: inline-block; padding: 1px 8px; border-radius: 9px; font-size: 12px;
          background: var(--th); color: var(--leise); white-space: nowrap; }
.marker.warn { background: var(--warn-hell); color: var(--warn); }
.marker.ok { background: var(--ok-hell); color: var(--ok); }
.leise { color: var(--leise); }
.klein { font-size: 13px; }

/* Auswahlliste */
.stuecke { list-style: none; margin: 0; padding: 0; }
.stuecke > li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 4px;
                border-bottom: 1px solid var(--rand); }
.stuecke > li:last-child { border-bottom: 0; }
.stuecke .titel { font-weight: 600; min-width: 0; flex: 1; }
.stuecke .titel a { color: inherit; text-decoration: none; }
.stuecke .titel a:hover { text-decoration: underline; }
.stuecke .stimmen { display: flex; flex-wrap: wrap; gap: 6px 14px; font-weight: 400; margin-top: 4px; }
.stuecke .stimmen label { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.stuecke li.ohne { color: var(--leise); }
.stuecke .nr { color: var(--leise); width: 2em; text-align: right; flex: none; font-variant-numeric: tabular-nums; }
.fuss { position: sticky; bottom: 0; background: var(--karte); border-top: 1px solid var(--rand);
        padding: 12px 16px; margin: 0 -16px -14px; border-radius: 0 0 8px 8px; }
.fuss label { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }

/* Zuordnungsmatrix: eigener Scrollbereich, Kopfzeile (Instrumente) und Stimmenspalte bleiben stehen */
.matrix-rahmen { max-height: calc(100vh - 150px); overflow: auto; }
.matrix { border-collapse: separate; border-spacing: 0; }
.matrix thead th { position: sticky; top: 0; z-index: 2; background: var(--th);
                   border-bottom: 2px solid var(--rand-stark); }
.matrix th.instr { vertical-align: bottom; padding: 8px 4px; font-weight: 500; text-align: center; }
.matrix th.instr span { writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; }
.matrix td.feste, .matrix th.feste { position: sticky; left: 0; background: var(--karte); z-index: 1;
                                     min-width: 220px; }
.matrix thead th.feste { z-index: 3; background: var(--th); vertical-align: bottom; }
.matrix td.vorschlag { background: var(--warn-hell); }
.matrix td { padding: 4px 6px; }
.matrix tbody tr:hover td { background: var(--zeile); }
.matrix tbody tr:hover td.vorschlag { background: var(--warn-hell); }

@media (max-width: 600px) {
  main { padding: 12px; }
  .stuecke .nr { display: none; }
  header .anmeldung span { display: none; }
}

/* Anleitung */
.anleitung ul, .anleitung ol { margin: 0; padding-left: 22px; }
.anleitung li { margin: 4px 0; }
.anleitung p { margin: 8px 0 0; }
.anleitung h2 + p, .anleitung h2 + ul, .anleitung h2 + ol { margin-top: 0; }
.anleitung td:first-child { white-space: nowrap; font-weight: 600; }
.baum { background: var(--grund); border: 1px solid var(--rand); border-radius: 6px; padding: 10px 12px;
        overflow-x: auto; font-size: 13px; line-height: 1.5; margin: 0; }
code { background: var(--th); padding: 1px 5px; border-radius: 4px; font-size: 90%; }
.baum code { background: none; padding: 0; }

/* aufklappbare Info */
details.info { padding: 10px 16px; }
details.info summary { cursor: pointer; color: var(--akzent); font-weight: 600; }
details.info[open] summary { margin-bottom: 8px; }
details.info p { margin: 0 0 8px; }
table.kurz { width: auto; }
table.kurz td { border: 0; padding: 2px 12px 2px 0; }
