/* =========================================================================
   Digitale Fundkiste – Stylesheet
   Signatur: farbcodiertes Kategoriesystem. Drumherum ruhig und warm.
   ========================================================================= */

:root {
  --bg:        #F8F7EE;   /* zartes Schulgelb */
  --surface:   #FFFFFF;
  --ink:       #343434;   /* Schulpalette Dunkelgrau */
  --ink-soft:  #5E5E5E;
  --ink-faint: #909090;
  --line:      #E8E5CC;   /* Haarlinie, warm-gelblich */
  --line-soft: #F0EDD8;
  --accent:    #84ACCE;   /* Schulblau – Hauptfarbe */
  --accent-deep:#2E6A9E;  /* dunkleres Blau für Text und Links */
  --danger:    #D5483B;
  --ok:        #2F9E68;

  --radius:    18px;
  --radius-sm: 12px;
  --shadow:    0 1px 2px rgba(32,48,63,.05), 0 8px 24px rgba(32,48,63,.06);
  --shadow-lg: 0 8px 40px rgba(32,48,63,.16);

  --ff-display: "Nunito", system-ui, sans-serif;
  --ff-body: "Plus Jakarta Sans", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  font-family: var(--ff-body);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom);
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea { font-family: inherit; }

/* ---- Kopfbereich -------------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 760px;
  margin: 0 auto;
  padding: 14px 18px 0;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-logo {
  height: 48px;
  width: auto;
  flex: none;
}
.brand-name {
  font-family: var(--ff-display);
  font-weight: 800;
  font-size: 1.38rem;
  letter-spacing: -.02em;
  line-height: 1.1;
  color: var(--ink);
}
.brand-sub {
  font-weight: 600;
  color: var(--ink-soft);
}

/* segmentierte Umschaltung Fundstücke / Suchanzeigen */
.tabs {
  display: flex;
  gap: 4px;
  margin-top: 14px;
  background: var(--line-soft);
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 4px;
}
.tab {
  flex: 1;
  padding: 9px 8px;
  border-radius: 9px;
  font-weight: 650;
  font-size: .9rem;
  color: var(--ink-soft);
  display: flex; align-items: center; justify-content: center; gap: 7px;
  transition: background .18s, color .18s, box-shadow .18s;
}
.tab .count {
  font-size: .72rem;
  background: color-mix(in srgb, var(--ink-soft) 16%, transparent);
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 1px 7px;
  font-weight: 700;
  min-width: 20px;
}
.tab[aria-selected="true"] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
}
.tab[aria-selected="true"] .count {
  background: color-mix(in srgb, var(--accent) 20%, transparent);
  color: var(--accent-deep);
}

/* Filterleiste – horizontal scrollbar */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 18px 16px;
  max-width: 760px;
  margin: 0 auto;
}
.chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px 8px 11px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-weight: 600;
  font-size: .86rem;
  color: var(--ink-soft);
  white-space: nowrap;
  transition: transform .12s, border-color .15s, color .15s, background .15s;
}
.chip:active { transform: scale(.95); }
.chip .ico { width: 17px; height: 17px; flex: none; }
.chip .dot {
  width: 9px; height: 9px; border-radius: 50%; flex: none;
}
.chip[aria-pressed="true"] {
  color: #fff;
  border-color: transparent;
}

/* ---- Inhalt ------------------------------------------------------------- */

main { max-width: 760px; margin: 0 auto; padding: 4px 18px 120px; }
.view[hidden] { display: none; }

/* Fundstück-Raster */
.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 13px;
}
@media (min-width: 560px) { .grid { grid-template-columns: repeat(3, 1fr); } }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  animation: rise .4s cubic-bezier(.2,.7,.3,1) backwards;
}
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

