/* fainz Faktura – mobil zuerst, ohne Build-Schritt */
:root {
  --bg: #f6f7f9;
  --flaeche: #ffffff;
  --text: #1f2933;
  --gedaempft: #6b7280;
  --linie: #e5e7eb;
  --akzent: #1d4ed8;
  --akzent-hell: #e8eefc;
  --gruen: #047857;
  --gruen-hell: #e6f4ef;
  --gelb: #92400e;
  --gelb-hell: #fdf3e2;
  --rot: #b91c1c;
  --rot-hell: #fdecec;
  --radius: 10px;
  --schatten: 0 1px 2px rgba(16, 24, 40, .06);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1216;
    --flaeche: #171b21;
    --text: #e5e7eb;
    --gedaempft: #9aa3af;
    --linie: #2a3039;
    --akzent: #7aa2ff;
    --akzent-hell: #1c2740;
    --gruen: #4ccf9d;
    --gruen-hell: #12291f;
    --gelb: #f2c06b;
    --gelb-hell: #2c2414;
    --rot: #f38b8b;
    --rot-hell: #301717;
    --schatten: none;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding-bottom: 72px; /* Platz für die untere Navigation */
}
a { color: var(--akzent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.35rem; margin: 0; line-height: 1.3; }
h2 { font-size: 1.05rem; margin: 0 0 .75rem; }
.gedaempft { color: var(--gedaempft); }
.klein { font-size: .85rem; }
.rechts { text-align: right; }
.nowrap { white-space: nowrap; }
.mono { font-variant-numeric: tabular-nums; }

/* Kopfleiste */
.kopf {
  position: sticky; top: 0; z-index: 10; background: var(--flaeche); border-bottom: 1px solid var(--linie);
  display: flex; align-items: center; gap: 1rem; padding: .6rem 1rem;
}
.marke { font-weight: 700; color: var(--text); letter-spacing: -.01em; }
.marke span { color: var(--akzent); }
.navi-oben { display: none; gap: .25rem; flex: 1; }
.navi-oben a { color: var(--text); padding: .35rem .65rem; border-radius: 8px; }
.navi-oben a.aktiv, .navi-oben a:hover { background: var(--akzent-hell); color: var(--akzent); text-decoration: none; }
.kopf .benutzer { margin-left: auto; display: flex; gap: .5rem; align-items: center; }

/* Navigation unten (mobil) */
.navi-unten {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10; background: var(--flaeche);
  border-top: 1px solid var(--linie); display: grid; grid-template-columns: repeat(5, 1fr);
  padding-bottom: env(safe-area-inset-bottom);
}
.navi-unten a { text-align: center; padding: .55rem .25rem .5rem; color: var(--gedaempft); font-size: .72rem; }
.navi-unten a b { display: block; font-size: 1.15rem; line-height: 1.2; font-weight: 400; }
.navi-unten a.aktiv { color: var(--akzent); }
@media (min-width: 900px) {
  .navi-oben { display: flex; }
  .navi-unten { display: none; }
  body { padding-bottom: 0; }
}

main { max-width: 1100px; margin: 0 auto; padding: 1rem; }
.titelzeile { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin: .25rem 0 1rem; }
.titelzeile .aktionen { margin-left: auto; display: flex; flex-wrap: wrap; gap: .5rem; }

.karte { background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius);
  box-shadow: var(--schatten); padding: 1rem; margin-bottom: 1rem; }
.raster { display: grid; gap: 1rem; }
@media (min-width: 700px) { .raster-2 { grid-template-columns: 1fr 1fr; } .raster-3 { grid-template-columns: repeat(3, 1fr); } }
.kennzahl { font-size: 1.5rem; font-weight: 650; }

