  :root {
  color-scheme: light dark;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);

  --orange: #F07E13;
  --blau: #577EB0;
  --dunkel: #4B5760;

  --bg: #F2F3F4;
  --card: #FFFFFF;
  --text: #000000;
  --muted: #4B5760;
  --line: #C8CCD0;
  --field: #FFFFFF;
  --ok: #2E7D4F;
  --warn: #B4531A;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #333C43;
    --card: #4B5760;
    --text: #ECEFEF;
    --muted: #C4CACE;
    --line: #5E6A72;
    --field: #3E484F;
    --ok: #6FCF97;
    --warn: #FFAA66;
  }
}
:root[data-theme="dark"] {
  --bg: #333C43;
  --card: #4B5760;
  --text: #ECEFEF;
  --muted: #C4CACE;
  --line: #5E6A72;
  --field: #3E484F;
  --ok: #6FCF97;
  --warn: #FFAA66;
}

*, *::before, *::after { box-sizing: inherit; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
  font-weight: 300;
  line-height: 1.5;
  font-size: 16px;
}
h1, h2, h3, .bold { font-weight: 500; letter-spacing: 0; }
img { max-width: 100%; }

.wrap { max-width: 720px; margin: 0 auto; padding: 0 16px 64px; }

.demo-bar {
  background: var(--dunkel); color: #fff;
  font-size: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.06em;
  text-align: center; padding: 6px 12px;
}

