:root {
  --rot: #c8102e;
  --rot-dunkel: #a50d26;
  --tinte: #1f2a30;
  --text: #25313a;
  --grau: #6b7780;
  --linie: #dfe4e8;
  --grund: #f2f4f6;
  --weiss: #fff;
  --gruen: #1d8a55;
  --radius: 16px;
  --schatten: 0 1px 2px rgba(20, 30, 40, .06), 0 6px 20px rgba(20, 30, 40, .06);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--grund); color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  overscroll-behavior-y: none;
}
body.blatt-offen { overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* Kopfleiste */
.kopf {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px;
  padding: calc(env(safe-area-inset-top) + 10px) max(14px, env(safe-area-inset-right)) 10px max(14px, env(safe-area-inset-left));
  background: var(--tinte); color: #fff;
}
.marke { flex: 1; display: flex; align-items: baseline; gap: 7px; font-size: 21px; letter-spacing: -.01em; }
.marke-n { font-weight: 800; font-style: italic; color: #fff; border-bottom: 3px solid var(--rot); line-height: 1.1; }
.marke-t { font-weight: 500; opacity: .85; }
.kopf-titel { flex: 1; font-weight: 650; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center; }
.rund {
  width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .1); color: inherit;
  display: grid; place-items: center; flex: none;
}
.rund:active { background: rgba(255, 255, 255, .22); }
.rund.klein { width: 36px; height: 36px; background: rgba(20, 28, 34, .72); color: #fff; }
.rund.klein svg { width: 18px; height: 18px; }

/* Fortschritt */
.chips {
  position: sticky; top: calc(env(safe-area-inset-top) + 64px); z-index: 15; display: flex; gap: 8px; overflow-x: auto;
  padding: 10px max(14px, env(safe-area-inset-left)); background: rgba(242, 244, 246, .92);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border-bottom: 1px solid var(--linie); scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.marke-chip {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; border: 1px solid var(--linie); background: #fff;
  border-radius: 999px; padding: 7px 13px 7px 9px; font-size: 14px; font-weight: 550; color: var(--grau);
}
.marke-chip i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid #c3cbd1; display: block; }
.marke-chip svg { width: 16px; height: 16px; stroke-width: 3; }
.marke-chip.ok { color: var(--gruen); border-color: #bfe3d0; background: #eefaf3; }

/* Inhalt */
.inhalt { max-width: 760px; margin: 0 auto; padding: 18px max(14px, env(safe-area-inset-left)) 40px; }
.inhalt.mit-leiste, .leiste ~ * { }
.inhalt { padding-bottom: calc(env(safe-area-inset-bottom) + 110px); }
h1 { font-size: 30px; letter-spacing: -.02em; margin: 8px 0 0; color: var(--tinte); }
.unter { margin: 2px 0 18px; color: var(--grau); }
.karte {
  display: block; width: 100%; text-align: left; background: var(--weiss); border: 0; border-radius: var(--radius);
  box-shadow: var(--schatten); padding: 18px 16px; margin: 0 0 14px; scroll-margin-top: 140px;
}
.karte h2 { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; font-size: 19px; color: var(--tinte); letter-spacing: -.01em; }
.nr { width: 28px; height: 28px; border-radius: 9px; background: var(--tinte); color: #fff; font-size: 15px; display: grid; place-items: center; }
h3 { margin: 22px 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .07em; color: var(--grau); }
h3:first-child { margin-top: 4px; }

/* Projektliste */
.projekt-karte { display: flex; align-items: center; gap: 14px; padding: 14px; }
.projekt-karte:active { transform: scale(.99); }
.pk-zahl { width: 62px; height: 62px; border-radius: 14px; background: #fdecef; color: var(--rot); display: grid; place-content: center; text-align: center; flex: none; }
.pk-zahl b { font-size: 24px; line-height: 1; }
.pk-zahl span { font-size: 11px; font-weight: 600; }
.pk-text { flex: 1; min-width: 0; display: grid; gap: 1px; }
.pk-text strong { font-size: 17px; color: var(--tinte); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pk-text span { color: var(--grau); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pk-text small { color: #93a0a8; }
.pk-pfeil { color: #b4bec5; display: grid; }
.leer { text-align: center; padding: 46px 22px; color: var(--grau); display: grid; gap: 6px; justify-items: center; }
.leer b { color: var(--tinte); font-size: 18px; }
.leer-bild { width: 84px; height: 84px; border-radius: 26px; background: #fff; box-shadow: var(--schatten); display: grid; place-items: center; color: var(--rot); margin-bottom: 10px; }
.leer-bild svg { width: 40px; height: 40px; }
.hinweis { display: block; width: 100%; text-align: left; border: 1px solid #f3c7cf; background: #fff5f6; color: #7a1323; border-radius: 14px; padding: 13px 15px; margin-bottom: 14px; }

/* Formular */
label { display: block; font-size: 13.5px; font-weight: 600; color: var(--grau); margin-bottom: 13px; }
label small { font-weight: 400; }
input, select, textarea {
  display: block; width: 100%; margin-top: 6px; padding: 13px 14px; min-height: 50px; border: 1.5px solid var(--linie); border-radius: 12px;
  background: #fbfcfd; color: var(--text); font-size: 17px; font-weight: 400; -webkit-appearance: none; appearance: none;
}
textarea { resize: vertical; line-height: 1.4; }
select {
  padding-right: 40px;
  background: #fbfcfd url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7780' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center / 20px;
}
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--tinte); background: #fff; box-shadow: 0 0 0 4px rgba(31, 42, 48, .08); }
.zwei { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mit-mikro { position: relative; }
.mit-mikro textarea { padding-right: 58px; }
.mikro { position: absolute; right: 7px; top: 13px; background: #eef1f3; color: var(--tinte); width: 42px; height: 42px; }
.mikro.hoert { background: var(--rot); color: #fff; animation: puls 1.1s infinite; }
@keyframes puls { 50% { box-shadow: 0 0 0 9px rgba(200, 16, 46, .18); } }
.klein-text { font-size: 13.5px; color: var(--grau); margin: 8px 0 0; }

/* Knöpfe */
.knopf {
  display: flex; align-items: center; justify-content: center; gap: 9px; width: 100%; min-height: 52px; padding: 12px 16px;
  border-radius: 14px; border: 1.5px solid var(--linie); background: #fff; color: var(--tinte); font-weight: 650; font-size: 16.5px;
  text-decoration: none; margin-top: 10px;
}
.knopf:active { background: #eef1f3; }
.knopf.haupt { background: var(--rot); border-color: var(--rot); color: #fff; box-shadow: 0 6px 16px rgba(200, 16, 46, .26); }
.knopf.haupt:active { background: var(--rot-dunkel); }
.knopf.schmal { width: auto; min-height: 42px; padding: 8px 18px; margin: 0; box-shadow: none; }
.knopf.schlicht { border-color: transparent; background: transparent; color: var(--grau); font-weight: 550; }
.knopf.gefahr { color: #b3261e; }
.knopf-reihe { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.knopf-reihe .knopf { margin-top: 0; }
.leiste {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 18;
  padding: 12px max(14px, env(safe-area-inset-left)) calc(env(safe-area-inset-bottom) + 12px);
  background: linear-gradient(rgba(242, 244, 246, 0), var(--grund) 34%);
}
.leiste .knopf { max-width: 732px; margin: 0 auto; min-height: 56px; font-size: 17.5px; }

/* Karte */
.karten-rahmen { position: relative; margin-top: 12px; border-radius: 14px; overflow: hidden; border: 1px solid var(--linie); background: #e8ecef; }
.karten-rahmen canvas { display: block; width: 100%; height: auto; touch-action: manipulation; }
.karten-leer { display: none; position: absolute; inset: 0; place-content: center; text-align: center; color: var(--grau); padding: 20px; font-size: 14.5px; }
.leer-karte .karten-leer { display: grid; }
.leer-karte .zoom { display: none; }
.zoom { position: absolute; right: 10px; top: 10px; display: grid; gap: 6px; }
.zoom button { width: 42px; height: 42px; border-radius: 11px; border: 0; background: #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, .22); font-size: 24px; line-height: 1; color: var(--tinte); }

/* Begleitschein und Proben */
.schein-liste { display: flex; gap: 10px; flex-wrap: wrap; }
.schein-bild { position: relative; width: 104px; height: 138px; border-radius: 12px; overflow: hidden; border: 1px solid var(--linie); background: #eef1f3; }
.schein-bild img { width: 100%; height: 100%; object-fit: cover; display: block; }
.schein-bild .rund { position: absolute; right: 5px; top: 5px; }
.probe-zeile {
  display: flex; align-items: center; gap: 13px; width: 100%; text-align: left; border: 1.5px solid var(--linie); background: #fbfcfd;
  border-radius: 14px; padding: 9px 10px 9px 9px; margin-bottom: 9px;
}
.probe-zeile:active { background: #eef1f3; }
.probe-zeile img { width: 66px; height: 66px; border-radius: 10px; object-fit: cover; background: #e3e8ec; flex: none; }
.probe-zeile div { flex: 1; min-width: 0; display: grid; }
.probe-zeile strong { color: var(--tinte); font-size: 16.5px; }
.probe-zeile span, .probe-zeile small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--grau); }
.probe-zeile span.pk-pfeil { overflow: visible; }
.probe-zeile em { font-style: normal; font-size: 12px; font-weight: 650; color: #9a5b00; background: #fff3d6; border-radius: 999px; padding: 3px 9px; white-space: nowrap; }

/* Unterschrift */
.unter-rahmen { position: relative; border: 1.5px dashed #b9c3ca; border-radius: 14px; overflow: hidden; background: #fff; }
.unter-rahmen canvas { display: block; width: 100%; height: auto; touch-action: none; }
.unter-rahmen span { position: absolute; inset: 0; display: grid; place-content: center; color: #a6b1b9; pointer-events: none; font-size: 15px; }
.unter-rahmen.hat span { display: none; }
.unter-rahmen.hat { border-style: solid; }

/* Blätter */
.blatt-hg { position: fixed; inset: 0; z-index: 40; background: rgba(15, 22, 27, .5); animation: ein .2s; }
.blatt {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; max-height: 94dvh; max-width: 760px; margin: 0 auto; display: flex; flex-direction: column;
  background: var(--grund); border-radius: 22px 22px 0 0; box-shadow: 0 -10px 40px rgba(0, 0, 0, .25); animation: hoch .26s cubic-bezier(.2, .8, .2, 1);
}
@keyframes ein { from { background: rgba(15, 22, 27, .2); } }
@keyframes hoch { from { transform: translateY(28px); } }
.blatt-kopf { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 16px 12px; border-bottom: 1px solid var(--linie); }
.blatt-kopf h2 { margin: 0; font-size: 21px; color: var(--tinte); }
.blatt-inhalt { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 16px 16px calc(env(safe-area-inset-bottom) + 24px); }
.blatt-inhalt.mitte { text-align: center; padding: 50px 16px 70px; color: var(--grau); }
.probe-bild { display: block; width: 100%; max-height: 42dvh; object-fit: contain; border-radius: 14px; background: #1a2227; margin-bottom: 12px; }
.blatt-inhalt .knopf-reihe { margin-bottom: 16px; }
.dreher { width: 44px; height: 44px; border-radius: 50%; border: 4px solid var(--linie); border-top-color: var(--rot); margin: 0 auto 16px; animation: dreh 0.8s linear infinite; }
@keyframes dreh { to { transform: rotate(360deg); } }
.pdf-karte { display: flex; align-items: center; gap: 14px; background: #fff; border-radius: 14px; padding: 14px; box-shadow: var(--schatten); margin-bottom: 6px; }
.pdf-karte div:last-child { display: grid; min-width: 0; }
.pdf-karte strong { color: var(--tinte); overflow-wrap: anywhere; }
.pdf-karte span { color: var(--grau); font-size: 14px; }
.pdf-zeichen { width: 52px; height: 62px; border-radius: 9px; background: var(--rot); color: #fff; font-weight: 800; font-size: 14px; display: grid; place-items: center; flex: none; }
.warnung { background: #fff6dc; border: 1px solid #f0d993; color: #6a4a00; border-radius: 14px; padding: 12px 14px; margin-top: 10px; font-size: 14.5px; }
.warnung ul { margin: 6px 0 0; padding-left: 20px; }
.logo-zeile { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.logo-zeile img, .logo-ersatz { width: 130px; height: 64px; object-fit: contain; background: #fff; border: 1px solid var(--linie); border-radius: 12px; padding: 8px; flex: none; }
.logo-ersatz { display: grid; place-content: center; text-align: center; line-height: 1.1; }
.logo-ersatz b { color: var(--rot); font-size: 22px; font-style: italic; }
.logo-ersatz span { font-size: 11px; font-weight: 700; }
.logo-zeile div:last-child { flex: 1; }
.logo-zeile .knopf { margin-top: 0; }

/* Unkenntlich machen */
.maler { position: fixed; inset: 0; z-index: 60; background: #10161a; color: #fff; display: flex; flex-direction: column; }
.maler-kopf, .maler-fuss { display: flex; align-items: center; gap: 10px; padding: calc(env(safe-area-inset-top) + 10px) 12px 10px; }
.maler-fuss { padding: 10px 12px calc(env(safe-area-inset-bottom) + 12px); }
.maler-kopf span { flex: 1; text-align: center; font-size: 13.5px; opacity: .8; }
.maler .knopf { width: auto; margin: 0; min-height: 44px; padding: 8px 14px; }
.maler-fuss .knopf { width: 100%; background: transparent; color: #fff; border-color: rgba(255, 255, 255, .3); }
.maler-flaeche { flex: 1; min-height: 0; display: grid; place-items: center; padding: 6px; }
.maler-flaeche canvas { max-width: 100%; max-height: 100%; touch-action: none; border-radius: 6px; }

/* Meldung */
#meldung {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 92px); transform: translate(-50%, 20px); z-index: 80; max-width: min(92vw, 520px);
  background: rgba(24, 33, 39, .96); color: #fff; padding: 12px 18px; border-radius: 14px; font-size: 15px; text-align: center;
  opacity: 0; pointer-events: none; transition: .25s; box-shadow: 0 8px 26px rgba(0, 0, 0, .3);
}
#meldung.an { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 700px) {
  .inhalt { padding-top: 26px; }
  .blatt { bottom: 4vh; border-radius: 22px; max-height: 90dvh; }
}
