:root {
  /* HBI-Farben */
  --orange: #ec643d; --hellgrau: #e4e9ee; --dunkelgrau: #505456; --logograu: #3E4242;
  --blau: var(--logograu); --blau-hell: var(--hellgrau); --rot: #c0392b; --grau: var(--dunkelgrau);
  --hg: #eef1f4; --karte: #fff; --text: #2b2e2e; --rand: #d5dce3;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--hg); color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; }
header { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 10px;
  background: #fff; color: var(--logograu); border-bottom: 3px solid var(--orange);
  padding: calc(env(safe-area-inset-top) + 8px) 12px 8px; }
#logo { height: 30px; width: auto; display: block; }
#titel { flex: 1; font-weight: 600; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
button.icon { background: none; border: 0; color: var(--logograu); font-size: 26px; width: 40px; height: 36px; padding: 0; }
nav#menue { position: fixed; right: 8px; top: calc(env(safe-area-inset-top) + 54px); z-index: 20; background: #fff;
  border-radius: 10px; box-shadow: 0 6px 24px rgba(0,0,0,.2); display: flex; flex-direction: column; min-width: 220px; overflow: hidden; }
nav#menue button { background: none; border: 0; border-bottom: 1px solid var(--rand); padding: 14px 16px; text-align: left; font-size: 16px; }
main { max-width: 640px; margin: 0 auto; padding: 14px 14px calc(env(safe-area-inset-bottom) + 30px); }
.view { display: none; }
.view.aktiv { display: block; }
h2 { font-size: 20px; margin: 6px 0 14px; }
h3 { font-size: 16px; margin: 18px 0 8px; }
.karte { background: var(--karte); border-radius: 12px; padding: 14px; margin-bottom: 14px; box-shadow: 0 1px 3px rgba(0,0,0,.07); }
label { display: block; font-size: 14px; color: var(--grau); margin-bottom: 12px; }
input:not([type=checkbox]), textarea { display: block; width: 100%; margin-top: 4px; font: inherit; color: var(--text);
  border: 1px solid var(--rand); border-radius: 8px; padding: 11px 12px; background: #fff; }
textarea { resize: vertical; min-height: 90px; }
input:focus, textarea:focus { outline: 2px solid var(--blau); border-color: transparent; }
label.check { display: flex; gap: 10px; align-items: center; color: var(--text); font-size: 16px; }
label.check input { width: 22px; height: 22px; }
button, .btn { font: inherit; cursor: pointer; border-radius: 10px; border: 0; padding: 12px 16px; text-decoration: none; text-align: center; }
.primaer { background: var(--blau); color: #fff; font-weight: 600; }
.sekundaer { background: var(--blau-hell); color: var(--blau); font-weight: 600; }
.gross { display: block; width: 100%; padding: 16px; font-size: 17px; margin-top: 8px; }
.riesig { display: block; width: 100%; padding: 22px; font-size: 20px; margin: 4px 0 10px; border-radius: 14px; }

.klein-btn { padding: 10px 14px; font-size: 14px; }
button.link { background: none; color: var(--blau); padding: 4px; font-size: 14px; }
button:disabled { opacity: .5; }
.datei { display: block; text-align: center; cursor: pointer; border-radius: 10px; margin: 0; color: #fff; }
.datei.sekundaer { color: var(--blau); }
.zeile { display: flex; gap: 8px; align-items: stretch; }
.zeile .gross { margin: 0; flex: 1; }
.zeile .klein-btn { display: flex; align-items: center; }
.zeile-zw { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.klein { font-size: 13px; }
.grau { color: var(--grau); }
.zentriert { text-align: center; }
.zentriert .btn, .zentriert button { display: block; width: 100%; margin-top: 10px; }
.warnung { background: #fff3cd; border: 1px solid #ecd17a; border-radius: 10px; padding: 10px 12px; font-size: 14px; margin-bottom: 12px; }
.aufforderung { font-size: 17px; margin-bottom: 12px; }
.aktionen { margin-top: 6px; }

.typen { display: grid; gap: 10px; }
.typen button { background: #fff; border: 2px solid var(--rand); text-align: left; padding: 16px; border-radius: 12px; }
.typen button strong { display: block; font-size: 17px; color: var(--logograu); }
.typen button { border-left: 5px solid var(--logograu) !important; }
.typen button span { font-size: 14px; color: var(--grau); }

.liste .eintrag { background: #fff; border-radius: 10px; padding: 12px 14px; margin-bottom: 8px; display: flex;
  justify-content: space-between; align-items: center; gap: 10px; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.eintrag .t { font-weight: 600; }
.eintrag .s { font-size: 13px; color: var(--grau); }
.badge { font-size: 12px; padding: 3px 8px; border-radius: 20px; background: #fdecc8; color: #8a5a00; white-space: nowrap; }
.badge.fertig { background: #d8f0dd; color: #1e6b33; }

.info-kopf { display: flex; justify-content: space-between; margin-bottom: 4px; }
#standortStatus { margin-bottom: 10px; }

.rec { margin-bottom: 10px; }
.rec button { width: 100%; padding: 18px; font-size: 18px; font-weight: 600; border-radius: 12px; background: var(--logograu); color: #fff; }
/* Orange nur, solange eine Aufnahme läuft – das ist der Knopf, der jetzt gedrückt werden muss */
.rec button.laeuft { animation: puls 1.2s infinite; background: var(--orange); }
.rec .status { font-size: 13px; color: var(--grau); margin-top: 6px; min-height: 18px; text-align: center; }
@keyframes puls { 50% { opacity: .75; } }

.fotos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 10px; }
.fotos:empty { display: none; }
.foto { position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: #ddd; }
.foto img { width: 100%; height: 100%; object-fit: cover; display: block; }
.foto .x { position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; border-radius: 50%; padding: 0;
  background: rgba(0,0,0,.6); color: #fff; font-size: 16px; line-height: 28px; }
.foto.laedt::after { content: "⏳"; position: absolute; inset: 0; display: grid; place-items: center; background: rgba(255,255,255,.5); font-size: 22px; }
.foto.fehler::after { content: "⚠️ erneut"; position: absolute; inset: 0; display: grid; place-items: center; background: rgba(255,230,230,.85); font-size: 14px; }

.ueb-abschnitt h3 { margin: 0 0 8px; display: flex; justify-content: space-between; align-items: center; }
.ueb-abschnitt .fotos { grid-template-columns: repeat(4, 1fr); }

.pad { width: 100%; height: 170px; border: 1px dashed #9aa5b1; border-radius: 8px; background: #fcfcfd; touch-action: none; display: block; margin-top: 6px; }

.spinner { width: 46px; height: 46px; border: 5px solid var(--blau-hell); border-top-color: var(--blau); border-radius: 50%;
  margin: 18px auto; animation: dreh 1s linear infinite; }
@keyframes dreh { to { transform: rotate(360deg); } }
.gross-icon { font-size: 48px; }

#toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 20px); transform: translateX(-50%); z-index: 30;
  background: #222; color: #fff; padding: 12px 18px; border-radius: 10px; max-width: 90vw; font-size: 15px; box-shadow: 0 4px 16px rgba(0,0,0,.3); }
#toast.fehler { background: var(--rot); }
#suche { margin: 0 0 10px; }
.rot { color: var(--rot) !important; }
#detAktionen .btn, #detAktionen button.gross { display: block; width: 100%; margin-top: 8px; box-sizing: border-box; }
#detVersionen { margin-top: 10px; }
#detVersionen a { color: var(--blau); margin-right: 10px; }
.det-abschnitt p { margin: 6px 0 0; white-space: pre-wrap; }
.foto a { display: block; width: 100%; height: 100%; }
body:not(.admin) .nur-admin { display: none !important; }

input:focus, textarea:focus { outline-color: var(--logograu); }
.badge { background: #fde3da; color: #a33a17; }
.badge.fertig { background: var(--hellgrau); color: var(--logograu); }

/* Prüfschritt */
.pruef-feld { margin-bottom: 10px; }
.pruef-feld textarea { min-height: 70px; }
.mangel-karte { border: 1px solid var(--rand); border-left: 4px solid #fde3da; border-radius: 10px; padding: 10px; margin: 8px 0; background: #fafbfc; }
.mangel-karte label, .zeile-karte label { margin-bottom: 8px; }
.raster2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.raster3 { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 8px; }
.zeile-karte { border-bottom: 1px solid var(--rand); padding: 6px 0; }
.mini-fotos { display: flex; gap: 4px; margin-bottom: 8px; }
.mini-fotos img { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; }
button.link.rot { padding: 2px 0; }
#pruefAktionen .link { display: block; margin: 12px auto 0; }
