/* Mobile first: Basis für ~375 px, Touch-Ziele mindestens 44 px, nichts hängt von Hover ab. */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1a1d21;
  --muted: #5f6873;
  --border: #d5d9de;
  --primary: #1f6feb;
  --primary-text: #ffffff;
  --danger-bg: #fdecec;
  --danger-text: #8a1c1c;
  --radius: 12px;
  --touch: 48px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111418;
    --surface: #1b1f24;
    --text: #e8eaed;
    --muted: #9aa3ad;
    --border: #2f353d;
    --primary: #4c8dff;
    --primary-text: #0b0d10;
    --danger-bg: #3a1717;
    --danger-text: #ffb4b4;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.45;
}

h1 { font-size: 1.5rem; margin: 0 0 .75rem; }

a { color: var(--primary); }

.topbar {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 56px;
  padding: env(safe-area-inset-top) 1rem 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.topbar form { margin: 0; }

.brand {
  font-weight: 700;
  font-size: 1.125rem;
  color: var(--text);
  text-decoration: none;
  min-height: var(--touch);
  display: inline-flex;
  align-items: center;
}

.container {
  max-width: 40rem;
  margin: 0 auto;
  padding: 1.25rem 1rem calc(2rem + env(safe-area-inset-bottom));
}

.stack > * + * { margin-top: 1.25rem; }

/* Das versteckte CSRF-Feld zählt nicht als Abstandsträger. */
.stack > input[type="hidden"] + * { margin-top: 0; }

.muted { color: var(--muted); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--touch);
  min-width: var(--touch);
  padding: 0 1.25rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.btn-primary {
  width: 100%;
  background: var(--primary);
  color: var(--primary-text);
}

.btn:disabled { opacity: .4; cursor: default; }

.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}

.btn:focus-visible,
input:focus-visible,
.choice:focus-within {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}

.field { display: block; }

.field > span {
  display: block;
  margin-bottom: .375rem;
  font-weight: 600;
}

input[type="password"],
input[type="text"],
input[type="number"],
select,
textarea {
  width: 100%;
  min-height: var(--touch);
  padding: .5rem .875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 1.25rem; /* >= 16 px verhindert Auto-Zoom in iOS */
}

.choices {
  border: 0;
  margin-inline: 0;
  margin-bottom: 0;
  padding: 0;
  display: grid;
  gap: .625rem;
}

.choices legend {
  font-weight: 600;
  margin-bottom: .375rem;
  padding: 0;
}

.choice {
  display: flex;
  align-items: center;
  gap: .75rem;
  min-height: 56px;
  padding: 0 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
}

.choice input { width: 1.375rem; height: 1.375rem; margin: 0; accent-color: var(--primary); }

.choice:has(input:checked) { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }

.alert {
  padding: .75rem 1rem;
  border-radius: var(--radius);
  background: var(--danger-bg);
  color: var(--danger-text);
}

.tiles {
  display: grid;
  gap: .75rem;
  margin-top: 1.25rem;
}

.tile {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 72px;
  padding: .75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
}

.tile small { color: var(--muted); }

.tile-disabled { opacity: .6; }

@media (min-width: 40rem) {
  .tiles { grid-template-columns: repeat(2, 1fr); }
}

textarea { font-size: 1.0625rem; line-height: 1.4; resize: vertical; }

select { appearance: auto; }

.field small { display: block; margin-top: .25rem; }

.field-error {
  display: block;
  margin-top: .375rem;
  color: var(--danger-text);
  font-weight: 600;
}

.back {
  display: inline-flex;
  align-items: center;
  min-height: var(--touch);
  margin-bottom: .25rem;
  text-decoration: none;
}