.card-photo {
  aspect-ratio: 1 / 1;
  background: var(--line-soft);
  position: relative;
  overflow: hidden;
}
.card-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-photo .noimg {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  color: var(--ink-faint);
}
.card-photo .noimg svg { width: 38%; height: 38%; opacity: .5; }
.card-body { padding: 10px 11px 12px; }
.card-note {
  font-size: .82rem;
  color: var(--ink-soft);
  margin-top: 7px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-date { font-size: .72rem; color: var(--ink-faint); margin-top: 7px; font-weight: 500; }

/* Kategorie-Plakette */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .78rem;
  font-weight: 700;
  padding: 4px 10px 4px 7px;
  border-radius: 999px;
}
.tag .ico { width: 15px; height: 15px; }

/* ---- Suchanzeigen ------------------------------------------------------- */

.req-list { display: flex; flex-direction: column; gap: 12px; }
.req {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 15px 16px;
  box-shadow: var(--shadow);
  display: flex;
  gap: 13px;
  animation: rise .4s cubic-bezier(.2,.7,.3,1) backwards;
}
.req-side { flex: none; padding-top: 2px; }
.req-side .ico-wrap {
  width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center;
}
.req-side .ico { width: 22px; height: 22px; }
.req-main { flex: 1; min-width: 0; }
.req-text { font-size: .95rem; color: var(--ink); }
.req-meta {
  display: flex; flex-wrap: wrap; gap: 6px 12px;
  margin-top: 8px; font-size: .76rem; color: var(--ink-faint); font-weight: 500;
}
.req-contact { color: var(--ink-soft); }

/* ---- Buttons ------------------------------------------------------------ */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  padding: 14px 20px;
  border-radius: 14px;
  font-weight: 700;
  font-size: .96rem;
  transition: transform .12s, filter .15s, background .15s;
}
.btn:active { transform: scale(.97); }
.btn svg { width: 19px; height: 19px; }
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { filter: brightness(1.12); }
.btn-accent { background: var(--accent); color: var(--ink); }
.btn-accent:hover { filter: brightness(1.04); }
.btn-ghost { background: var(--surface); border: 1px solid var(--line); color: var(--ink); }
.btn-block { width: 100%; }
.btn-danger { background: color-mix(in srgb, var(--danger) 12%, #fff); color: var(--danger); }
.btn-sm { padding: 9px 13px; font-size: .85rem; border-radius: 11px; }

/* schwebender Aktionsknopf */
.fab {
  position: fixed;
  left: 50%; transform: translateX(-50%);
  bottom: calc(20px + env(safe-area-inset-bottom));
  z-index: 25;
  box-shadow: var(--shadow-lg);
  padding: 15px 26px;
}
.fab svg { width: 21px; height: 21px; }

/* ---- Leerzustände ------------------------------------------------------- */

.empty {
  text-align: center;
  padding: 64px 24px;
  color: var(--ink-soft);
}
.empty-mark {
  width: 76px; height: 76px; margin: 0 auto 18px;
  border-radius: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  display: grid; place-items: center;
  box-shadow: var(--shadow);
}
.empty-mark svg { width: 36px; height: 36px; color: var(--ink-faint); }
.empty h3 { font-family: var(--ff-display); font-weight: 700; font-size: 1.2rem; color: var(--ink); margin-bottom: 6px; }
.empty p { font-size: .92rem; max-width: 30ch; margin: 0 auto; }

.loading { text-align: center; padding: 60px; color: var(--ink-faint); }

/* ---- Bottom-Sheet / Dialog --------------------------------------------- */

.scrim {
  position: fixed; inset: 0;
  background: rgba(32,48,63,.4);
  backdrop-filter: blur(2px);
  z-index: 40;
  opacity: 0;
  transition: opacity .25s;
}
.scrim.open { opacity: 1; }
.scrim[hidden] { display: none; }

.sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 41;
  background: var(--surface);
  border-radius: 26px 26px 0 0;
  max-width: 620px;
  margin: 0 auto;
  max-height: 92vh;
  overflow-y: auto;
  padding: 8px 20px calc(26px + env(safe-area-inset-bottom));
  transform: translateY(100%);
  transition: transform .32s cubic-bezier(.2,.8,.2,1);
  box-shadow: var(--shadow-lg);
}
.sheet.open { transform: translateY(0); }
.sheet[hidden] { display: none; }
.sheet-handle {
  width: 40px; height: 4px; border-radius: 99px;
  background: var(--line); margin: 10px auto 14px;
}
.sheet h2 {
  font-family: var(--ff-display); font-weight: 700; font-size: 1.32rem;
  letter-spacing: -.02em; margin-bottom: 4px;
}
.sheet .sub { font-size: .88rem; color: var(--ink-soft); margin-bottom: 20px; }
.field { margin-bottom: 18px; }
.field > label {
  display: block; font-weight: 650; font-size: .82rem;
  color: var(--ink); margin-bottom: 9px;
}
.field .opt { color: var(--ink-faint); font-weight: 500; }
.input, textarea.input {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--bg);
  font-size: 1rem;
  color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, textarea.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 24%, transparent);
  background: var(--surface);
}
textarea.input { resize: vertical; min-height: 80px; }

