:root {
  --bg: #f3f4f6; --karte: #fff; --text: #111827; --leise: #6b7280; --rand: #e5e7eb;
  --akzent: #f59e0b; --akzent-text: #111827; --ok: #059669; --fehler: #dc2626; --warn: #b45309;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0b0f17; --karte: #151b26; --text: #e5e7eb; --leise: #9ca3af; --rand: #273142; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}
.kopf {
  position: sticky; top: 0; z-index: 5; color: #fff;
  background: rgba(17, 24, 39, .94); -webkit-backdrop-filter: saturate(160%) blur(12px); backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, .08); box-shadow: 0 4px 16px rgba(0, 0, 0, .12);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
}
.kopf-innen {
  max-width: 960px; margin: 0 auto; padding: .55rem 1rem;
  display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "marke tabs abmelden";
  align-items: center; gap: .75rem;
}
.kopf a { color: #fff; text-decoration: none; }
.marke { grid-area: marke; display: inline-flex; align-items: center; gap: .55rem; font-weight: 700; font-size: 1.05rem; letter-spacing: .01em; white-space: nowrap; }
.logo { display: inline-grid; place-items: center; width: 2rem; height: 2rem; border-radius: .55rem; background: var(--akzent); color: #111827; flex: none; }
.tabs { grid-area: tabs; justify-self: end; display: flex; gap: .2rem; padding: .2rem; border-radius: .7rem; background: rgba(255, 255, 255, .07); }
.tabs a { padding: .4rem .9rem; border-radius: .5rem; color: #d1d5db; font-size: .95rem; font-weight: 600; text-align: center; transition: background .15s, color .15s; }
.tabs a:hover { color: #fff; }
.tabs a.aktiv { background: var(--akzent); color: #111827; }
.abmelden {
  grid-area: abmelden; display: inline-flex; align-items: center; gap: .45rem; max-width: 11rem;
  padding: .4rem .5rem .4rem .75rem; border-radius: 999px; cursor: pointer;
  background: transparent; color: #d1d5db; border: 1px solid rgba(255, 255, 255, .18); font: inherit; font-size: .875rem;
}
.abmelden:hover { color: #fff; border-color: rgba(255, 255, 255, .4); }
.abmelden svg { flex: none; }
.benutzer-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.benutzer-name:empty { display: none; }
.abmelden:has(.benutzer-name:empty) { padding: .45rem; }
body.ohne-login .tabs, body.ohne-login .abmelden { visibility: hidden; }
@media (max-width: 600px) {
  .kopf-innen { grid-template-columns: 1fr auto; grid-template-areas: "marke abmelden" "tabs tabs"; gap: .5rem; padding: .5rem .75rem .6rem; }
  .tabs { justify-self: stretch; }
  .tabs a { flex: 1; padding: .5rem; }
  .abmelden { max-width: 9rem; }
  body.ohne-login .tabs { display: none; }
}
main { max-width: 960px; margin: 0 auto; padding: 1rem; }
.karte { background: var(--karte); border: 1px solid var(--rand); border-radius: 1rem; padding: 1.1rem; margin-bottom: 1rem; }
.schmal { max-width: 380px; margin: 3rem auto; }
h1 { font-size: 1.35rem; margin: 0 0 .8rem; }
h2 { font-size: 1.1rem; margin: 0; }
label { display: block; font-weight: 600; font-size: .9rem; }
input[type=password], input:not([type]), input[type=search] {
  display: block; width: 100%; margin-top: .3rem; padding: .75rem .85rem; font-size: 1.1rem;
  border: 1px solid var(--rand); border-radius: .6rem; background: var(--bg); color: var(--text);
}
input:focus { outline: 2px solid var(--akzent); border-color: transparent; }
#kennzeichen { text-transform: uppercase; font-family: ui-monospace, Menlo, monospace; letter-spacing: .05em; }
.felder { display: grid; gap: .8rem; grid-template-columns: 1fr 1fr; }
@media (max-width: 520px) { .felder { grid-template-columns: 1fr; } }
.vorschau { min-height: 1.4em; margin: .7rem 0 .4rem; color: var(--leise); }
.vorschau.ok { color: var(--ok); font-weight: 600; }
.vorschau.fehler, .fehler { color: var(--fehler); }
.hinweis { color: var(--leise); font-size: .875rem; margin: .4rem 0; }
.hinweis.ok { color: var(--ok); } .hinweis.warnung { color: var(--warn); } .hinweis.fehler { color: var(--fehler); }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .8rem; }
.chip { border: 1px solid var(--rand); background: var(--bg); color: var(--text); border-radius: 999px; padding: .35rem .75rem; font-size: .85rem; cursor: pointer; }
.knoepfe { display: flex; flex-wrap: wrap; gap: .6rem; }
.knoepfe.klein .knopf { padding: .5rem .8rem; font-size: .9rem; }
.knopf, button.primaer {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem; cursor: pointer;
  padding: .9rem 1.2rem; border-radius: .7rem; border: 1px solid var(--rand); background: var(--bg);
  color: var(--text); font: inherit; font-weight: 600; text-decoration: none; user-select: none;
}
#v-upload .knoepfe .knopf { flex: 1 1 10rem; font-size: 1.1rem; padding: 1.1rem; }
.primaer { background: var(--akzent) !important; border-color: var(--akzent) !important; color: var(--akzent-text) !important; }
button.primaer { width: 100%; margin-top: 1rem; font-size: 1.05rem; }
.gefahr { color: var(--fehler); }
.knopf[aria-disabled=true] { opacity: .4; pointer-events: none; }
.link { background: none; border: 0; color: var(--leise); font: inherit; cursor: pointer; text-decoration: none; }
.zeile { display: flex; justify-content: space-between; align-items: center; gap: .8rem; flex-wrap: wrap; margin-bottom: .8rem; }
.zeile h1 { margin: 0; }
.fortschritt { height: 6px; background: var(--rand); border-radius: 3px; overflow: hidden; margin: .35rem 0; }
.fortschritt.gross { height: 10px; border-radius: 5px; }
.fortschritt > div { height: 100%; width: 0; background: var(--akzent); transition: width .2s; }
.liste { list-style: none; margin: 0; padding: 0; }
.eintrag { display: flex; gap: .75rem; align-items: center; padding: .55rem 0; border-top: 1px solid var(--rand); }
.eintrag img { width: 56px; height: 56px; object-fit: cover; border-radius: .4rem; background: var(--rand); flex: none; }
.eintrag .info { flex: 1; min-width: 0; }
.eintrag .name { font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.eintrag.fertig .fortschritt > div { background: var(--ok); }
.eintrag.fehlerhaft { cursor: pointer; } .eintrag.fehlerhaft .fortschritt > div { background: var(--fehler); }
.vorgaenge li { border-top: 1px solid var(--rand); }
.vorgaenge a { display: flex; flex-direction: column; padding: .75rem .25rem; color: var(--text); text-decoration: none; }
.vorgaenge li.neu strong::after { content: "neu"; margin-left: .5rem; font-size: .7rem; background: var(--akzent); color: #111827; padding: .1rem .4rem; border-radius: .3rem; vertical-align: middle; }
#suche { margin: .2rem 0 .8rem; }
.raster { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; margin-top: 1rem; }
.raster figure { margin: 0; cursor: pointer; border-radius: .5rem; overflow: hidden; background: var(--bg); border: 1px solid var(--rand); }
.raster img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.raster figcaption { font-size: .75rem; padding: .3rem .4rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.raster figure.abgeholt { opacity: .45; }
.lightbox { position: fixed; inset: 0; z-index: 10; background: rgba(0,0,0,.92); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 1rem; }
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 100%; max-height: calc(100vh - 6rem); object-fit: contain; }
.lightbox-pfeil { position: absolute; top: 50%; transform: translateY(-50%); z-index: 1; width: 3rem; height: 4.5rem; border: 0; border-radius: .5rem; background: rgba(31,41,55,.7); color: #fff; font-size: 2.6rem; line-height: 1; cursor: pointer; }
.lightbox-pfeil.links { left: .5rem; }
.lightbox-pfeil.rechts { right: .5rem; }
.lightbox-pfeil:hover:not(:disabled) { background: rgba(55,65,81,.9); }
.lightbox-pfeil:disabled { opacity: .2; cursor: default; }
.lightbox img { transition: opacity .15s; }
.lightbox.laedt img { opacity: .3; }
.lightbox-laden { display: none; position: absolute; top: 50%; left: 50%; width: 2.6rem; height: 2.6rem; margin: -1.3rem 0 0 -1.3rem; border: 4px solid rgba(255,255,255,.25); border-top-color: #fff; border-radius: 50%; animation: lightbox-dreh .8s linear infinite; pointer-events: none; }
.lightbox.laedt .lightbox-laden { display: block; }
@keyframes lightbox-dreh { to { transform: rotate(360deg); } }
.lightbox-leiste { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; justify-content: center; margin-top: .8rem; color: #fff; }
.lightbox-leiste .knopf { padding: .5rem .8rem; background: #1f2937; color: #fff; border-color: #374151; }
[hidden] { display: none !important; }
.loesch-hinweis { margin: 0 0 .3rem; font-size: .75rem; }
.loesch-hinweis.bald { color: var(--warn); }
.fuss { text-align: center; color: var(--leise); font-size: .8rem; padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom)); }
.meldung { position: fixed; left: 50%; bottom: calc(1.2rem + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 20; max-width: min(28rem, calc(100vw - 2rem)); padding: .8rem 1.1rem; border-radius: .6rem; background: var(--karte); color: var(--text); border: 1px solid var(--rand); border-left: 4px solid var(--akzent); box-shadow: 0 8px 24px rgba(0,0,0,.25); cursor: pointer; animation: meldung-rein .2s ease-out; }
.meldung.fehler { border-left-color: var(--fehler); }
@keyframes meldung-rein { from { opacity: 0; transform: translate(-50%, .5rem); } }
