:root { color-scheme: light dark; --accent: #2563eb; }

* { box-sizing: border-box; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  margin: 0;
  line-height: 1.6;
}

.site-header {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 1rem;
  max-width: 48rem; margin: 0 auto; padding: 1.25rem 1.5rem;
  border-bottom: 1px solid rgba(127,127,127,.25);
}
.brand { font-weight: 700; font-size: 1.15rem; text-decoration: none; color: inherit; }
.site-nav { display: flex; flex-wrap: wrap; gap: 1rem; }
.site-nav a { text-decoration: none; color: var(--accent); }
.site-nav a:hover { text-decoration: underline; }

.site-main { max-width: 48rem; margin: 0 auto; padding: 2rem 1.5rem; }
.site-footer {
  max-width: 48rem; margin: 0 auto; padding: 1.5rem;
  border-top: 1px solid rgba(127,127,127,.25);
}
.footer-nav { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: .5rem; }
.footer-nav a { text-decoration: none; color: var(--accent); font-size: .9rem; }
.footer-nav a:hover { text-decoration: underline; }

.prose h1 { font-size: 2rem; margin-bottom: .5rem; }
.entry-list { list-style: none; padding: 0; }
.entry-list li { padding: .5rem 0; border-bottom: 1px solid rgba(127,127,127,.2); }
.entry-list a { font-weight: 600; text-decoration: none; color: var(--accent); }
.entry-list a:hover { text-decoration: underline; }
.entry-list .muted { display: block; font-size: .85rem; }
.prose { max-width: 42rem; }
.muted { opacity: .65; }
code { background: rgba(127,127,127,.18); padding: .1em .4em; border-radius: .3em; }

.messages { list-style: none; padding: 0; margin: 0 0 1.5rem; }
.msg { padding: .6rem .9rem; border-radius: .4rem; margin-bottom: .5rem; }
.msg.error { background: rgba(220,38,38,.15); }
.msg.success { background: rgba(22,163,74,.15); }

.survey .question {
  border: 1px solid rgba(127,127,127,.3); border-radius: .5rem;
  padding: 1rem 1.25rem; margin: 0 0 1.25rem;
}
.survey legend { font-weight: 600; padding: 0 .4rem; }
.survey .choice { display: block; margin: .35rem 0; cursor: pointer; }
.survey textarea { width: 100%; font: inherit; padding: .5rem; }
.survey .req { color: #dc2626; }

button {
  font: inherit; font-weight: 600; cursor: pointer;
  background: var(--accent); color: #fff; border: none;
  padding: .6rem 1.4rem; border-radius: .4rem;
}
button:hover { opacity: .9; }

/* ===== Packliste ========================================================
   Kompaktes Zeilen-/Tabellen-Layout: eine Zeile pro Item, Spalten
   Name | wer bringt mit | Menge | Zusage eintragen | loeschen.
   Schmale Bildschirme brechen dieselbe Zeile in drei Ebenen um.        */

/* Tabellen brauchen mehr Platz als Fliesstext -> Seite breiter machen */
body.page-wide .site-header,
body.page-wide .site-main,
body.page-wide .site-footer { max-width: 60rem; }

.packlist { --line: rgba(127,127,127,.28); max-width: none; }
.pl-head h1 { font-size: 1.7rem; margin: 0 0 .3rem; }
.pl-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .1rem .5rem; margin: 0 0 1.25rem; font-size: .9rem; }
.pl-h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; opacity: .6; margin: 1.4rem 0 .4rem; }
.pl-tag { border: 1px solid var(--line); border-radius: 999px; padding: 0 .55rem; font-size: .8rem; opacity: .8; }
.pl-tag.open { color: #16a34a; border-color: rgba(22,163,74,.5); opacity: 1; }
.print-only { display: none; }

/* Teilnehmer */
.pl-people-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.25rem; }
.pl-chips { list-style: none; display: flex; flex-wrap: wrap; gap: .4rem; padding: 0; margin: 0; }
.pl-chips a {
  display: inline-block; padding: .1rem .65rem; border-radius: 999px; font-size: .9rem;
  background: rgba(37,99,235,.12); text-decoration: none; color: var(--accent);
}
.pl-chips a:hover { background: rgba(37,99,235,.22); }

/* kompakte Formulare */
.pl-form { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; margin: 0; }
.packlist input, .packlist select {
  font: inherit; font-size: .9rem; min-width: 0; padding: .2rem .4rem;
  border: 1px solid var(--line); border-radius: .3rem; background: transparent; color: inherit;
}
.packlist input[type=number] { width: 3.8rem; }
.pl-newitem input[name=name] { flex: 2 1 9rem; }
.pl-newitem input[name=category] { flex: 1 1 7rem; }
.pl-newitem input[name=note] { flex: 2 1 9rem; }