/* Foto-Aufnahme */
.photo-pick {
  border: 1.5px dashed var(--line);
  border-radius: 16px;
  background: var(--bg);
  aspect-ratio: 4 / 3;
  display: grid; place-items: center;
  position: relative;
  overflow: hidden;
  text-align: center;
  color: var(--ink-soft);
  transition: border-color .15s;
}
.photo-pick:active { border-color: var(--accent); }
.photo-pick svg { width: 34px; height: 34px; color: var(--ink-faint); margin-bottom: 8px; }
.photo-pick .ptxt { font-weight: 650; font-size: .92rem; color: var(--ink); }
.photo-pick .phint { font-size: .78rem; margin-top: 2px; }
.photo-pick img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.photo-redo {
  position: absolute; top: 10px; right: 10px;
  background: rgba(32,48,63,.78); color: #fff;
  border-radius: 11px; padding: 7px 12px; font-size: .8rem; font-weight: 650;
  display: flex; align-items: center; gap: 6px;
  backdrop-filter: blur(4px);
}
.photo-redo svg { width: 15px; height: 15px; margin: 0; color: #fff; }

/* Kategorie-Auswahl im Sheet */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 9px;
}
@media (min-width: 420px) { .cat-grid { grid-template-columns: repeat(4, 1fr); } }
.cat-opt {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  padding: 14px 6px;
  border-radius: 14px;
  border: 1.5px solid var(--line);
  background: var(--bg);
  font-weight: 650; font-size: .8rem; color: var(--ink-soft);
  transition: transform .12s, border-color .15s, background .15s, color .15s;
}
.cat-opt:active { transform: scale(.95); }
.cat-opt .ico { width: 26px; height: 26px; }
.cat-opt[aria-pressed="true"] { color: var(--ink); font-weight: 750; }

/* Auswahl-Pills für Suchanzeige-Kategorie (kompakter) */
.cat-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.cat-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 13px; border-radius: 999px;
  border: 1.5px solid var(--line); background: var(--bg);
  font-weight: 600; font-size: .83rem; color: var(--ink-soft);
  transition: transform .12s, border-color .15s, color .15s;
}
.cat-pill:active { transform: scale(.95); }
.cat-pill .ico { width: 16px; height: 16px; }

/* ---- Team-Verwaltung ---------------------------------------------------- */

.team-hero {
  background: var(--ink);
  color: #fff;
  border-radius: var(--radius);
  padding: 22px 20px;
  margin-bottom: 22px;
  box-shadow: var(--shadow);
}
.team-hero h2 { font-family: var(--ff-display); font-weight: 800; font-size: 1.4rem; margin-bottom: 4px; }
.team-hero p { color: rgba(255,255,255,.7); font-size: .88rem; margin-bottom: 18px; }
.team-hero .btn-accent { width: 100%; }

.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: 26px 2px 13px;
}
.section-head h2 { font-family: var(--ff-display); font-weight: 700; font-size: 1.18rem; }
.section-head .hint { font-size: .78rem; color: var(--ink-faint); }

.team-link {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: .82rem; font-weight: 650; color: var(--accent-deep);
}
.team-link svg { width: 16px; height: 16px; }

