:root { color-scheme: light; }
body { font-family: system-ui, -apple-system, sans-serif; margin: 0; color: #1c2430; background: #f6f8fb; line-height: 1.5; }
header { background: #16324f; color: #fff; padding: 1rem 1.5rem; }
header h1 { margin: 0 0 .5rem; font-size: 1.2rem; }
nav a { color: #d8e8ff; margin-right: 1rem; text-decoration: none; }
nav a:hover { text-decoration: underline; }
nav .user { float: right; margin-right: 1rem; }
nav .link { background: none; border: none; color: #d8e8ff; cursor: pointer; padding: 0; font: inherit; text-decoration: underline; }
main { max-width: 80rem; margin: 1.5rem auto; background: #fff; padding: 1.5rem 2rem; border-radius: 8px; box-shadow: 0 1px 4px #0001; }
h2 { margin-top: 0; }
input, select { padding: .4rem .5rem; max-width: 100%; border: 1px solid #aab4c2; border-radius: 4px; }
label { display: inline-block; margin: .4rem 0; }
button { background: #1d6fb8; color: #fff; border: 0; border-radius: 4px; padding: .5rem 1rem; cursor: pointer; font: inherit; }
button:hover { background: #155a97; }
form { margin: .5rem 0; }
form.inline { display: inline; }
fieldset { border: 1px solid #ccd4de; border-radius: 4px; margin: .5rem 0 1rem; }
ul { padding-left: 1.4rem; }
li { margin: .25rem 0; }
.error { color: #a11212; background: #fdeaea; padding: .6rem; border-radius: 4px; }
.ok { color: #17632a; background: #e8f7ec; padding: .6rem; border-radius: 4px; }
.badge { font-size: .8rem; border-radius: 1rem; padding: .1rem .5rem; background: #e5e9ef; }
.badge.aktiv { background: #d9f0dd; color: #17632a; }
.badge.archiviert { background: #ece1cf; color: #6b4c12; }
code { background: #eef1f5; padding: .2rem .4rem; border-radius: 3px; word-break: break-all; }

/* Helferbereich */
header .site { margin: 0; font-size: .85rem; opacity: .8; }
header .meta { margin: .25rem 0 0; color: #d8e8ff; }
main.helper {
  box-sizing: border-box;
  width: fit-content;
  max-width: calc(100% - 2rem);
  margin: 1rem auto 2.5rem;
}
/* Fließtexte bestimmen nicht die Seitenbreite; die Listen dürfen mitwachsen. */
main.helper > p, main.helper > .readonly-banner, main.helper > details { max-width: 48rem; }
main.helper h2 { font-size: 1.15rem; border-bottom: 2px solid #e3e8ee; padding-bottom: .25rem; margin: 1.6rem 0 .35rem; }
main.helper h2 + .hint { margin: 0 0 .2rem; }
/* Ein Block = Gliederung links, Einträge rechts. Beide Spalten sind nur so
   breit wie ihr Inhalt. Alle Blöcke eines Abschnitts teilen sich dieselben
   Spalten, damit Menge, Einheit und Symbole untereinander stehen. */
.block-list { display: grid; grid-template-columns: max-content max-content; column-gap: 1.5rem; justify-content: start; }
.entry-block, .item-grid { display: contents; }
.item-head { grid-column: 1; max-width: 15rem; padding: .8rem 2rem .9rem 0; position: relative; border-top: 1px solid #d9e0e8; }
.item-head h3 { margin: 0; font-size: 1.12rem; font-weight: 700; color: #12293f; }
.item-head .meta { margin: .1rem 0 0; color: #5a6675; font-size: .92rem; overflow-wrap: anywhere; }
.item-entries {
  grid-column: 2;
  display: grid; grid-template-columns: minmax(0, 1fr) 2.5rem 6.5rem 2rem 2rem;
  column-gap: .6rem; align-content: start;
  padding: .8rem 0 .9rem .8rem;
  border-left: 2px solid #eef1f5; border-top: 1px solid #d9e0e8;
}
.block-list > :nth-child(-n + 2) { border-top: 0; padding-top: .2rem; }
/* Zusagen sind das Ergebnis des Blocks: grüne Kante hebt sie von offenen
   Bedarfen ab. Fünf echte Spalten (Name | Menge | Einheit | Stift | X) halten
   Namen, Zahlen und Symbole über alle Zeilen und Blöcke hinweg ausgerichtet. */
.entry {
  grid-column: 1 / -1;
  display: grid; grid-template-columns: minmax(0, 1fr) 2.5rem 6.5rem 2rem 2rem;
  column-gap: .6rem; align-items: center;
  padding: .4rem .5rem .4rem .65rem;
  border-left: 3px solid #b7dcc0; border-radius: 0 4px 4px 0; background: #fbfdfb;
}
.entry + .entry { border-top: 1px dotted #eef1f5; }
.entry.editing { grid-template-columns: 1fr; padding-right: .5rem; background: #f2f7fd; border-left-color: #a9c6e2; }
.entry .who-line { min-width: 0; overflow-wrap: anywhere; }
.entry .amount { text-align: right; font-variant-numeric: tabular-nums; }
.entry .unit { text-align: left; overflow-wrap: anywhere; }
.entry .who { font-weight: 600; }
.comment { color: #5a6675; }
.entry-form { display: flex; gap: .35rem; align-items: center; margin: 0; }
.entry-form input[type="number"] { width: 4.5rem; }
.entry-form input[type="text"] { width: 12rem; }
/* Symbolaktionen: Stift (ändern) und rotes X (absagen), mindestens 2 rem groß. */
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2rem; height: 2rem; border: 1px solid #ccd4de; border-radius: 4px;
  background: #fff; font-size: 1rem; line-height: 1; text-decoration: none;
}
.icon-btn.edit { color: #1d6fb8; border-color: #a9c6e2; }
.icon-btn.edit:hover { background: #1d6fb8; border-color: #1d6fb8; color: #fff; }
.icon-btn.cancel { color: #a11212; border-color: #d8a0a0; }
.icon-btn.cancel:hover { background: #a11212; border-color: #a11212; color: #fff; }
/* Grünes Plus: öffnet erst das Eintragen-Formular. */
.add-x {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2rem; height: 2rem; margin-top: .35rem;
  border: 1px solid #8cc79a; border-radius: 4px;
  background: #eef9f1; color: #17632a;
  font-weight: 700; font-size: 1.15rem; line-height: 1; text-decoration: none;
}
.add-x:hover { background: #17632a; border-color: #17632a; color: #fff; }
.add-area { margin-top: .35rem; }
.item-entries > .add-x, .item-entries > .add-area { grid-column: 1 / -1; justify-self: start; }
.button-link { align-self: center; color: #5a6675; }
/* Schmale Fenster: eine Spalte, Einträge bleiben kompakt am rechten Rand. */
@media (max-width: 48rem) {
  main.helper { width: calc(100% - 2rem); padding: 1rem; }
  .block-list { display: block; }
  .entry-block { display: block; border-top: 1px solid #d9e0e8; padding: .8rem 0 .9rem; }
  .entry-block:first-of-type { border-top: 0; padding-top: .2rem; }
  .item-grid { display: grid; grid-template-columns: 1fr; gap: .1rem; }
  .item-head { grid-column: auto; border-top: 0; padding: .2rem 2rem .2rem 0; }
  .item-entries { grid-column: auto; display: block; border-top: 0; padding: 0 0 0 .5rem; }
  .entry { grid-template-columns: minmax(0, 1fr) 2rem 4.5rem 2rem 2rem; column-gap: .4rem; padding: .4rem .4rem; }
  .entry.editing { grid-template-columns: 1fr; }
}
form.new-entry { display: flex; flex-wrap: wrap; gap: .4rem .6rem; align-items: end; margin: .5rem 0 .1rem; }
form.row { display: flex; gap: .6rem; align-items: end; flex-wrap: wrap; margin: .4rem 0; }
/* Labels nicht mit Außenabstand ausrichten: Der Abstand schiebt ihre Unterkante
   unter die Eingabefelder, wodurch die Buttons tiefer als die Zeile stehen. */
form.row > label, form.new-entry > label { margin: 0; }
.hint { color: #5a6675; font-size: .92rem; }
.over { color: #6b4c12; background: #fdf3d7; padding: 0 .4rem; border-radius: 3px; }
.badge.vorschlag { background: #fdf3d7; color: #6b4c12; border: 1px solid #e8d9a0; font-size: .72rem; vertical-align: middle; }
input.narrow { width: 5rem; }
button.small { padding: .3rem .75rem; font-size: .9rem; }
button.secondary { background: #5a6675; }
button.secondary:hover { background: #46505c; }
/* Rotes X: kompletten Eintrag aus der Liste entfernen */
.delete-x {
  position: absolute; top: -.1rem; right: 0;
  width: 1.6rem; height: 1.6rem; line-height: 1.4rem; text-align: center;
  border: 1px solid #d8a0a0; border-radius: 4px;
  color: #a11212; background: #fff; font-weight: 700; text-decoration: none;
}
.delete-x:hover { background: #a11212; border-color: #a11212; color: #fff; }
button.danger { background: #a11212; }
button.danger:hover { background: #7d0d0d; }
.danger-box { border: 1px solid #d8a0a0; background: #fdeaea; border-radius: 6px; padding: .7rem 1rem; margin: .6rem 0; }
.danger-box p { margin: 0; }
/* Archiviertes Event: lesbar, aber gesperrt */
.readonly-banner { border: 1px solid #c9d4e2; border-left: 4px solid #5a7ea6; background: #f2f6fb; border-radius: 6px; padding: .7rem 1rem; margin: .4rem 0 .9rem; }
.readonly-banner strong { color: #1c3f5f; }
details.proposals { margin-top: 1.5rem; border: 1px solid #e3e8ee; border-radius: 6px; padding: .55rem .95rem; background: #fafbfd; }
details.proposals summary { cursor: pointer; color: #45505f; }
details.proposals summary:hover { color: #1d6fb8; }
details.proposals form { margin: .7rem 0 .2rem; }
details.history { margin-top: 1.25rem; border-top: 1px solid #e3e8ee; padding-top: .6rem; }
details.history summary { cursor: pointer; color: #45505f; font-size: .9rem; }
details.history summary:hover { color: #1d6fb8; }
ul.history-list { font-size: .88rem; color: #45505f; list-style: none; padding-left: .2rem; }