.btn-sm { padding: .2rem .6rem; font-size: .85rem; border-radius: .3rem; }
.btn-x {
  background: none; border: none; margin: 0; padding: 0 .15rem; color: inherit;
  font-size: 1rem; line-height: 1; opacity: .45;
}
.btn-x:hover { opacity: 1; }
.btn-trash { color: #dc2626; opacity: .6; }

/* Kategorie = Tabellenkopf, bleibt beim Scrollen stehen */
.pl-cat {
  display: flex; justify-content: space-between; align-items: baseline; gap: .5rem;
  font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  margin: 1.5rem 0 0; padding: .3rem 0; border-bottom: 2px solid var(--line);
  position: sticky; top: 0; background: Canvas; z-index: 1;
}
.pl-cat-count { font-weight: 400; letter-spacing: 0; opacity: .55; font-variant-numeric: tabular-nums; }

/* Item-Zeilen */
.pl-rows { list-style: none; padding: 0; margin: 0; }
.pl-row {
  display: grid; align-items: center; gap: .15rem .6rem;
  padding: .4rem .2rem .4rem .5rem;
  border-bottom: 1px solid var(--line); border-left: 3px solid transparent;
  grid-template-columns: minmax(0, 1fr) auto auto;
  grid-template-areas: "name count del" "who who who" "add add add";
}
.pl-row:hover { background: rgba(127,127,127,.06); }
/* Sprungmarken: Abstand, damit die Zeile nicht unter der klebenden Kategorie-Zeile landet */
.pl-row, .pl-name, .pl-people, .pl-new, .pl-check li { scroll-margin-top: 3rem; }
.pl-row.is-covered { border-left-color: rgba(22,163,74,.7); }
.pl-name { grid-area: name; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.pl-note { display: block; font-weight: 400; font-size: .82rem; opacity: .6; }
.pl-who {
  grid-area: who; list-style: none; display: flex; flex-wrap: wrap;
  gap: .3rem; padding: 0; margin: 0; font-size: .85rem;
}
.pl-chip-sm {
  display: inline-flex; align-items: center; gap: .1rem; white-space: nowrap;
  padding: .05rem .45rem; border-radius: 999px; background: rgba(127,127,127,.15);
}
.pl-chip-sm form { display: inline-flex; margin: 0 0 0 .15rem; }
.pl-chip-qty { font-variant-numeric: tabular-nums; opacity: .65; }
.pl-nobody { font-size: .85rem; }
.pl-count { grid-area: count; font-size: .9rem; white-space: nowrap; opacity: .75; font-variant-numeric: tabular-nums; }
.is-covered .pl-count { color: #16a34a; opacity: 1; }
.pl-add { grid-area: add; display: flex; align-items: center; gap: .3rem; margin: 0; }
.pl-add select { max-width: 8.5rem; }
.pl-del { grid-area: del; margin: 0; justify-self: end; }

.pl-toggle { color: inherit; text-decoration: none; }
.pl-toggle-close { display: none; }  /* nur am Handy und nur im aufgeklappten Zustand */

@media (min-width: 46rem) {
  .pl-row {
    grid-template-columns: minmax(8rem, 1.1fr) minmax(6rem, 1fr) 3.2rem auto auto;
    grid-template-areas: "name who count add del";
  }
  .pl-count { text-align: right; }
}

/* Handy: "wer bringt mit" erst nach Tippen auf den Item-Namen zeigen (:target, ohne JS),
   nochmaliges Tippen klappt wieder zu. Nach dem Eintragen springt die Seite auf
   #item-<id> zurueck -> die Zeile bleibt offen fuer die naechste Zusage. */
@media (max-width: 45.99rem) {
  .pl-add { display: none; }
  .pl-row:target { background: rgba(37,99,235,.08); }
  .pl-row:target .pl-add { display: flex; }
  /* zugeklappt: Aufklapp-Link sichtbar - aufgeklappt: Zuklapp-Link an derselben Stelle */
  .pl-row:target .pl-toggle-open { display: none; }
  .pl-row:target .pl-toggle-close { display: inline; }
  .pl-toggle-open::after { content: "+"; margin-left: .35rem; font-size: .9em; opacity: .45; }
  .pl-toggle-close::after { content: "–"; margin-left: .35rem; font-size: .9em; opacity: .45; }
}

/* Uebersicht aller Packlisten */
.pl-index .pl-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name state" "meta meta"; }
.pl-index .pl-name a { color: var(--accent); text-decoration: none; }
.pl-index .pl-name a:hover { text-decoration: underline; }
.pl-idx-meta { grid-area: meta; font-size: .85rem; }
.pl-idx-state { grid-area: state; }

@media (min-width: 46rem) {
  .pl-index .pl-row { grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "name meta state"; }
}

/* Persoenliche Checkliste: ganze Zeile ist der Abhak-Button */
.pl-check { list-style: none; padding: 0; margin: 0; }
.pl-check li { border-bottom: 1px solid var(--line); }
.pl-check form { margin: 0; }
.check-toggle {
  display: flex; align-items: center; gap: .6rem; width: 100%; text-align: left;
  padding: .45rem .3rem; border: none; border-radius: .3rem;
  background: none; color: inherit; font-weight: 400;
}
.check-toggle:hover { background: rgba(127,127,127,.1); opacity: 1; }
.check-box {
  flex: none; width: 1.15rem; height: 1.15rem; border: 2px solid currentColor; border-radius: .25rem;
  display: flex; align-items: center; justify-content: center; opacity: .5;
}
.check-mark { display: none; font-size: .8rem; line-height: 1; }
.check-label { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.check-qty { flex: none; font-size: .9rem; opacity: .6; font-variant-numeric: tabular-nums; }
.is-packed .check-box { background: var(--accent); border-color: var(--accent); color: #fff; opacity: 1; }
.is-packed .check-mark { display: block; }
.is-packed .check-label { text-decoration: line-through; opacity: .55; }

@media print {
  .site-header, .site-footer, .no-print, .messages { display: none !important; }
  .print-only { display: inline !important; }
  .pl-cat { position: static; border-bottom-color: #000; }
  .pl-check li { border-bottom: 1px solid #000; }
  .check-toggle { padding: .35rem 0; }
  .check-box { border-color: #000 !important; background: none !important; opacity: 1 !important; }
  .check-mark { display: none !important; }
  .is-packed .check-label { text-decoration: none; opacity: 1; }
}