header {
  background: #FFFFFF;
  color: #000000;
  border-bottom: 3px solid var(--orange);
  padding: calc(20px + env(safe-area-inset-top, 0px)) 16px 20px;
}
.hdr-inner {
  max-width: 720px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
}
.hdr-title { font-size: 15px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em; margin: 0; color: #4B5760; }
.hdr-sub { font-size: 12px; color: #577EB0; margin: 2px 0 0; font-weight: 300; }
.logo { flex: 0 0 auto; }
.logo img { display: block; width: 150px; height: auto; }
.logo .weiss { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo .farbig { display: none; }
  :root:not([data-theme="light"]) .logo .weiss { display: block; }
}
:root[data-theme="dark"] .logo .farbig { display: none; }
:root[data-theme="dark"] .logo .weiss { display: block; }
@media (max-width: 420px) {
  .logo img { width: 118px; }
  .hdr-title { font-size: 13px; }
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 20px;
  margin-top: 16px;
}
.card > h2 {
  margin: 0 0 4px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--dunkel);
}
.card > .card-hint { margin: 0 0 16px; font-size: 13px; color: var(--muted); }

label.fld { display: block; margin-bottom: 14px; }
label.fld > span { display: block; font-size: 13px; font-weight: 700; margin-bottom: 5px; }
.req { color: var(--orange); }
textarea, input[type=text], input[type=email], input[type=date], select {
  width: 100%; padding: 11px 12px;
  font: inherit; font-weight: 300;
  color: var(--text); background: var(--field);
  border: 1px solid var(--line); border-radius: 6px;
}
textarea { resize: vertical; min-height: 72px; line-height: 1.45; }
input:focus, select:focus, textarea:focus, button:focus-visible {
  outline: 2px solid var(--blau); outline-offset: 1px;
}
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.err { font-size: 12px; color: var(--warn); margin-top: 4px; display: none; }
.err.on { display: block; }

button { font: inherit; font-weight: 700; cursor: pointer; border-radius: 6px; border: 1px solid transparent; }
.btn-primary { background: var(--blau); color: #fff; padding: 13px 20px; width: 100%; font-size: 16px; }
.btn-primary[disabled] { opacity: 0.45; cursor: not-allowed; }
.btn-ghost[disabled] { opacity: 0.5; cursor: progress; }
.btn-ghost {
  background: transparent; color: var(--blau); border-color: var(--line);
  padding: 7px 12px; font-size: 13px;
}

.combo { position: relative; }
.combo-list {
  position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px);
  background: var(--card); border: 1px solid var(--line); border-radius: 6px;
  max-height: 260px; overflow-y: auto; box-shadow: 0 8px 24px rgba(0,0,0,.14);
  display: none;
}
.combo-list.on { display: block; }
.combo-list ul { margin: 0; padding: 0; }
.combo-list li {
  list-style: none; padding: 10px 12px; cursor: pointer; border-bottom: 1px solid var(--line); font-size: 14px;
}
.combo-list li:last-child { border-bottom: 0; }
.combo-list li:hover { background: rgba(87,130,217,.14); }
.combo-list .nr { font-weight: 700; margin-right: 8px; color: var(--blau); }
.combo-empty { padding: 12px; font-size: 13px; color: var(--muted); }
.picked {
  display: none; margin-top: 6px; padding: 10px 12px; border-radius: 6px;
  background: rgba(87,130,217,.12); border: 1px solid var(--blau); font-size: 14px;
}
.picked.on { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.progress-wrap { position: sticky; top: 0; z-index: 10; background: var(--card); padding: 12px 0 8px; }
.progress-row { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; gap: 12px; }
.bar { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; background: var(--blau); transition: width .25s; }

.gruppe {
  margin: 22px 0 2px; font-size: 11px; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--muted);
  border-bottom: 1px solid var(--line); padding-bottom: 6px;
}
.pos { padding: 14px 0; border-bottom: 1px solid var(--line); }
.pos:last-child { border-bottom: 0; }
.pos-nr { font-size: 11px; color: var(--muted); letter-spacing: 0.06em; }
.pos-titel { font-weight: 700; font-size: 15px; margin: 1px 0 2px; }
.pos-desc { font-size: 13px; color: var(--muted); margin: 0 0 8px; }
.tag {
  display: inline-block; font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; padding: 2px 6px; border-radius: 3px; margin-left: 6px; vertical-align: 1px;
}
.tag-req { background: var(--blau); color: #fff; }
.tag-opt { background: var(--line); color: var(--muted); }
.bsp-link {
  background: none; border: 0; padding: 0; margin: 0 0 8px;
  color: var(--blau); font-size: 13px; font-weight: 700; cursor: pointer;
  text-decoration: underline; display: block;
}
.bilder { margin: 0 0 10px; }
.pos-cm { margin: 0 0 10px; }
.pos-cm input { font-size: 14px; padding: 8px 10px; }
.bild {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 10px; margin-bottom: 8px;
  background: var(--field); border: 1px solid var(--line); border-radius: 6px;
}
.bild .vs {
  flex: 0 0 64px; width: 64px; height: 64px; border-radius: 4px;
  overflow: hidden; border: 1px solid var(--ok);
}
.bild .vs img { width: 100%; height: 100%; object-fit: cover; }
.bild .bd { flex: 1 1 auto; min-width: 0; }
.bild .fn { font-size: 11px; color: var(--ok); font-weight: 700; word-break: break-all; margin-bottom: 6px; }
.bild input[type=text] { font-size: 14px; padding: 8px 10px; }
.bild .weg {
  background: none; border: 0; color: var(--warn); font-size: 12px;
  font-weight: 700; cursor: pointer; padding: 6px 0 0;
}
input[type=file] { display: none; }

.ov {
  position: fixed; inset: 0; z-index: 50; display: none;
  background: rgba(0,0,0,.72); padding: 24px;
  align-items: center; justify-content: center;
}
.ov.on { display: flex; }
.ov-box { background: var(--card); border-radius: 10px; padding: 16px; max-width: 520px; width: 100%; }
.ov-box h3 { margin: 0 0 4px; font-size: 15px; }
.ov-box p { margin: 0 0 12px; font-size: 13px; color: var(--muted); }
.ov-box #ov-bilder { max-height: 62vh; overflow-y: auto; }
.ov-box #ov-bilder img {
  width: 100%; border-radius: 6px; border: 1px solid var(--line);
  display: block; margin-bottom: 10px;
}
.ov-box .kein {
  background: var(--field); border: 1px dashed var(--line); border-radius: 6px;
  padding: 26px 16px; text-align: center; font-size: 13px; color: var(--muted);
}
.ov-box button { margin-top: 14px; }

.done-icon { font-size: 40px; color: var(--ok); }
table.sum { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 8px; }
table.sum td { padding: 6px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
table.sum td:first-child { color: var(--muted); width: 42%; padding-right: 12px; }
.filelist { font-size: 12px; margin: 8px 0 0; padding-left: 18px; color: var(--muted); }
.filelist li { margin-bottom: 14px; word-break: break-all; }
.filelist img {
  display: block; margin-top: 6px; width: 100%; max-width: 320px;
  border: 1px solid var(--line); border-radius: 4px;
}
.scrollx { overflow-x: auto; }
.hide { display: none !important; }
.note {
  font-size: 12px; color: var(--muted); border-left: 3px solid var(--blau);
  padding: 8px 0 8px 12px; margin-top: 16px;
}

/* Aeltere Browser kennen "gap" im Flex-Layout nicht */
@supports not (row-gap: 1px) {
  .hdr-inner > * + * { margin-left: 24px; }
  .picked.on > * + * { margin-left: 12px; }
  .progress-row > * + * { margin-left: 12px; }
  .pr-bilder > * { margin: 0 10px 10px 0; }
  .bg-deck-spalten > * + * { margin-left: 26px; }
  .bg-koerper > * + * { margin-left: 22px; }
  .btnrow > * { margin: 0 10px 10px 0; }
}

/* Ersatz, wenn object-fit fehlt: Bild mittig beschneiden statt verzerren */
@supports not (object-fit: cover) {
  .bild .vs img, .pr-bilder img { width: auto; height: 100%; max-width: none; }
}


/* Ergänzungen Online-System */
.muted { color: var(--muted); }
.zentriert { text-align: center; margin-top: 10px; }
.mt8 { margin-top: 8px; }
.fld { display: block; margin-bottom: 14px; }
.fld-lab { display: block; font-size: 13px; font-weight: 700; margin-bottom: 5px; }
.fld-letzt { margin-bottom: 0; }
.hdr-sub a { color: #577EB0; }
.btnrow { margin-top: 20px; display: flex; gap: 10px; flex-wrap: wrap; }
.upload { margin-top: 14px; }
.leer { padding: 14px 0; margin: 0; }
.mt14 { margin-top: 14px; }
.bild .status { font-size: 11px; color: var(--muted); }
.bild.fertig .status { color: var(--ok); }
.bild.fehler .status { color: var(--warn); }
table.liste { width: 100%; border-collapse: collapse; font-size: 13px; }
table.liste th, table.liste td { text-align: left; padding: 6px 8px 6px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
table.liste th { color: var(--muted); font-weight: 500; }
.fusslinks { text-align: center; margin-top: 18px; font-size: 13px; }
.link { background: none; border: 0; color: var(--blau); text-decoration: underline; font-weight: 500; padding: 4px 8px; }
/* Einfache Seiten (Kein Zugriff, Abgemeldet, 404) */
.kopf { display: flex; justify-content: space-between; align-items: center; padding: 16px; background: var(--blau); color: #fff; border-bottom: 3px solid var(--orange); }
.kopf h1 { margin: 0; font-size: 1.25rem; font-weight: 500; }
.abmelden { color: #fff; }
.inhalt { max-width: 720px; margin: 0 auto; padding: 24px 16px; line-height: 1.5; }

/* Phase 3: Liste, Detailansicht, Prüfung */
a.btn-ghost { display: inline-block; text-decoration: none; font-weight: 700; border-width: 1px; border-style: solid; border-radius: 6px; }
table.liste td .link { padding: 0; font-weight: 700; }
table.liste td:first-child { white-space: nowrap; }
.klein { font-size: 11px; word-break: break-all; white-space: normal; }
.status-eingereicht { color: var(--blau); font-weight: 700; }
.status-in_pruefung { color: var(--warn); font-weight: 700; }
.status-erledigt { color: var(--ok); font-weight: 700; }
.status-offen { color: var(--muted); }
.statuszeile { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 4px; border: 1px solid currentColor; }
.raster { display: flex; gap: 10px; flex-wrap: wrap; margin: 8px 0 10px; }
.kachel { width: 132px; }
.kachel a, .kachel .bildrahmen { display: block; }
.kachel img {
  width: 132px; height: 96px; object-fit: cover; display: block;
  border: 2px solid var(--line); border-radius: 4px; background: var(--field);
}
.kachel.an img { border-color: var(--blau); }
.kachel label { display: flex; gap: 6px; align-items: center; font-size: 12px; margin-top: 5px; cursor: pointer; color: var(--muted); }
.kachel.an label { color: var(--text); font-weight: 700; }
.kachel .weg { background: none; border: 0; color: var(--warn); font-size: 12px; font-weight: 700; cursor: pointer; padding: 5px 0 0; }
.ad-text { font-size: 13px; color: var(--muted); border-left: 3px solid var(--blau); padding: 4px 0 4px 10px; margin: 0 0 10px; white-space: pre-wrap; }
.pr-lab { font-size: 12px; font-weight: 700; margin: 6px 0 4px; }
.uebern { background: none; border: 0; padding: 0 0 8px; color: var(--blau); font-size: 12px; font-weight: 700; cursor: pointer; text-decoration: underline; }
.besuch-box { background: rgba(87,126,176,.10); border: 1px solid var(--line); border-radius: 6px; padding: 14px; margin-top: 16px; }
.speicherstand { font-size: 12px; color: var(--muted); margin-top: 8px; text-align: center; }
.speicherstand.fehler { color: var(--warn); }
.ok-meldung { font-size: 13px; color: var(--ok); margin-top: 8px; text-align: center; }

/* Verwaltung */
.anleitung { margin: 0 0 12px; padding-left: 20px; font-size: 14px; line-height: 1.5; }
.anleitung li { margin-bottom: 6px; }
.details-block { margin-top: 16px; }
.details-block h3 { font-size: 13px; margin: 0 0 6px; }
.details-block .hint { margin-bottom: 6px; }

/* Start- und Hinweisseiten */
.start { max-width: 520px; margin: 40px auto 0; text-align: center; }
.start h2 { margin-bottom: 18px; }
a.btn-link { display: block; text-decoration: none; text-align: center; border-radius: 6px; font-weight: 700; margin: 8px 0 18px; }
.start-hilfe { line-height: 1.5; }
.start-hilfe a { color: var(--blau); }

/* Inhaltsverwaltung */
.th-zeile { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.th-zeile:last-child { border-bottom: 0; }
.th-text { min-width: 0; }
.aktionen { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.btn-pfeil { min-width: 36px; padding: 7px 8px; }
.btn-pfeil[disabled] { opacity: 0.35; cursor: default; }
.neu-zeile { display: flex; gap: 10px; }
.neu-zeile input { flex: 1 1 auto; min-width: 0; }
.tag-aus { background: var(--warn); color: #fff; }
.pos-aus .pos-titel, .pos-aus .pos-desc, .pos-aus img { opacity: 0.55; }
.pos-edit { background: rgba(87,126,176,.08); border-radius: 6px; padding: 14px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; cursor: pointer; }
.check input { margin-top: 3px; }
.btn-voll { background: var(--blau); color: #fff; border-color: var(--blau); }
.btn-gefahr { background: var(--warn); color: #fff; padding: 11px 18px; width: 100%; font-size: 15px; }
.btn-gefahr[disabled] { opacity: 0.4; cursor: not-allowed; }
.btn-gefahr-klein { color: var(--warn); }
.card.gefahr { border-left: 3px solid var(--warn); }
.links-oben { text-align: left; margin: 16px 0 0; }
@media (max-width: 560px) {
  .th-zeile { flex-direction: column; align-items: flex-start; }
}
@supports not (row-gap: 1px) {
  .aktionen > * { margin: 0 6px 6px 0; }
  .neu-zeile > * + * { margin-left: 10px; }
}

/* Nutzerverwaltung */
.aktionen select.rolle-wahl { width: auto; padding: 6px 8px; font-size: 13px; }
