:root {
  --grund: #f6f5f3;
  --flaeche: #ffffff;
  --text: #1d1d1f;
  --leise: #6b6b70;
  --linie: #e4e2de;
  --akzent: #1f2a44;
  --akzent-text: #ffffff;
  --gut: #1d7a46;
  --schlecht: #b3261e;
  --radius: 12px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --grund: #141416;
    --flaeche: #1f1f22;
    --text: #ececee;
    --leise: #9a9aa2;
    --linie: #333338;
    --akzent: #9fb4ff;
    --akzent-text: #10131c;
    --gut: #5fcf8f;
    --schlecht: #ff8a80;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--grund);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--akzent); }
.kopf {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: var(--flaeche); border-bottom: 1px solid var(--linie);
}
.marke { font-weight: 700; text-decoration: none; color: var(--text); }
.kopf nav { display: flex; gap: 4px; }
.kopf nav a {
  text-decoration: none; color: var(--leise); padding: 6px 10px; border-radius: 8px; font-size: 15px;
}
.kopf nav a[aria-current] { color: var(--text); background: var(--grund); font-weight: 600; }
main { max-width: 720px; margin: 0 auto; padding: 16px 16px 48px; }
h1 { font-size: 1.5rem; margin: 8px 0 16px; }
h2 { font-size: 1.1rem; margin: 24px 0 8px; }
.karte {
  background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius);
  padding: 16px; margin-bottom: 12px;
}
.kacheln { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.kachel {
  display: block; background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius);
  padding: 16px; text-decoration: none; color: var(--text);
}
.kachel strong { display: block; font-size: 1.05rem; }
.kachel span { color: var(--leise); font-size: 14px; }
label { display: block; font-weight: 600; font-size: 14px; margin: 12px 0 4px; }
input, select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--flaeche);
  border: 1px solid var(--linie); border-radius: 10px; padding: 10px 12px;
}
input[type=checkbox], input[type=radio] { width: auto; }
textarea { min-height: 80px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--akzent); outline-offset: 1px; }
.reihe { display: flex; gap: 10px; }
.reihe > * { flex: 1; min-width: 0; }
.hilfe { color: var(--leise); font-size: 13px; margin: 4px 0 0; }
.knopf, button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
  background: var(--akzent); color: var(--akzent-text); border: 0; border-radius: 10px;
  padding: 11px 16px; min-height: 44px;
}
.knopf.zweit, button.zweit { background: transparent; color: var(--akzent); border: 1px solid var(--linie); }
.knopf.gefahr, button.gefahr { background: transparent; color: var(--schlecht); border: 1px solid var(--linie); }
.knopf.breit, button.breit { width: 100%; margin-top: 16px; }
button:disabled { opacity: .5; cursor: progress; }
.wahl { display: flex; gap: 8px; flex-wrap: wrap; }
.wahl label {
  flex: 1; margin: 0; font-weight: 500; text-align: center; cursor: pointer;
  border: 1px solid var(--linie); border-radius: 10px; padding: 10px 6px; background: var(--flaeche);
}
.wahl input { position: absolute; opacity: 0; pointer-events: none; }
.wahl label:has(input:checked) { border-color: var(--akzent); outline: 1px solid var(--akzent); }
.liste { list-style: none; padding: 0; margin: 0; }
.liste li {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--linie);
}
.liste li:last-child { border-bottom: 0; }
.liste .titel { font-weight: 600; overflow-wrap: anywhere; }
.liste .info { color: var(--leise); font-size: 14px; }
.status { font-size: 13px; padding: 2px 8px; border-radius: 99px; background: var(--grund); white-space: nowrap; }
.status.fertig { color: var(--gut); }
.status.fehler { color: var(--schlecht); }
.meldung { padding: 10px 14px; border-radius: 10px; background: var(--flaeche); border: 1px solid var(--linie); }
.meldung.error { color: var(--schlecht); }
.meldung.success { color: var(--gut); }
.leise { color: var(--leise); }
pre.log {
  white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; max-height: 240px; overflow: auto;
  background: var(--grund); padding: 8px; border-radius: 8px;
}
.dateien a { display: block; margin: 8px 0; }
details summary { cursor: pointer; color: var(--akzent); margin: 12px 0 4px; }
.aktionen { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.aktionen form { margin: 0; }

/* PDF-Unterschrift */
.seite { position: relative; margin: 0 0 16px; border: 1px solid var(--linie); background: #fff; touch-action: pan-y; }
.seite img.seitenbild { display: block; width: 100%; height: auto; user-select: none; -webkit-user-drag: none; }
.seite .nr { position: absolute; top: 4px; left: 6px; font-size: 12px; color: #666; }
.stempel { position: absolute; cursor: grab; touch-action: none; outline: 1px dashed #3b6cff; }
.stempel img { display: block; width: 100%; pointer-events: none; }
.stempel .weg {
  position: absolute; top: -14px; right: -14px; width: 28px; height: 28px; min-height: 0; padding: 0;
  border-radius: 50%; background: #b3261e; color: #fff; font-size: 16px; line-height: 1;
}
.leiste {
  position: sticky; bottom: 0; background: var(--flaeche); border-top: 1px solid var(--linie);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); margin: 0 -16px;
}
.unterschriften img { max-height: 48px; max-width: 160px; background: #fff; border-radius: 6px; padding: 4px; }

/* Honorarnote */
.position { border-top: 1px solid var(--linie); padding-top: 8px; margin-top: 8px; }
.summe { font-size: 1.2rem; font-weight: 700; text-align: right; margin-top: 12px; }