.card {
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.card > summary {
  min-height: var(--touch);
  display: flex;
  align-items: center;
  font-weight: 600;
  cursor: pointer;
}

details.card[open] > summary { margin-bottom: .75rem; }

details.card form + form { margin-top: .75rem; }

.notice {
  padding: .75rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
}

.badge {
  display: inline-block;
  padding: .05rem .5rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: .8125rem;
  font-weight: 600;
  vertical-align: middle;
}

.list { list-style: none; margin: 1rem 0; padding: 0; display: grid; gap: .5rem; }

.list-item {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 60px;
  padding: .5rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
}

.list-item small { color: var(--muted); }

.plan-items { list-style: none; margin: 1rem 0; padding: 0; }

.plan-item { scroll-margin-top: 72px; }

.plan-item:target { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }

.plan-item-head { display: flex; gap: .75rem; align-items: baseline; }

.plan-item-no {
  flex: none;
  min-width: 1.75rem;
  color: var(--muted);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.targets {
  list-style: none;
  margin: .5rem 0 0;
  padding: 0 0 0 2.5rem;
  font-variant-numeric: tabular-nums;
}

.targets span { display: inline-block; min-width: 5.5rem; color: var(--muted); }

.note { margin: .5rem 0 0 2.5rem; white-space: pre-line; }

.actions { display: flex; gap: .5rem; margin-top: .75rem; }

.actions form { margin: 0; }

.actions .btn { padding: 0 .875rem; }

.actions a.btn { margin-left: auto; }

.target-form legend { font-weight: 700; padding: 0 .25rem; }

.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: .625rem; }

.grid-3 .field > span { font-size: .9375rem; }

.danger-zone {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

h2 { font-size: 1.1875rem; margin: 1.5rem 0 .5rem; }

.card h2 { margin-top: 0; }

h3 { font-size: 1.0625rem; margin: 0 0 .25rem; }

.card-link { margin-top: 1rem; }

.choices.compact { grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr)); }

.choices.compact legend { grid-column: 1 / -1; }

.choices.compact .choice { min-height: var(--touch); }

.button-row { display: grid; gap: .5rem; margin-top: .75rem; }

.gen-form + .gen-form {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.gen-form .muted { margin: 0 0 .5rem; }

.ok {
  padding: .75rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  font-weight: 600;
}

.issues { margin: .5rem 0 0; padding-left: 1.25rem; }

.steps { list-style: none; margin: .5rem 0 1rem; padding: 0; }

.step { margin-top: .5rem; padding: .75rem 1rem; scroll-margin-top: 72px; }

.step:target { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }

.step-group {
  margin-top: 1rem;
  color: var(--muted);
  font-size: .875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.step-text { display: flex; flex-wrap: wrap; gap: .25rem .5rem; align-items: baseline; }

.step-no {
  min-width: 1.5rem;
  color: var(--muted);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.step-line { padding: .25rem 0; }

.actions .push-right { margin-left: auto; }

/* Avatare, Einstellungen, Footer */

.avatar {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  object-fit: cover;
}

.avatar-sm { width: 36px; height: 36px; font-size: 1rem; }

.avatar-md { width: 40px; height: 40px; font-size: 1.0625rem; }

.avatar-lg { width: 64px; height: 64px; font-size: 1.75rem; }

.avatar-initial {
  background: var(--primary);
  color: var(--primary-text);
  font-weight: 700;
  line-height: 1;
}

.settings-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: var(--touch);
  min-height: var(--touch);
  border-radius: 50%;
  margin-right: -4px;
}

.settings-link:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }

.choice .avatar { margin: -.25rem 0; }

.profile { display: flex; align-items: center; gap: 1rem; margin: .5rem 0 1rem; }

.profile small { display: block; }

.footer {
  max-width: 40rem;
  margin: 0 auto;
  padding: 1.5rem 1rem calc(1.5rem + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
}

.footer form { margin: 0; }

.version { color: var(--muted); }

/* Satz-Vorgaben */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.note-text { white-space: pre-line; }

.person-sets legend { font-weight: 700; padding: 0 .25rem; }

.set-row { padding: .75rem 0; border-bottom: 1px solid var(--border); }

.set-row:last-of-type { border-bottom: 0; }

.set-main {
  display: grid;
  grid-template-columns: 4.25rem 1fr 1fr;
  gap: .5rem;
  align-items: end;
}

.set-no { font-weight: 700; padding-bottom: .75rem; }

.field.compact > span { font-size: .875rem; margin-bottom: .25rem; }

.set-details { margin-top: .5rem; }

.set-details > summary {
  min-height: var(--touch);
  display: flex;
  align-items: center;
  color: var(--primary);
  cursor: pointer;
}

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: .625rem; }

.check {
  display: flex;
  align-items: center;
  gap: .75rem;
  min-height: var(--touch);
  margin-top: .5rem;
}

.check input { width: 1.375rem; height: 1.375rem; margin: 0; accent-color: var(--primary); }

.button-row.two { grid-template-columns: 1fr 1fr; }

.person-notes { border: 0; margin: 0; padding: 0; }

.person-notes + .person-notes { padding-top: 1rem; border-top: 1px solid var(--border); }

.person-notes legend { font-weight: 700; padding: 0; margin-bottom: .5rem; }

.person-notes .field + .field { margin-top: .75rem; }

.targets li { display: flex; gap: .5rem; }

.targets .target-lines { min-width: 0; color: var(--text); }
