:root {
  --papier: #f3f4f6;
  --flaeche: #ffffff;
  --tinte: #1b2330;
  --leise: #5a6472;
  --linie: #d9dde3;
  --rot: #c8102e;
  --rot-dunkel: #9d0c24;
  --frei: #2f6f4f;
  --knapp: #b36b00;
  --radius: 10px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--tinte);
  background: var(--papier);
  line-height: 1.5;
}
* { box-sizing: border-box; }
body { margin: 0; font-size: 1rem; }
a { color: inherit; }
:focus-visible { outline: 3px solid #2458c6; outline-offset: 2px; }

/* Demo-Hinweis */
.demo-hinweis { background: #fff4cc; color: #5c4400; text-align: center; font-size: .85rem; font-weight: 600; padding: .4rem 1rem; }

/* Kopf */
.kopf { background: var(--flaeche); border-top: 5px solid var(--rot); border-bottom: 1px solid var(--linie); }
.kopf-innen { max-width: 44rem; margin: 0 auto; padding: .75rem 1rem; display: flex; align-items: center; gap: .75rem; }
.marke { display: flex; align-items: center; gap: .5rem; text-decoration: none; font-weight: 700; font-size: 1.05rem; }
.kreuz { width: 1.4rem; height: 1.4rem; flex: none; }
.nav { margin-left: auto; display: flex; gap: .25rem; align-items: center; }
.nav a, .nav button { text-decoration: none; padding: .45rem .65rem; border-radius: 8px; font-size: .95rem; background: none; border: 0; color: inherit; font: inherit; cursor: pointer; }
.nav a:hover, .nav button:hover { background: var(--papier); }
.nav a[aria-current="page"] { background: var(--papier); font-weight: 600; }

main { max-width: 44rem; margin: 0 auto; padding: 1.25rem 1rem 6rem; }
h1 { font-size: 1.6rem; line-height: 1.2; margin: 0 0 1rem; letter-spacing: -.01em; }
h2 { font-size: 1.1rem; margin: 2rem 0 .6rem; }
h2 .anzahl { color: var(--leise); font-weight: 400; }
.leise { color: var(--leise); }
.zahl { font-variant-numeric: tabular-nums; }

/* Meldungen */
.meldung { padding: .75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; border-left: 4px solid; background: var(--flaeche); }
.meldung.success { border-color: var(--frei); }
.meldung.error, .meldung.fehler { border-color: var(--rot); }
.meldung ul { margin: 0; padding-left: 1.1rem; }

/* Schaltflächen */
.knopf { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 2.9rem; padding: .6rem 1.1rem;
  border-radius: var(--radius); border: 1px solid var(--linie); background: var(--flaeche); color: var(--tinte);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.knopf:hover { border-color: var(--tinte); }
.knopf.haupt { background: var(--rot); border-color: var(--rot); color: #fff; }
.knopf.haupt:hover { background: var(--rot-dunkel); border-color: var(--rot-dunkel); }
.knopf.breit { width: 100%; }
.knopf.leise-knopf { border-color: transparent; color: var(--leise); font-weight: 500; }

/* Formulare */
label { display: block; font-weight: 600; font-size: .95rem; margin-bottom: .3rem; }
input, textarea, select { width: 100%; font: inherit; padding: .65rem .75rem; border: 1px solid var(--linie); border-radius: 8px; background: var(--flaeche); color: var(--tinte); min-height: 2.9rem; }
input:focus, textarea:focus, select:focus { border-color: var(--tinte); outline: none; box-shadow: 0 0 0 3px rgba(36,88,198,.25); }
.feld { margin-bottom: 1rem; }
.hinweis { font-size: .85rem; color: var(--leise); margin-top: .25rem; }
.reihe { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.reihe > * { min-width: 0; }
.block { background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; }

/* Bestandsliste mit Balken */
.bestand { list-style: none; margin: 0; padding: 0; background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); }
.bestand li { display: grid; grid-template-columns: 1fr 5.5rem; gap: .35rem 1rem; align-items: center; padding: .9rem 1rem; border-top: 1px solid var(--linie); }
.bestand li:first-child { border-top: 0; }
.bestand .name { font-weight: 600; }
.bestand .frei-text { font-size: .9rem; color: var(--leise); }
.bestand .frei-text strong { color: var(--tinte); font-size: 1.05rem; }
.balken { grid-column: 1; height: .55rem; border-radius: 99px; background: repeating-linear-gradient(135deg, #e3e6ea 0 6px, #d4d8de 6px 12px); overflow: hidden; }
.balken span { display: block; height: 100%; background: var(--frei); border-radius: 99px; transition: width .3s; }
.balken.knapp span { background: var(--knapp); }
.bestand .menge { grid-column: 2; grid-row: 1 / span 3; text-align: center; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.bestand li.leer .name { color: var(--leise); }
.bestand li.leer .menge { opacity: .45; }
.bestand input.ueber { border-color: var(--rot); box-shadow: 0 0 0 3px rgba(200,16,46,.2); }

/* Ausleihen als Liste */
.ausleihen { list-style: none; margin: 0; padding: 0; background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); }
.ausleihen li { border-top: 1px solid var(--linie); }
.ausleihen li:first-child { border-top: 0; }
.ausleihen a { display: block; padding: .8rem 1rem; text-decoration: none; }
.ausleihen a:hover { background: #fafbfc; }
.ausleihen .zeile1 { display: flex; justify-content: space-between; gap: .75rem; font-weight: 600; }
.ausleihen .zeile2 { font-size: .9rem; color: var(--leise); }
.leer-hinweis { padding: 1rem; color: var(--leise); background: var(--flaeche); border: 1px dashed var(--linie); border-radius: var(--radius); }

.status { display: inline-block; font-size: .8rem; font-weight: 600; padding: .1rem .55rem; border-radius: 99px; background: var(--papier); white-space: nowrap; }
.status.reserviert { background: #e7eefb; color: #1f4aa8; }
.status.ausgegeben { background: #fdf1de; color: #8a5200; }
.status.zurueck { background: #e3f1ea; color: var(--frei); }
.status.storniert { background: #eceef1; color: var(--leise); text-decoration: line-through; }
.status.ueberfaellig { background: var(--rot); color: #fff; }

/* Details */
dl.daten { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; margin: 0; }
dl.daten dt { color: var(--leise); }
dl.daten dd { margin: 0; }
table.positionen { width: 100%; border-collapse: collapse; }
table.positionen th, table.positionen td { text-align: left; padding: .55rem .4rem; border-top: 1px solid var(--linie); vertical-align: middle; }
table.positionen th { font-size: .85rem; color: var(--leise); font-weight: 600; border-top: 0; }
table.positionen td.num, table.positionen th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.positionen input { width: 4.5rem; min-height: 2.5rem; text-align: center; padding: .4rem; }
.aktionen { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
.protokoll { list-style: none; padding: 0; margin: 0; font-size: .9rem; }
.protokoll li { padding: .35rem 0; border-top: 1px solid var(--linie); }
.protokoll time { color: var(--leise); margin-right: .5rem; font-variant-numeric: tabular-nums; }

/* Filter */
.filter { display: grid; grid-template-columns: 1fr auto; gap: .5rem; margin-bottom: 1rem; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.chips a { text-decoration: none; padding: .35rem .8rem; border-radius: 99px; border: 1px solid var(--linie); background: var(--flaeche); font-size: .9rem; }
.chips a[aria-current="true"] { background: var(--tinte); border-color: var(--tinte); color: #fff; }

/* Fixierte Hauptaktion auf dem Handy */
.leiste { position: fixed; left: 0; right: 0; bottom: 0; background: rgba(255,255,255,.96); border-top: 1px solid var(--linie);
  padding: .75rem 1rem calc(.75rem + env(safe-area-inset-bottom)); }
.leiste-innen { max-width: 44rem; margin: 0 auto; display: flex; gap: .75rem; align-items: center; }
.leiste .summe { font-size: .9rem; color: var(--leise); flex: 1; }

.anmeldung { max-width: 24rem; margin: 3rem auto; }

@media (max-width: 30rem) {
  h1 { font-size: 1.35rem; }
  .nav .text-lang, .nav .nur-breit { display: none; }
  .kopf-innen { gap: .25rem; }
  .nav a, .nav button { padding: .45rem .5rem; }
  dl.daten { grid-template-columns: 1fr; gap: 0; }
  table.positionen th, table.positionen td { padding: .5rem .2rem; }
  table.positionen input { width: 3.4rem; }
  dl.daten dd { margin-bottom: .5rem; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
