:root {
  --paper: #f3efe6;
  --ink: #1b1b1b;
  --muted: #6e675c;
  --line: #e4d9c6;
  --card: #fffcf7;
  --gold: #9a8458;
  --gold-soft: #f4ead6;
  --danger: #8d2f2f;
  --ok: #1d6b45;
  --shadow: 0 10px 30px rgba(40, 32, 16, 0.06);
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.45;
}

button, input, select, textarea { font: inherit; color: inherit; }

button { cursor: pointer; }

img { max-width: 100%; }

.boot { padding: 3rem 1.2rem; text-align: center; color: var(--muted); }

.shell { max-width: 860px; margin: 0 auto; padding: 0 1rem 2rem; }

.top {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: calc(0.7rem + env(safe-area-inset-top)) 0 0.7rem;
  background: rgba(243, 239, 230, 0.94);
  backdrop-filter: blur(8px);
}

.top img.mark { width: 74px; height: auto; background: white; border-radius: 6px; }

.top h1 { font-size: 1.15rem; margin: 0; font-weight: 650; letter-spacing: 0.01em; }

.top p { margin: 0; color: var(--muted); font-size: 0.85rem; }

.top .grow { flex: 1; min-width: 0; }

.top button.link, button.link {
  background: none;
  border: 0;
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 0.4rem;
}

.save-state { color: var(--muted); font-size: 0.78rem; white-space: nowrap; }

.lead { margin: 0.2rem 0 1rem; color: var(--muted); }

.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem; margin-bottom: 1.2rem; }

.actions button, .primary, .ghost, .danger {
  min-height: 52px;
  border-radius: 14px;
  padding: 0.75rem 1rem;
  border: 1px solid var(--ink);
}

.primary, .actions button.solid {
  background: var(--ink);
  color: white;
  border-color: var(--ink);
}

.ghost { background: var(--card); }

.danger { background: white; color: var(--danger); border-color: #e4c4c4; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0.9rem;
  box-shadow: var(--shadow);
  margin-bottom: 0.8rem;
}

.card h2, .block h2 { font-size: 1rem; margin: 0 0 0.35rem; }

.row-between, .list-card, .key-row, .check, .person-line {
  display: flex;
  gap: 0.6rem;
  align-items: center;
}

.list-card {
  justify-content: space-between;
  align-items: stretch;
  text-align: left;
  width: 100%;
}

.list-card button.open {
  flex: 1;
  text-align: left;
  background: none;
  border: 0;
  padding: 0;
}

.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 0.1rem 0.55rem;
  font-size: 0.75rem;
  background: var(--gold-soft);
  color: #5c4a28;
}

.badge.entwurf { background: #ece7dc; color: var(--muted); }
.badge.bereit { background: var(--ink); color: white; }
.badge.gesendet { background: #e5f2ea; color: var(--ok); }

.filters { display: flex; gap: 0.4rem; margin: 0.4rem 0 0.8rem; }

.filters button, .chip, .yn button, .choice {
  border: 1px solid var(--line);
  background: white;
  border-radius: 999px;
  min-height: 40px;
  padding: 0.35rem 0.8rem;
}

.filters button.on, .chip.on, .yn button.on, .choice.on {
  background: var(--ink);
  color: white;
  border-color: var(--ink);
}

.chip .n {
  display: inline-block;
  min-width: 1.2rem;
  margin-left: 0.25rem;
  font-size: 0.78rem;
}

.steps { display: flex; gap: 0.35rem; margin: 0.2rem 0 0.8rem; }

.steps button {
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: white;
  padding: 0;
}

.steps button.on { background: var(--gold); color: white; border-color: var(--gold); }
.steps button.done { border-color: var(--ink); }

.step-title { margin: 0 0 0.8rem; font-size: 1.35rem; }

label, .field { display: block; margin: 0 0 0.75rem; font-size: 0.92rem; }

input, select, textarea {
  width: 100%;
  margin-top: 0.28rem;
  padding: 0.75rem 0.8rem;
  border-radius: 12px;
  border: 1px solid #ddd4c4;
  background: white;
  font-size: 16px;
}

textarea { min-height: 120px; resize: vertical; }

.choices { display: grid; gap: 0.6rem; }

.choice {
  border-radius: 16px;
  text-align: left;
  min-height: 72px;
  padding: 0.9rem 1rem;
  width: 100%;
}

.choice strong { display: block; font-size: 1.05rem; }
.choice span { color: var(--muted); font-size: 0.9rem; }
.choice.on span { color: #efe8dc; }

.hint { color: var(--muted); font-size: 0.92rem; margin-top: 0; }

.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.4rem 0 0.8rem; }

.check {
  justify-content: space-between;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--line);
}

.check p { margin: 0; flex: 1; }

.yn { display: flex; gap: 0.35rem; }

.yn button { min-width: 64px; }

.key-row { align-items: end; }
.key-row .field { flex: 1; margin: 0; }
.key-row .narrow { flex: 0 0 4.5rem; }

.icon-x {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: white;
  margin-bottom: 2px;
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }

.foto-block { margin-top: 0.8rem; }
.thumbs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.6rem; }
.thumb { background: white; border: 1px solid var(--line); border-radius: 12px; padding: 0.4rem; }
.thumb img { width: 100%; height: 140px; object-fit: cover; border-radius: 8px; display: block; }
.thumb input { margin-top: 0.35rem; }

.pad-wrap { margin-bottom: 1rem; }
canvas.pad {
  width: 100%;
  height: 190px;
  background: white;
  border: 1px dashed #c9bfae;
  border-radius: 14px;
  touch-action: none;
  display: block;
}
.sig-state { color: var(--ok); font-size: 0.85rem; min-height: 1.2rem; }

.dock {
  position: sticky;
  bottom: 0;
  display: flex;
  gap: 0.6rem;
  padding: 0.7rem 0 calc(0.7rem + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, var(--paper) 20%);
}

.dock button { flex: 1; }

.summary { margin: 0; padding-left: 1.1rem; }
.summary li { margin: 0.2rem 0; }
.missing { background: #f8efe8; border-radius: 12px; padding: 0.7rem 0.9rem; }
.missing strong { color: var(--danger); }

.made {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.82rem;
  margin: 1.4rem 0 0.4rem;
}
.made .heart { color: #c0392b; }
.made img { height: 16px; width: auto; }

.toast {
  position: fixed;
  z-index: 30;
  left: 50%;
  transform: translateX(-50%);
  top: calc(10px + env(safe-area-inset-top));
  width: min(520px, calc(100% - 1.5rem));
  background: var(--ink);
  color: white;
  border-radius: 14px;
  padding: 0.8rem 1rem;
  box-shadow: var(--shadow);
}

.gate-body { min-height: 100vh; display: grid; place-items: center; padding: 1.2rem; }
.gate { width: min(440px, 100%); }
.gate .logo { width: 140px; background: white; border-radius: 10px; }
.gate h1 { margin: 0.8rem 0 0.3rem; }
.warn { color: var(--danger); }

.person-line { justify-content: space-between; margin-bottom: 0.55rem; }
.stack { display: grid; gap: 0.7rem; }

@media (max-width: 640px) {
  .actions { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .key-row { flex-wrap: wrap; }
}

@media (min-width: 800px) {
  .thumbs { grid-template-columns: repeat(3, 1fr); }
  .choices.two { grid-template-columns: 1fr 1fr; }
}
