:root {
  --accent: #d2232a;
  --accent-dark: #a91b21;
  --teal: #4d6366;
  --bg: #f3f5f6;
  --card: #ffffff;
  --line: #d5dcde;
  --text: #1c2527;
  --muted: #5f6c6f;
  --err: #b3261e;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 19px/1.5 -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.top { display: flex; justify-content: center; padding: 18px 16px 4px; }
.logo { height: 64px; max-width: 80%; object-fit: contain; }
main { max-width: 860px; margin: 0 auto; padding: 12px 16px 24px; }
main.wide { max-width: 1200px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 24px 26px; box-shadow: 0 2px 10px rgba(0,0,0,.04); }
.card.narrow { max-width: 420px; margin: 40px auto; }
.card.center { text-align: center; padding: 40px 28px; }
h1 { font-size: 1.9rem; margin: 0 0 12px; color: var(--teal); }
h2 { font-size: 1.5rem; margin: 6px 0 18px; color: var(--teal); }
h3 { font-size: 1.1rem; margin: 20px 0 8px; }
.lead { font-size: 1.15rem; color: var(--muted); max-width: 640px; margin: 0 auto 28px; }
.para { margin: 0 0 14px; text-align: left; }
.small { color: var(--muted); font-size: .9rem; }
.bullets { margin: 0 0 14px; padding-left: 22px; }
.bullets li { margin-bottom: 6px; }
.loading { text-align: center; color: var(--muted); }

/* Fortschritt */
.progress { margin-bottom: 8px; color: var(--muted); font-size: .85rem; }
.progress .bar { height: 8px; background: #e4e9ea; border-radius: 6px; overflow: hidden; margin-bottom: 4px; }
.progress .fill { height: 100%; background: var(--accent); border-radius: 6px; transition: width .25s; }

/* Felder */
.fields { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 700px) { .fields { grid-template-columns: 1fr 1fr; } }
.field label { display: block; font-weight: 600; margin-bottom: 5px; font-size: .95rem; }
.field .req { color: var(--accent); }
input[type=text], input[type=email], input[type=tel], input[type=date], input[type=search], input[type=password], select {
  width: 100%; min-height: 56px; padding: 10px 14px; font: inherit; color: var(--text);
  background: #fff; border: 2px solid var(--line); border-radius: 12px; appearance: none; -webkit-appearance: none;
}
select {
  background-image: linear-gradient(45deg, transparent 50%, var(--teal) 50%), linear-gradient(135deg, var(--teal) 50%, transparent 50%);
  background-position: calc(100% - 22px) 50%, calc(100% - 16px) 50%;
  background-size: 6px 6px, 6px 6px; background-repeat: no-repeat; padding-right: 40px;
}
select:disabled { background-color: #eef1f2; color: var(--muted); }
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(210,35,42,.15); }
.other { margin-top: 8px; }
.other[hidden] { display: none; }
.err { color: var(--err); font-size: .9rem; min-height: 0; margin-top: 4px; font-weight: 600; }
.has-error input, .has-error select { border-color: var(--err); }
.has-error .sig-box { border-color: var(--err); }
.errbox { background: #fdeceb; color: var(--err); border: 1px solid #f3c1be; padding: 12px 14px; border-radius: 10px; margin: 12px 0; }
.errbox[hidden] { display: none; }

/* Auswahl */
.choice { margin: 6px 0 16px; }
.opt {
  display: flex; align-items: center; gap: 14px; min-height: 60px; padding: 8px 14px; margin: 6px 0;
  border: 2px solid var(--line); border-radius: 12px; cursor: pointer; background: #fff;
}
.opt:has(input:checked) { border-color: var(--accent); background: #fff5f5; }
.opt input { width: 30px; height: 30px; flex: none; accent-color: var(--accent); margin: 0; }
.opt .txt { flex: 1; }
.has-error .opt { border-color: var(--err); }

/* Unterschrift */
.sig { margin: 18px 0 8px; }
.sig-label { font-weight: 700; margin-bottom: 6px; }
.sig-box { position: relative; border: 2px dashed var(--teal); border-radius: 12px; background: #fcfdfd; height: 220px; touch-action: none; }
.sig-box.signed { border-style: solid; }
.sig-canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
.sig-hint { position: absolute; left: 16px; bottom: 12px; right: 16px; color: #9aa6a8; font-size: .9rem; pointer-events: none; border-top: 1px solid #c9d1d3; padding-top: 6px; }
.sig-box.signed .sig-hint { opacity: .35; }
.sig-tools { display: flex; gap: 10px; margin-top: 8px; flex-wrap: wrap; }

/* Knöpfe */
.btn {
  display: inline-block; min-height: 56px; padding: 12px 26px; font: inherit; font-weight: 600; text-align: center; text-decoration: none;
  color: var(--teal); background: #fff; border: 2px solid var(--teal); border-radius: 12px; cursor: pointer;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:active { background: var(--accent-dark); }
.btn.big { min-height: 68px; padding: 16px 48px; font-size: 1.25rem; }
.btn.small { min-height: 40px; padding: 6px 14px; font-size: .9rem; border-width: 1px; }
.btn.danger { color: var(--err); border-color: var(--err); }
.btn:disabled { opacity: .6; }
.nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 26px; }

/* Zusammenfassung */
.sum { display: grid; grid-template-columns: 1fr; margin: 0 0 8px; }
@media (min-width: 700px) { .sum { grid-template-columns: 40% 60%; } }
.sum dt { color: var(--muted); font-size: .9rem; padding-top: 8px; }
.sum dd { margin: 0; padding: 8px 0 8px; border-bottom: 1px solid #edf0f1; font-weight: 600; }

.check { width: 84px; height: 84px; line-height: 84px; margin: 0 auto 12px; border-radius: 50%; background: #e6f4ea; color: #1e7b34; font-size: 3rem; }

.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px; }
.dialog { background: #fff; border-radius: 16px; padding: 28px; max-width: 440px; text-align: center; }

.ver { text-align: center; color: #9aa6a8; font-size: .75rem; padding: 6px 0 14px; }

/* Admin */
.admin { font-size: 16px; }
.admin-head { display: flex; justify-content: space-between; align-items: center; }
.filter { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.filter input, .filter select { width: auto; min-height: 40px; flex: 1 1 220px; }
.list { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.list th, .list td { text-align: left; padding: 10px 12px; border-bottom: 1px solid #edf0f1; vertical-align: middle; }
.list th { background: #eef2f3; font-size: .85rem; color: var(--muted); }
.list .files a { margin-right: 12px; color: var(--accent); font-weight: 600; }
.list .acts { display: flex; gap: 6px; flex-wrap: wrap; }
.list .acts form { margin: 0; }
.list .empty { text-align: center; color: var(--muted); padding: 30px; }
.badge { padding: 3px 10px; border-radius: 20px; font-size: .8rem; font-weight: 700; }
.badge.new { background: #fff1d6; color: #8a5a00; }
.badge.done { background: #e6f4ea; color: #1e7b34; }

/* Tablet: Wartebildschirm und PDF-Ansicht */
.waiting { margin-top: 8vh; }
.dots { display: flex; gap: 12px; justify-content: center; margin-top: 8px; }
.dots span { width: 14px; height: 14px; border-radius: 50%; background: var(--teal); opacity: .25; animation: pulse 1.4s infinite ease-in-out; }
.dots span:nth-child(2) { animation-delay: .2s; }
.dots span:nth-child(3) { animation-delay: .4s; }
@keyframes pulse { 0%, 80%, 100% { opacity: .2; transform: scale(.8); } 40% { opacity: 1; transform: scale(1.1); } }
.pages { margin: 14px 0; }
.pg { position: relative; width: 100%; background: #fff; border: 1px solid var(--line); box-shadow: 0 2px 10px rgba(0,0,0,.06); margin: 0 0 14px; }
.pdfcanvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.pgno { position: absolute; right: 8px; bottom: 6px; font-size: .7rem; color: #8a9799; background: rgba(255,255,255,.85); padding: 1px 6px; border-radius: 6px; }
#confirm[hidden] { display: none; }

/* Admin: Tablets */
.head-links { display: flex; gap: 8px; align-items: center; }
.head-links form { margin: 0; }
.tablet-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; margin: 14px 0; }
.tcard h3 { margin: 0; }
.thead { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.assigned { background: #f2f7f8; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 8px 0; display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.row { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; align-items: center; }
.row select { width: auto; min-height: 40px; flex: 1 1 180px; font-size: 16px; }
.tcard details { margin-top: 10px; }
.tcard summary { cursor: pointer; color: var(--teal); font-weight: 600; font-size: .9rem; }
.tcard input[type=text] { min-height: 38px; font-size: 14px; }
.badge.off { background: #eceff0; color: #5f6c6f; margin-left: 8px; }
.inbox { margin-top: 18px; }
.inbox .list { margin-top: 8px; }
.upload { display: flex; gap: 10px; align-items: center; margin-top: 14px; flex-wrap: wrap; }
.toast { position: sticky; top: 8px; z-index: 20; background: #e6f4ea; color: #1e7b34; border: 1px solid #b9dcc2; padding: 10px 14px; border-radius: 10px; margin: 8px 0; font-weight: 600; }
.toast.bad { background: #fdeceb; color: var(--err); border-color: #f3c1be; }
.toast[hidden] { display: none; }
.tname { font-weight: 400; color: var(--muted); }
#addtablet { margin: 10px 0 0; }
#addtablet input { max-width: 380px; min-height: 40px; font-size: 16px; }
.row.idle label { margin: 0; }
.subfield { margin: -4px 0 10px 42px; }
.subfield[hidden] { display: none; }
.subfield input { width: 100%; }

/* E-Mail-Einstellungen / Versandstatus */
.badge.err{background:#fde8e8;color:#9b1c1c}
td.mailst form{display:inline-block;margin-top:4px}
td.mailst .small{display:block;max-width:240px}
.mailform{display:grid;gap:12px;max-width:760px}
.mailform label{display:grid;gap:4px;font-weight:600}
.mailform label small{font-weight:400;color:#555}
.mailform input[type=text],.mailform input[type=password],.mailform input[type=number],.mailform input[type=email],.mailform select,.mailform textarea{font:inherit;padding:8px;border:1px solid #bbb;border-radius:6px;width:100%;box-sizing:border-box}
.mailform .row2{display:grid;grid-template-columns:2fr 1fr 1fr;gap:12px}
.mailform .chk{display:flex;gap:8px;align-items:center;font-weight:600}
.mailform .btns{display:flex;gap:10px;flex-wrap:wrap;align-items:center}
.mailmsg{padding:8px 12px;border-radius:6px}
.mailmsg.ok{background:#e6f4ea;color:#14532d}.mailmsg.bad{background:#fde8e8;color:#9b1c1c}
.mailform input,.mailform select,.mailform textarea{font-weight:400;min-height:44px}
.mailform textarea{min-height:0}
.mailform .chk input{min-height:0;width:20px;height:20px}