/* Knöpfe */
.knopf, button {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem; min-height: 40px;
  padding: .45rem .9rem; border-radius: 8px; border: 1px solid var(--linie); background: var(--flaeche);
  color: var(--text); font: inherit; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.knopf:hover, button:hover { text-decoration: none; border-color: var(--gedaempft); }
.knopf.primaer, button.primaer { background: var(--akzent); border-color: var(--akzent); color: #fff; }
@media (prefers-color-scheme: dark) { .knopf.primaer, button.primaer { color: #0b1020; } }
.knopf.gefahr, button.gefahr { color: var(--rot); }
.knopf.klein, button.klein { min-height: 32px; padding: .2rem .6rem; font-size: .85rem; }
form.inline { display: inline; }

/* Formulare */
label { display: block; font-size: .85rem; color: var(--gedaempft); margin-bottom: .2rem; }
input, select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--flaeche); border: 1px solid var(--linie);
  border-radius: 8px; padding: .5rem .6rem; min-height: 42px;
}
textarea { min-height: 0; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--akzent); outline-offset: -1px; border-color: transparent; }
input[type=checkbox] { width: auto; min-height: 0; }
.feld { margin-bottom: .8rem; }
.feld .fehler, .fehlerliste { color: var(--rot); font-size: .85rem; }
.feld .hilfe { color: var(--gedaempft); font-size: .8rem; }
.felder { display: grid; gap: 0 1rem; }
@media (min-width: 700px) { .felder { grid-template-columns: repeat(2, 1fr); } .felder .breit { grid-column: 1 / -1; } }

/* Tabellen / Listen */
.tabelle { width: 100%; border-collapse: collapse; }
.tabelle th { text-align: left; font-size: .8rem; color: var(--gedaempft); font-weight: 600; padding: .5rem; border-bottom: 1px solid var(--linie); }
.tabelle td { padding: .6rem .5rem; border-bottom: 1px solid var(--linie); vertical-align: top; }
.tabelle tr:last-child td { border-bottom: 0; }
.tabelle tr.klickbar { cursor: pointer; }
.tabelle tr.klickbar:hover td { background: var(--bg); }
@media (max-width: 699px) {
  .tabelle.stapel thead { display: none; }
  .tabelle.stapel tr { display: grid; grid-template-columns: 1fr auto; padding: .6rem 0; border-bottom: 1px solid var(--linie); }
  .tabelle.stapel td { border: 0; padding: .1rem .25rem; }
  .tabelle.stapel td.mobil-aus { display: none; }
  .tabelle.stapel td.mobil-voll { grid-column: 1 / -1; }
}

.suche { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.suche input { flex: 1 1 200px; }
.suche select { flex: 0 1 180px; }
.reiter { display: flex; gap: .35rem; overflow-x: auto; margin-bottom: .75rem; padding-bottom: .25rem; }
.reiter a { padding: .3rem .75rem; border-radius: 999px; border: 1px solid var(--linie); color: var(--text); white-space: nowrap; font-size: .88rem; }
.reiter a.aktiv { background: var(--akzent); border-color: var(--akzent); color: #fff; }

/* Status-Marken */
.marke-status { display: inline-block; font-size: .75rem; font-weight: 600; padding: .1rem .5rem; border-radius: 999px; white-space: nowrap; }
.s-entwurf { background: var(--gelb-hell); color: var(--gelb); }
.s-fest, .s-offen { background: var(--akzent-hell); color: var(--akzent); }
.s-bezahlt { background: var(--gruen-hell); color: var(--gruen); }
.s-ueberfaellig, .s-storniert { background: var(--rot-hell); color: var(--rot); }

/* Meldungen */
.meldung { padding: .7rem .9rem; border-radius: 8px; margin-bottom: .75rem; border: 1px solid transparent; }
.meldung.success { background: var(--gruen-hell); color: var(--gruen); }
.meldung.error { background: var(--rot-hell); color: var(--rot); }
.meldung.warning { background: var(--gelb-hell); color: var(--gelb); }
.meldung.info { background: var(--akzent-hell); color: var(--akzent); }
.meldung ul { margin: .25rem 0 0; padding-left: 1.2rem; }

/* Positionen im Bearbeitungsformular */
.position { border: 1px solid var(--linie); border-radius: var(--radius); padding: .75rem; margin-bottom: .75rem; background: var(--flaeche); }
.position-kopf { display: flex; align-items: center; gap: .5rem; margin-bottom: .5rem; font-weight: 600; }
.position-kopf .rechts { margin-left: auto; }
.position .zeile { display: grid; gap: 0 .6rem; grid-template-columns: 1fr 1fr; }
@media (min-width: 700px) {
  .position .zeile.oben { grid-template-columns: 1.2fr 2fr 1fr; }
  .position .zeile.unten { grid-template-columns: repeat(6, 1fr); }
}
.position.geloescht { opacity: .45; }
.summenbox { display: grid; grid-template-columns: 1fr auto; gap: .2rem 1.5rem; max-width: 380px; margin-left: auto; }
.summenbox .gesamt { font-weight: 700; border-top: 1px solid var(--text); padding-top: .3rem; }
.aktionsleiste { position: sticky; bottom: 64px; background: var(--bg); padding: .75rem 0; display: flex; gap: .5rem; justify-content: flex-end; z-index: 5; }
@media (min-width: 900px) { .aktionsleiste { bottom: 0; } }

.anmeldung { max-width: 380px; margin: 8vh auto; }
.qr svg { width: 220px; height: 220px; background: #fff; padding: 8px; border-radius: 8px; }
.codes { font-family: ui-monospace, Menlo, monospace; columns: 2; font-size: 1.05rem; }
details summary { cursor: pointer; color: var(--gedaempft); }
.protokoll td { font-size: .85rem; }

.testbanner { background: var(--gelb-hell); color: var(--gelb); text-align: center; font-weight: 650;
  font-size: .8rem; padding: .35rem 1rem; border-bottom: 1px solid var(--linie); letter-spacing: .02em; }
