:root {
  color-scheme: light;
  --pine: #1f4d3a;
  --pine-dark: #163a2b;
  --pine-soft: #dce8e1;
  --sand: #f7f4ec;
  --card: #ffffff;
  --ink: #1f2a25;
  --muted: #5c6a63;
  --line: #d9d6cb;
  --amber: #f2b24c;
  --red: #a4262c;
  --red-soft: #fbeaea;
  --amber-soft: #fdf3dd;
  --radius: 10px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--sand);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

h1 { font-size: 1.75rem; line-height: 1.2; margin: 0 0 1rem; }
h2 { font-size: 1.2rem; margin: 2rem 0 .75rem; }
.card h2:first-child { margin-top: 0; }
a { color: var(--pine); }
code { background: var(--pine-soft); padding: .1em .35em; border-radius: 4px; font-size: .92em; word-break: break-all; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }

/* Kopf der öffentlichen Seiten */
.hero { background: var(--pine); color: #fff; padding-top: 2rem; }
.hero-text { max-width: 600px; margin: 0 auto; padding: 0 16px 1rem; }
.hero-kicker { margin: 0; color: var(--amber); font-weight: 700; letter-spacing: .12em; font-size: .85rem; }
.hero h1 { margin: .15rem 0 0; font-size: 2rem; }
.hero-ridge { display: block; width: 100%; height: 56px; }
.ridge-back { fill: #2d6650; }
.ridge-front { fill: var(--sand); }

/* Navigation im Login-Bereich */
.topbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: .25rem 1.5rem;
  padding: .6rem 16px; background: var(--pine); color: #fff;
}
.brand { color: var(--amber); font-weight: 800; letter-spacing: .06em; text-decoration: none; }
.topnav { display: flex; flex-wrap: wrap; align-items: center; gap: .15rem 1rem; }
.topnav a, .linklike {
  color: #fff; background: none; border: 0; padding: .25rem 0; font: inherit; cursor: pointer; text-decoration: none;
}
.topnav a:hover, .linklike:hover { text-decoration: underline; }

/* Seitenaufbau */
.page { max-width: 1100px; margin: 0 auto; padding: 1.5rem 16px 3rem; }
.narrow { max-width: 600px; margin: 0 auto; padding-left: 16px; padding-right: 16px; padding-bottom: 3rem; }
.narrow.page { padding-top: 1.5rem; }
.intro { margin: .5rem 0 1.25rem; white-space: pre-line; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; }
.empty { text-align: center; color: var(--muted); }
.center { text-align: center; }
.right { text-align: right; }
.muted { color: var(--muted); font-weight: 400; }
.back { margin: 0 0 .5rem; }
.foot-link { text-align: center; margin-top: 1.5rem; font-size: .9rem; }
.heading-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin: 2rem 0 .75rem; }
.heading-row h2 { margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Formulare */
.field { margin: 0 0 1.25rem; padding: 0; border: 0; min-width: 0; }
.field label, .field legend { display: block; font-weight: 600; padding: 0; margin-bottom: .25rem; }
.req { color: var(--red); }
.help { margin: 0 0 .35rem; color: var(--muted); font-size: .9rem; font-weight: 400; }
.help.center { margin-top: .6rem; }
input:not([type=checkbox], [type=radio]), select, textarea {
  width: 100%; min-height: 44px; padding: .55rem .7rem; font: inherit; color: inherit;
  background: #fff; border: 1px solid #a9aca1; border-radius: 8px;
}
textarea { display: block; resize: vertical; }
.has-error input:not([type=checkbox], [type=radio]), .has-error select, .has-error textarea { border-color: var(--red); }
.error-text { margin: .3rem 0 0; color: var(--red); font-size: .9rem; font-weight: 600; }
.hp { position: absolute; left: -9999px; height: 1px; overflow: hidden; }

.choices { display: grid; gap: .4rem; }
.choices-row { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.field label.choice {
  display: flex; gap: .6rem; align-items: flex-start; font-weight: 400; margin: 0; cursor: pointer;
}
.choices .choice { padding: .6rem .75rem; border: 1px solid #a9aca1; border-radius: 8px; background: #fff; }
.choices .choice:has(input:checked) { border-color: var(--pine); background: var(--pine-soft); }
.choice input { width: 20px; height: 20px; margin: .1rem 0 0; flex: none; accent-color: var(--pine); }
.field-check .help { margin: .35rem 0 0 calc(20px + .6rem); }

/* Knöpfe */
.button {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px;
  padding: .5rem 1rem; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
  color: var(--pine); background: #fff; border: 1px solid var(--pine); border-radius: 8px;
}
.button:hover:not(:disabled) { background: var(--pine-soft); }
.button:disabled { opacity: .55; cursor: not-allowed; }
.button-primary { color: #fff; background: var(--pine); }
.button-primary:hover:not(:disabled) { background: var(--pine-dark); }
.button-danger { color: var(--red); border-color: var(--red); }
.button-danger:hover:not(:disabled) { background: var(--red-soft); }
.button-small { min-height: 36px; padding: .25rem .7rem; font-size: .9rem; }
.button-wide { width: 100%; }
.icon-button {
  width: 36px; height: 36px; font-size: 1rem; cursor: pointer; color: var(--pine);
  background: #fff; border: 1px solid var(--line); border-radius: 6px;
}
.icon-button:disabled { opacity: .35; cursor: default; }
.inline { display: inline; margin: 0; }
.actions { display: flex; flex-wrap: wrap; gap: .6rem; margin: 1.25rem 0; }
.actions-center { justify-content: center; }
.actions-tight { display: flex; flex-wrap: wrap; gap: .5rem; }

/* Meldungen */
.alert { padding: .7rem .9rem; margin: 0 0 1rem; border-radius: 8px; border-left: 4px solid; }
.alert-error { background: var(--red-soft); border-color: var(--red); }
.alert-ok { background: var(--pine-soft); border-color: var(--pine); }
.alert-warn { background: var(--amber-soft); border-color: var(--amber); }
.alert-info { background: #eef1ee; border-color: var(--muted); }

/* Zähler */
.counters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; max-width: 460px; }
.counter { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; }
.counter-value { display: block; font-size: 2.1rem; font-weight: 800; line-height: 1.1; color: var(--pine); font-variant-numeric: tabular-nums; }
.counter-label { color: var(--muted); font-size: .92rem; }
.counter-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.25rem; }
.counter-title { font-size: .95rem; margin: 0 0 .4rem; }

/* Tabellen */
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.data { width: 100%; border-collapse: collapse; font-size: .94rem; }
.data th, .data td { padding: .55rem .75rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.data th { background: var(--pine-soft); white-space: nowrap; font-weight: 600; }
.data tbody tr:last-child td { border-bottom: 0; }
.data td.num, .data th.num { text-align: right; font-variant-numeric: tabular-nums; }
.data td.right { text-align: right; }
.nowrap { white-space: nowrap; }
.badge {
  display: inline-block; padding: .05rem .5rem; font-size: .8rem; font-weight: 600; white-space: nowrap;
  color: var(--pine-dark); background: var(--pine-soft); border-radius: 999px;
}
.badge-leiter { background: var(--amber-soft); color: #6b4a08; }
.badge-off { background: #e9e8e2; color: var(--muted); }
.filter { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-bottom: 1rem; }
.filter select { width: auto; max-width: 100%; min-height: 36px; padding: .25rem .5rem; }
.filter label { font-weight: 600; }

/* Feldverwaltung und Jungscharen */
.field-list, .js-list { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.field-row, .js-row { padding: .75rem; border-bottom: 1px solid var(--line); }
.field-row:last-child, .js-row:last-child { border-bottom: 0; }
.field-row { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem .9rem; }
.field-row.is-inactive .field-info strong { color: var(--muted); }
.field-move { display: flex; gap: .25rem; }
.field-info { flex: 1 1 220px; min-width: 0; }
.field-meta { display: flex; flex-wrap: wrap; gap: .25rem .5rem; align-items: center; font-size: .86rem; color: var(--muted); margin-top: .1rem; }
.field-actions { display: flex; flex-wrap: wrap; gap: .4rem; }
.js-row { display: grid; gap: .5rem; }
.js-name { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.js-name input { flex: 1 1 220px; width: auto; min-height: 36px; font-weight: 600; }
.js-meta { color: var(--muted); font-size: .9rem; }

/* Bestätigung und QR-Code */
.summary { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: .35rem 1rem; margin: 1rem 0 1.5rem; }
.summary dt { color: var(--muted); }
.summary dd { margin: 0; overflow-wrap: anywhere; }
.qr { max-width: 320px; margin: 0 auto 1rem; }
.qr svg { display: block; width: 100%; height: auto; }

@media print {
  .topbar, .actions, .alert { display: none; }
  body { background: #fff; }
}