/* Team-Liste: Zeilen mit Vorschau + Aktionen */
.row {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  padding: 11px;
  display: flex; gap: 12px; align-items: center;
  margin-bottom: 10px;
}
.row-thumb {
  width: 56px; height: 56px; border-radius: 10px; flex: none;
  object-fit: cover; background: var(--line-soft);
}
.row-thumb.noimg { display: grid; place-items: center; color: var(--ink-faint); }
.row-thumb.noimg svg { width: 24px; height: 24px; }
.row-main { flex: 1; min-width: 0; }
.row-note { font-size: .82rem; color: var(--ink-soft); margin-top: 3px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-date { font-size: .72rem; color: var(--ink-faint); margin-top: 3px; }
.row-actions { display: flex; gap: 7px; flex: none; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--bg); border: 1px solid var(--line);
  transition: transform .12s, background .15s;
}
.icon-btn:active { transform: scale(.92); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn.ok { color: var(--ok); }
.icon-btn.del { color: var(--danger); }

/* ---- Toast -------------------------------------------------------------- */

.toast {
  position: fixed;
  left: 50%; transform: translateX(-50%) translateY(20px);
  bottom: calc(28px + env(safe-area-inset-bottom));
  z-index: 60;
  background: var(--ink); color: #fff;
  padding: 13px 20px; border-radius: 13px;
  font-weight: 600; font-size: .9rem;
  box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 9px;
  opacity: 0; pointer-events: none;
  transition: opacity .25s, transform .25s;
  max-width: calc(100% - 36px);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast svg { width: 18px; height: 18px; flex: none; }

/* ---- QR-Seite ----------------------------------------------------------- */

.qr-page { max-width: 460px; margin: 0 auto; padding: 40px 22px; text-align: center; }
.qr-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 24px; padding: 30px; box-shadow: var(--shadow); margin-top: 22px;
}
.qr-card img { width: 100%; max-width: 280px; border-radius: 14px; }
.qr-url {
  margin-top: 18px; font-size: .8rem; word-break: break-all;
  color: var(--ink-soft); background: var(--bg);
  border: 1px solid var(--line); border-radius: 11px; padding: 11px 13px;
}
.note-box {
  margin-top: 18px; text-align: left; font-size: .86rem; color: var(--ink-soft);
  background: color-mix(in srgb, var(--accent) 9%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line));
  border-radius: 13px; padding: 14px 16px;
}

@media print {
  body { background: #fff; }
  .qr-print-hide { display: none; }
  .qr-card { box-shadow: none; border-color: #ccc; }
}

/* ---- Abholmeldung – Elternansicht --------------------------------------- */

.card-claimed { opacity: .75; }
.card-claimed .card-photo::after {
  content: '';
  position: absolute; inset: 0;
  background: color-mix(in srgb, var(--ok) 14%, transparent);
  pointer-events: none;
}
.claimed-badge {
  position: absolute; top: 8px; left: 8px;
  background: var(--ok); color: #fff;
  border-radius: 999px; padding: 4px 10px;
  font-size: .7rem; font-weight: 700;
  letter-spacing: .01em;
  display: flex; align-items: center; gap: 5px;
}
.claimed-badge svg { width: 12px; height: 12px; flex: none; }
.card-claim-btn {
  width: 100%;
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1.5px dashed var(--line);
  background: transparent;
  font-size: .78rem;
  font-weight: 650;
  color: var(--ink-soft);
  transition: border-color .15s, color .15s, background .15s;
}
.card-claim-btn:active { background: var(--line-soft); border-color: var(--ink-faint); }

/* ---- Abholmeldung – Teamansicht ----------------------------------------- */

.row.gemeldet {
  border-color: color-mix(in srgb, var(--ok) 45%, var(--line));
  background: color-mix(in srgb, var(--ok) 5%, var(--surface));
}
.claimed-info {
  font-size: .72rem; color: var(--ok); font-weight: 650;
  margin-top: 3px; display: flex; align-items: center; gap: 5px;
}
.claimed-info svg { width: 12px; height: 12px; flex: none; }
.icon-btn.undo { color: var(--ink-soft); }

/* ---- Zugänglichkeit ----------------------------------------------------- */

:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
