/* Notenarchiv – Farben: Loden, Messing, Notenpapier */
:root {
  --papier: #f6f8f5;
  --blatt: #ffffff;
  --tinte: #17201b;
  --grau: #56615a;
  --linie: #d3d9d2;
  --loden: #234a36;
  --loden-dunkel: #173324;
  --messing: #a97c1f;
  --messing-hell: #f5ecd3;
  --rot: #a3352b;
  --rot-hell: #f7e5e2;
  --schrift: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --titelschrift: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
}

* { box-sizing: border-box; }
html { font-size: 100%; }
body {
  margin: 0;
  background: var(--papier);
  color: var(--tinte);
  font: 1rem/1.5 var(--schrift);
}
a { color: var(--loden); text-underline-offset: 0.15em; }
a:hover { color: var(--loden-dunkel); }
:focus-visible { outline: 3px solid var(--messing); outline-offset: 2px; }
.versteckt {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

/* ---------- Kopf mit Notenlinien ---------- */
.kopf { background: var(--blatt); }
.kopf-innen {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 1.5rem;
  max-width: 62rem; margin: 0 auto; padding: 1rem 1.25rem 0.9rem;
}
.marke {
  font: 600 1.5rem/1.1 var(--titelschrift);
  color: var(--tinte); text-decoration: none; letter-spacing: 0.005em;
}
.ensemble-wahl select {
  font: inherit; font-weight: 600; color: var(--loden);
  border: 0; border-bottom: 1px solid var(--linie); border-radius: 0;
  background-color: transparent; padding: 0.15rem 1.5rem 0.15rem 0; max-width: 16rem;
}
.kopf nav { display: flex; flex-wrap: wrap; gap: 0 1.4rem; margin-left: auto; }
.kopf nav a {
  position: relative; padding: 0.35rem 0; color: var(--tinte);
  text-decoration: none; font-weight: 500;
}
.kopf nav a:hover { color: var(--loden); }
/* der aktive Bereich bekommt einen Notenkopf auf der zweiten Linie */
.kopf nav a.aktiv::after {
  content: ""; position: absolute; left: 50%; top: calc(100% + 0.9rem + 3px);
  width: 13px; height: 9px; margin-left: -6px;
  background: var(--loden); border-radius: 50%; transform: rotate(-22deg);
}
.notenlinien {
  height: 25px;
  background: repeating-linear-gradient(to bottom, var(--tinte) 0 1px, transparent 1px 6px);
  opacity: 0.8;
}
.abmelden { display: flex; align-items: baseline; gap: 0.6rem; color: var(--grau); font-size: 0.9rem; }

/* ---------- Seite ---------- */
main { max-width: 62rem; margin: 0 auto; padding: 1.75rem 1.25rem 6rem; }
.weit main, .weit .kopf-innen { max-width: 100rem; }
.schmal main { max-width: 24rem; }
h1, h2, h3 { font-family: var(--titelschrift); line-height: 1.2; font-weight: 600; }
h1 { font-size: 2rem; margin: 0 0 0.6rem; text-wrap: balance; }
h1 small, h2 small { font: 400 1rem var(--schrift); color: var(--grau); margin-left: 0.5rem; }
h2 { font-size: 1.4rem; margin: 0 0 0.6rem; }
h3 { font-size: 1.1rem; margin: 0 0 0.25rem; }
section { margin-top: 2.5rem; }
p { margin: 0 0 0.8rem; max-width: 46rem; }
.pfad { font-size: 0.9rem; margin-bottom: 0.4rem; }
.pfad a::after { content: " /"; color: var(--grau); }
.angaben { color: var(--grau); }
.notiz { border-left: 3px solid var(--messing); padding-left: 0.75rem; }
.hinweis, .anzahl, .leise { color: var(--grau); font-size: 0.92rem; }
.leise { font-size: inherit; }
.leer { color: var(--grau); padding: 1.25rem; border: 1px dashed var(--linie); border-radius: 4px; background: var(--blatt); max-width: none; }
.leer p:last-child { margin-bottom: 0; }
.titelzeile { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; margin-bottom: 0.4rem; }
.titelzeile h1, .titelzeile h2 { margin: 0; }
.meldung { padding: 0.65rem 0.9rem; border-radius: 4px; max-width: none; background: var(--messing-hell); border-left: 4px solid var(--messing); }
.meldung.fehler { background: var(--rot-hell); border-left-color: var(--rot); }

/* ---------- Knöpfe und Formulare ---------- */
button, .knopf {
  display: inline-block; font: inherit; font-weight: 500; line-height: 1.3; cursor: pointer;
  padding: 0.45rem 0.85rem; border-radius: 4px; text-decoration: none;
  color: var(--tinte); background: var(--blatt); border: 1px solid #aab3ab;
}
button:hover, .knopf:hover { border-color: var(--loden); color: var(--loden-dunkel); }
button.haupt, .knopf.haupt { background: var(--loden); border-color: var(--loden); color: #fff; }
button.haupt:hover, .knopf.haupt:hover { background: var(--loden-dunkel); color: #fff; }
button.gefahr { color: var(--rot); border-color: #d5aaa5; }
button.schlicht { border-color: transparent; background: none; padding: 0.2rem 0.4rem; color: var(--loden); text-decoration: underline; text-underline-offset: 0.15em; }
button.schlicht.gefahr { color: var(--rot); }
button:disabled { opacity: 0.35; cursor: default; }
.knopfzeile { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; margin: 0.5rem 0; }

input, select, textarea {
  font: inherit; color: inherit; max-width: 100%;
  padding: 0.42rem 0.55rem; border: 1px solid #aab3ab; border-radius: 4px; background: var(--blatt);
}
input[type="checkbox"], input[type="radio"] { width: 1.05rem; height: 1.05rem; accent-color: var(--loden); margin: 0 0.35rem 0 0; vertical-align: -0.12em; }
input[type="number"] { width: 4.5rem; text-align: right; }
.formular label { display: block; font-weight: 500; font-size: 0.92rem; margin-bottom: 0.75rem; }
.formular label input:not([type="checkbox"]):not([type="radio"]), .formular label select, .formular label textarea {
  display: block; width: 100%; margin-top: 0.2rem; font-weight: 400; font-size: 1rem;
}
.formular label.wahl, label.wahl { display: block; font-weight: 400; font-size: 1rem; margin: 0.3rem 0; }
.formular.raster { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 0 1rem; max-width: 46rem; }
.formular.raster .breit { grid-column: 1 / -1; }
.formular.zeile { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0 1rem; margin-top: 1.25rem; }
.formular.zeile h2, .formular.zeile h3 { flex-basis: 100%; }
.formular.zeile label { flex: 1 1 13rem; }
.formular.zeile button { margin-bottom: 0.75rem; }
.formular.hochladen, .formular.hinzufuegen, .formular.ausgabe {
  background: var(--blatt); border: 1px solid var(--linie); border-radius: 4px;
  padding: 1.1rem 1.25rem 1.25rem; margin-top: 1.25rem; max-width: 46rem;
}
.formular.hinzufuegen select { width: 100%; }
fieldset { border: 0; padding: 0; margin: 0 0 1rem; }
legend { font-weight: 500; font-size: 0.92rem; padding: 0; margin-bottom: 0.2rem; }
#einzelstimme { margin: 0.2rem 0 0 1.5rem; }
.suche { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; margin: 0.9rem 0; }
.suche input { flex: 1 1 18rem; }
form.inline { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.klappe { margin: 0.5rem 0 1rem; }
.klappe summary { cursor: pointer; color: var(--loden); width: fit-content; }
.klappe[open] { background: var(--blatt); border: 1px solid var(--linie); border-radius: 4px; padding: 0.75rem 1rem 1rem; }
.klappe[open] summary { margin-bottom: 0.75rem; }

/* ---------- Tabellen ---------- */
.tabelle-rahmen { overflow-x: auto; background: var(--blatt); border: 1px solid var(--linie); border-radius: 4px; }
table.liste { width: 100%; border-collapse: collapse; }
.liste th, .liste td { text-align: left; padding: 0.5rem 0.8rem; border-bottom: 1px solid var(--linie); vertical-align: middle; }
.liste thead th { font-size: 0.85rem; font-weight: 600; color: var(--grau); white-space: nowrap; }
.liste tbody:last-child tr:last-child td { border-bottom: 0; }
.liste .zahl { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.liste tr.gruppe th { background: var(--papier); font: 600 0.95rem var(--titelschrift); color: var(--loden-dunkel); padding-top: 0.6rem; }
.liste tr.gruppe td { background: var(--papier); }
.liste .aktionen { text-align: right; white-space: nowrap; }
.liste .aktionen > * { display: inline-block; margin-left: 0.6rem; }
.liste .aktionen form { margin-left: 0.4rem; }
.titel-link { font-weight: 600; }
.marke-pruefen {
  display: inline-block; margin-left: 0.4rem; padding: 0.05rem 0.45rem; border-radius: 3px;
  background: var(--messing-hell); color: #5c4310; font-size: 0.82rem; font-weight: 500; white-space: nowrap;
}
.luecke { font-size: 0.9rem; color: #6b4a0c; }
.luecke summary { cursor: pointer; }
.stimmen td:first-child, .stimmen thead th:first-child { width: 55%; }
.besetzung input, .besetzung select { padding: 0.3rem 0.4rem; }
.besetzung input[name="name"] { width: 10.5rem; }
.besetzung input[name="aliase"] { width: 10rem; }
.besetzung input[name="nummer"] { width: 2.8rem; }
.besetzung input[name="sortierung"] { width: 3.8rem; }
.besetzung input[name="exemplare"] { width: 3.6rem; }
.besetzung select[name="instrument"] { width: 9.5rem; }
.besetzung select[name="register"] { width: 11rem; }
.besetzung button { padding: 0.3rem 0.6rem; }
.besetzung tr.inaktiv td { background: #f1f2f0; }
.besetzung th, .besetzung td { padding: 0.35rem 0.5rem; }

/* ---------- Zuordnung der Seiten ---------- */
.werkzeug { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.5rem; margin: 0.75rem 0 1rem; }
.werkzeug .stand { margin: 0; }
.klappe.klein { margin: 0; }
.seiten { display: grid; grid-template-columns: repeat(auto-fill, minmax(21rem, 1fr)); gap: 0.9rem; }
.seite {
  display: flex; flex-direction: column; gap: 0.45rem;
  background: var(--blatt); border: 1px solid var(--linie); border-left: 5px solid var(--linie);
  border-radius: 4px; padding: 0.6rem;
}
.seite.pruefen { border-left-color: var(--messing); background: #fffdf5; }
.seite.geaendert { border-left-color: var(--loden); }
.seite[data-quelle="leer"] .bild { opacity: 0.45; }
.seite .bild { padding: 0; border: 1px solid var(--linie); border-radius: 2px; background: #fff; overflow: hidden; cursor: zoom-in; }
.seite .bild img { display: block; width: 100%; aspect-ratio: 210 / 83; object-fit: cover; object-position: top; }
.seite-info { display: flex; align-items: baseline; gap: 0.6rem; font-size: 0.88rem; }
.seite-info .nr { font-weight: 600; white-space: nowrap; }
.seite-info .gelesen { color: var(--grau); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seite.pruefen .gelesen { color: #6b4a0c; }
.seite .drehen { font-size: 1.15rem; line-height: 1; text-decoration: none; }
.seite select { width: 100%; font-weight: 600; }
.seiten.nur-pruefen .seite:not(.pruefen) { display: none; }
.speicherleiste {
  position: sticky; bottom: 0; z-index: 2; margin-top: 1.25rem;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 0.5rem 1.25rem;
  padding: 0.75rem 1rem; background: var(--blatt); border: 1px solid var(--linie); border-radius: 4px 4px 0 0;
  box-shadow: 0 -6px 16px -12px rgba(23, 32, 27, 0.5);
}
.speicherleiste span { margin-right: auto; color: var(--grau); font-size: 0.92rem; }
.fortschritt { background: var(--blatt); border: 1px solid var(--linie); border-radius: 4px; padding: 1.25rem; max-width: 40rem; }
progress { width: 100%; height: 0.9rem; accent-color: var(--loden); }
dialog#gross { border: 0; padding: 0.75rem; max-width: min(96vw, 1100px); max-height: 96vh; border-radius: 4px; }
dialog#gross::backdrop { background: rgba(23, 32, 27, 0.7); }
dialog#gross img { display: block; max-width: 100%; height: auto; }
dialog#gross form { text-align: right; }

@media (max-width: 52rem) {
  /* Navigation bricht um: Unterstrich statt Notenkopf */
  .kopf nav a.aktiv::after { display: none; }
  .kopf nav a.aktiv { color: var(--loden); box-shadow: inset 0 -3px 0 var(--loden); }
}
@media (max-width: 40rem) {
  .kopf nav { margin-left: 0; flex-basis: 100%; gap: 0 1.1rem; }
  .abmelden { margin-left: auto; }
  .abmelden span { display: none; }
  h1 { font-size: 1.6rem; }
  .seiten { grid-template-columns: 1fr; }
  .liste th, .liste td { padding: 0.45rem 0.55rem; }
}
@media (prefers-reduced-motion: no-preference) {
  .seite { transition: border-color 0.15s; }
}
