/* ============================================================
   Wettenberg hilft – Design System (mobile-first)
   System-Fonts, keine externen Ressourcen, hoher Kontrast.
   Tap-Targets ≥ 44px, robustes Stack-Verhalten auf engen Screens.
   ============================================================ */

:root {
  /* Basis-Farben (an "Wettenberg bleibt bunt" angelehnt) */
  --c-bg:           #f7f6f3;
  --c-surface:      #ffffff;
  --c-surface-2:    #fafaf6;
  --c-border:       #e4e3df;
  --c-border-strong:#cfcdc6;
  --c-text:         #161616;          /* schwarz wie im Logo-Schriftzug */
  --c-text-muted:   #4f5253;
  --c-text-soft:    #82847f;

  /* Primär: warmes Rot-Orange aus dem Regenbogen-Schwung */
  --c-primary:      #d8431c;
  --c-primary-700:  #aa3210;
  --c-primary-50:   #fef0e9;
  --c-accent:       #2563aa;          /* das tiefere Blau aus dem Logo */
  --c-accent-50:    #e9f1fb;

  /* Regenbogenpalette aus dem Logo */
  --c-rb-red:    #d8431c;
  --c-rb-orange: #f08820;
  --c-rb-yellow: #f5c518;
  --c-rb-green:  #3fa34d;
  --c-rb-blue:   #2563aa;
  --c-rb-purple: #6a3093;

  --rainbow: linear-gradient(
    90deg,
    var(--c-rb-red)    0%,
    var(--c-rb-orange) 20%,
    var(--c-rb-yellow) 40%,
    var(--c-rb-green)  60%,
    var(--c-rb-blue)   80%,
    var(--c-rb-purple) 100%
  );
  --rainbow-soft: linear-gradient(
    135deg,
    rgba(216,67,28,.08)   0%,
    rgba(240,136,32,.08)  20%,
    rgba(245,197,24,.08)  40%,
    rgba(63,163,77,.08)   60%,
    rgba(37,99,170,.08)   80%,
    rgba(106,48,147,.08) 100%
  );

  --c-success:      #15803d;
  --c-success-50:   #f0fdf4;
  --c-warn:         #b45309;
  --c-warn-50:      #fffbeb;
  --c-danger:       #b91c1c;
  --c-danger-50:    #fef2f2;
  --c-info:         #1e40af;
  --c-info-50:      #eff6ff;

  /* Typografie */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter",
          Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --r-sm: 6px;
  --r:    10px;
  --r-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 16, .04), 0 1px 3px rgba(15, 23, 16, .03);
  --shadow:    0 1px 3px rgba(15, 23, 16, .06), 0 8px 24px -12px rgba(15, 23, 16, .12);
  --shadow-lg: 0 10px 30px -10px rgba(15, 23, 16, .25);

  --container: 1180px;
  --header-h: 60px;
}

/* ---------- Reset / Basis ---------- */

*, *::before, *::after { box-sizing: border-box; min-width: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--c-bg);
  color: var(--c-text);
  font: 16px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img, svg, video { max-width: 100%; height: auto; }
a { color: var(--c-primary-700); text-underline-offset: 3px; }
a:hover { color: var(--c-primary); }
hr { border: 0; border-top: 1px solid var(--c-border); margin: 1.5rem 0; }

h1, h2, h3, h4 { line-height: 1.25; letter-spacing: -.01em; margin: 0 0 .6rem; word-wrap: break-word; }
h1 { font-size: clamp(1.45rem, 5vw, 2.2rem); font-weight: 700; }
h2 { font-size: clamp(1.15rem, 3.5vw, 1.6rem); font-weight: 650; }
h3 { font-size: clamp(1rem, 3vw, 1.15rem); font-weight: 650; }
p  { margin: .25rem 0 1rem; word-wrap: break-word; }

code, kbd, samp { font-family: var(--font-mono); font-size: .92em; word-break: break-word; }

.skip-link { position: absolute; left: -9999px; }
.skip-link:focus {
  left: 1rem; top: 1rem; z-index: 100;
  background: #000; color: #fff; padding: .55rem 1rem; border-radius: var(--r-sm);
}

.container       { max-width: var(--container); margin-inline: auto; padding-inline: 1rem; }
.container-wide  { max-width: 1600px;          margin-inline: auto; padding-inline: 1rem; }
@supports (padding: max(0px)) {
  .container, .container-wide {
    padding-inline: max(1rem, env(safe-area-inset-left)) max(1rem, env(safe-area-inset-right));
  }
}

/* ---------- Header / Nav ---------- */

.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--c-border);
  box-shadow: 0 3px 0 0 transparent; /* placeholder, replaced by ::after */
  padding-top: env(safe-area-inset-top);
}
.site-header::after {
  content: ""; display: block; height: 3px;
  background: var(--rainbow);
  background-size: 100% 100%;
  position: absolute; left: 0; right: 0; bottom: -3px;
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: .75rem; min-height: var(--header-h); padding-block: .5rem;
  position: relative;
}

/* Hamburger-Button: nur Mobile sichtbar */
.nav-toggle {
  display: none;
  align-items: center; justify-content: center;
  width: 44px; height: 44px;
  background: transparent; border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  cursor: pointer; flex-shrink: 0;
  color: var(--c-text);
  padding: 0;
}
.nav-toggle:hover { background: var(--c-surface-2); border-color: var(--c-border-strong); }
.nav-toggle .nav-toggle-icon {
  display: block; width: 22px; height: 2px;
  background: currentColor; border-radius: 2px;
  position: relative;
}
.nav-toggle .nav-toggle-icon::before,
.nav-toggle .nav-toggle-icon::after {
  content: ""; position: absolute; left: 0; right: 0; height: 2px;
  background: currentColor; border-radius: 2px;
  transition: transform .18s ease, top .18s ease;
}
.nav-toggle .nav-toggle-icon::before { top: -7px; }
.nav-toggle .nav-toggle-icon::after  { top:  7px; }
body[data-nav-open] .nav-toggle .nav-toggle-icon { background: transparent; }
body[data-nav-open] .nav-toggle .nav-toggle-icon::before { top: 0; transform: rotate(45deg); }
body[data-nav-open] .nav-toggle .nav-toggle-icon::after  { top: 0; transform: rotate(-45deg); }
.brand {
  display: inline-flex; align-items: center; gap: .55rem;
  text-decoration: none; color: var(--c-text); font-weight: 600;
  flex-shrink: 1; min-width: 0;
}
.brand-mark {
  height: 2.25rem; flex-shrink: 0;
  display: inline-flex; align-items: center;
}
.brand-mark img { height: 100%; width: auto; display: block; }
.brand-mark.fallback {
  width: 2.5rem; height: 2.5rem; border-radius: 8px;
  background: var(--rainbow);
  color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .8rem;
  letter-spacing: -.02em;
  box-shadow: var(--shadow-sm);
  text-shadow: 0 1px 2px rgba(0,0,0,.3);
}
.brand-text {
  font-size: 1rem; letter-spacing: -.01em; line-height: 1.15;
  display: inline-block; max-width: 100%;
}
@media (max-width: 599px) {
  .brand-text { font-size: .92rem; }
}
.brand-text strong { color: var(--c-primary-700); }

/* Hauptnavigation: immer sichtbar, wraps automatisch auf engen Screens */
.primary-nav {
  display: flex !important; flex-flow: row wrap;
  gap: .25rem; align-items: center;
  flex: 1 1 auto; justify-content: flex-end;
}
.primary-nav a, .primary-nav .link-button {
  display: inline-flex; align-items: center;
  padding: .5rem .75rem; border-radius: var(--r-sm);
  text-decoration: none; color: var(--c-text); font-weight: 500;
  font-size: .94rem; line-height: 1.2; border: 1px solid transparent;
  background: none; cursor: pointer; font-family: inherit;
  white-space: nowrap;
}
.primary-nav a:hover, .primary-nav .link-button:hover {
  background: var(--c-surface-2); color: var(--c-primary-700);
}
.primary-nav .nav-cta { background: var(--c-primary); color: #fff; }
.primary-nav .nav-cta:hover { background: var(--c-primary-700); color: #fff; }
.nav-form { margin: 0; display: contents; }

/* Mobile-Drawer: unter 768px klappt die Nav unter den Header */
@media (max-width: 767px) {
  .nav-toggle { display: inline-grid; }
  .primary-nav {
    position: absolute;
    top: 100%; left: 0; right: 0;
    background: #fff;
    border-bottom: 1px solid var(--c-border);
    box-shadow: var(--shadow-lg);
    padding: .5rem .75rem 1rem;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    gap: .25rem;
    max-height: calc(100dvh - var(--header-h) - 4px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    transform: translateY(-8px);
    opacity: 0;
    visibility: hidden;
    transition: opacity .18s ease, transform .18s ease, visibility 0s .18s;
  }
  body[data-nav-open] .primary-nav {
    opacity: 1; visibility: visible; transform: translateY(0);
    transition: opacity .18s ease, transform .18s ease;
  }
  .primary-nav a, .primary-nav .link-button {
    width: 100%; justify-content: flex-start;
    padding: .8rem .9rem; font-size: 1rem; min-height: 44px;
    border-radius: var(--r-sm);
  }
  .primary-nav .nav-cta { margin-top: .25rem; justify-content: center; }
  .brand-text { font-size: .92rem; }
}

/* Backdrop, wenn Drawer offen */
.nav-backdrop {
  display: none;
  position: fixed;
  inset: var(--header-h) 0 0 0;
  background: rgba(15, 23, 16, .35);
  z-index: 40;
}
@media (max-width: 767px) {
  body[data-nav-open] .nav-backdrop { display: block; }
}
@media (min-width: 768px) {
  body { overflow: auto !important; }
  body[data-nav-open] { /* on desktop: noop */ }
}
@media (max-width: 767px) {
  body[data-nav-open] { overflow: hidden; }
}

/* ---------- Footer ---------- */

.site-footer {
  margin-top: 3rem; padding: 1.75rem 0;
  padding-bottom: max(1.75rem, env(safe-area-inset-bottom));
  background: #161616; color: #d1d5db;
  position: relative;
}
.site-footer::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px;
  background: var(--rainbow);
}
.site-footer a {
  color: #fbbf24; text-decoration: none;
  margin-right: 1rem; display: inline-block;
  padding: .55rem .15rem; min-height: 36px; line-height: 1.4;
}
.site-footer a:hover { text-decoration: underline; }
.footer-inner { display: flex; flex-direction: column; gap: 1rem; }
.footer-inner > div { font-size: .92rem; }
@media (min-width: 768px) {
  .footer-inner { flex-direction: row; justify-content: space-between; }
}

/* ---------- Main ---------- */

.main-content { padding: 1.25rem 1rem 3rem; }
@media (min-width: 768px) { .main-content { padding: 1.75rem 1.25rem 4rem; } }

/* ---------- Hero ---------- */

.hero {
  position: relative; overflow: hidden;
  background: #fff;
  background-image: var(--rainbow-soft);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: 1.25rem 1.1rem;
  margin-bottom: 1.5rem;
}
.hero::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px;
  background: var(--rainbow);
}
@media (min-width: 768px) { .hero { padding: 2.5rem 2rem; margin-bottom: 2rem; } }
.hero h1 { max-width: 22ch; }
.hero p { max-width: 60ch; color: var(--c-text-muted); font-size: 1rem; }
.hero .hero-subline {
  font-style: italic; font-size: 1.1rem; color: var(--c-text);
  margin: -.25rem 0 1rem; max-width: 60ch; opacity: .85;
}
.hero-actions { display: flex; flex-direction: column; gap: .55rem; margin-top: 1rem; }
@media (min-width: 540px) { .hero-actions { flex-direction: row; flex-wrap: wrap; } }
.hero-actions .btn { width: 100%; }
@media (min-width: 540px) { .hero-actions .btn { width: auto; } }

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

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  padding: .7rem 1.1rem; border-radius: var(--r-sm); border: 1px solid transparent;
  text-decoration: none; cursor: pointer; line-height: 1; min-height: 44px;
  font: 500 .95rem var(--font); transition: background .15s, border-color .15s, transform .05s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--c-primary); color: #fff; }
.btn-primary:hover { background: var(--c-primary-700); color: #fff; }
.btn-secondary {
  background: var(--c-surface); border-color: var(--c-border-strong); color: var(--c-text);
}
.btn-secondary:hover { border-color: var(--c-primary); color: var(--c-primary-700); }
.btn-ghost { background: transparent; color: var(--c-text); }
.btn-ghost:hover { background: var(--c-surface-2); }
.btn-danger { background: var(--c-danger); color: #fff; }
.btn-danger:hover { background: #991b1b; color: #fff; }
.btn-success { background: var(--c-success); color: #fff; }
.btn-success:hover { background: #14532d; color: #fff; }
.btn-sm { padding: .45rem .75rem; font-size: .87rem; min-height: 36px; }
.btn-block { display: flex; width: 100%; }

/* ---------- Cards ---------- */

.card {
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--r); padding: 1.1rem; box-shadow: var(--shadow-sm);
  margin-bottom: 1rem;
}
@media (min-width: 768px) { .card { padding: 1.25rem; } }
.card-grid { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 540px) { .card-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); } }

.project-card { display: flex; flex-direction: column; height: 100%; }
.project-card h3 { margin-bottom: .35rem; }
.project-card h3 a { color: var(--c-text); text-decoration: none; }
.project-card h3 a:hover { color: var(--c-primary-700); }
.project-card p { color: var(--c-text-muted); flex: 1; }
.project-meta { color: var(--c-text-soft); font-size: .87rem; margin-bottom: .5rem; }
.project-actions { margin-top: 1rem; display: flex; gap: .5rem; flex-wrap: wrap; }
.project-actions .btn { flex: 1 1 auto; min-width: 0; }
@media (min-width: 540px) { .project-actions .btn { flex: 0 0 auto; } }

/* ---------- Badges ---------- */

.badge {
  display: inline-flex; align-items: center; gap: .25rem;
  padding: .2rem .55rem; border-radius: 999px;
  font-size: .78rem; font-weight: 500; line-height: 1.4;
  background: var(--c-surface-2); color: var(--c-text-muted);
  border: 1px solid var(--c-border);
  white-space: nowrap;
}
.badge-success { background: var(--c-success-50); color: var(--c-success); border-color: #bbf7d0; }
.badge-warn    { background: var(--c-warn-50);    color: var(--c-warn);    border-color: #fde68a; }
.badge-danger  { background: var(--c-danger-50);  color: var(--c-danger);  border-color: #fecaca; }
.badge-info    { background: var(--c-info-50);    color: var(--c-info);    border-color: #bfdbfe; }
.badge-accent  { background: var(--c-accent-50);  color: var(--c-accent);  border-color: #c1d6ee; }

/* Kategoriebadges in den Regenbogen-Tönen (mappen sich über data-cat) */
.badge[data-cat="zeit"]         { background: rgba(216,67,28,.10);  color: var(--c-rb-red);    border-color: rgba(216,67,28,.30); }
.badge[data-cat="leihen"]       { background: rgba(240,136,32,.12); color: #b56409;            border-color: rgba(240,136,32,.32); }
.badge[data-cat="spenden"]      { background: rgba(245,197,24,.18); color: #876c00;            border-color: rgba(245,197,24,.40); }
.badge[data-cat="transport"]    { background: rgba(63,163,77,.12);  color: var(--c-rb-green);  border-color: rgba(63,163,77,.32); }
.badge[data-cat="lagerflaeche"] { background: rgba(37,99,170,.10);  color: var(--c-rb-blue);   border-color: rgba(37,99,170,.30); }
.badge[data-cat="werkzeug"]     { background: rgba(106,48,147,.10); color: var(--c-rb-purple); border-color: rgba(106,48,147,.30); }
.badge[data-cat="fachlich"]     { background: rgba(15,118,110,.10); color: var(--c-accent);    border-color: rgba(15,118,110,.30); }
.badge[data-cat="sonstiges"]    { background: var(--c-surface-2);   color: var(--c-text-muted);border-color: var(--c-border); }
.badge-dot::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ---------- Forms ---------- */

.form {
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--r); padding: 1.1rem; max-width: 720px;
  box-shadow: var(--shadow-sm);
}
@media (min-width: 768px) { .form { padding: 1.5rem; } }
.form-row { margin-bottom: 1rem; }
.form-row label { display: block; font-weight: 600; margin-bottom: .35rem; font-size: .92rem; }
.form-row .hint { color: var(--c-text-soft); font-size: .85rem; margin-top: .35rem; display: block; }
.form input[type=text], .form input[type=email], .form input[type=password],
.form input[type=tel], .form input[type=date], .form input[type=number],
.form select, .form textarea {
  width: 100%; padding: .7rem .85rem;
  border: 1px solid var(--c-border-strong); border-radius: var(--r-sm);
  font: 16px/1.4 var(--font); /* 16px verhindert iOS-Zoom */
  background: #fff; color: var(--c-text); min-height: 44px;
  transition: border-color .15s, box-shadow .15s;
}
.form input:focus, .form select:focus, .form textarea:focus {
  outline: 0; border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(184, 65, 14, .15);
}
.form textarea { min-height: 7rem; resize: vertical; }
.form-check { display: flex; align-items: flex-start; gap: .55rem; margin-bottom: .75rem; }
.form-check input { margin-top: .2rem; transform: scale(1.15); flex-shrink: 0; }
.form-check label { line-height: 1.45; font-weight: 500; }
.form-grid { display: grid; gap: .85rem; grid-template-columns: 1fr; }
@media (min-width: 540px) { .form-grid { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; } }
.form-grid .form-row { margin: 0; }

/* ---------- Flash ---------- */

.flash {
  margin: 1rem 0; padding: .85rem 1rem; border-radius: var(--r);
  border: 1px solid; font-weight: 500;
}
.flash-success { background: var(--c-success-50); color: var(--c-success); border-color: #bbf7d0; }
.flash-error   { background: var(--c-danger-50);  color: var(--c-danger);  border-color: #fecaca; }
.flash-warning { background: var(--c-warn-50);    color: var(--c-warn);    border-color: #fde68a; }

/* ---------- Tables ---------- */

.data-wrap {
  overflow-x: auto; border: 1px solid var(--c-border); border-radius: var(--r);
  -webkit-overflow-scrolling: touch;
  background: var(--c-surface);
  position: relative;
  /* Sanfter Schatten am rechten Rand, der mit-scrollt: zeigt, dass es weitergeht */
  background-image:
    linear-gradient(to right, rgba(0,0,0,0), rgba(0,0,0,0)),
    linear-gradient(to right, rgba(0,0,0,0), rgba(0,0,0,0)),
    linear-gradient(to right, rgba(0,0,0,0), rgba(15,23,16,.10)),
    linear-gradient(to left,  rgba(0,0,0,0), rgba(15,23,16,.10));
  background-position: 0 0, 100% 0, 0 0, 100% 0;
  background-repeat: no-repeat;
  background-size: 16px 100%, 16px 100%, 16px 100%, 16px 100%;
  background-attachment: local, local, scroll, scroll;
}
table.data {
  width: 100%; border-collapse: collapse; background: var(--c-surface);
  font-size: .94rem; min-width: 560px;
}
table.data th, table.data td {
  padding: .7rem .85rem; text-align: left; border-bottom: 1px solid var(--c-border); vertical-align: top;
}
table.data thead th {
  background: var(--c-surface-2); font-weight: 600; font-size: .8rem;
  text-transform: uppercase; letter-spacing: .04em; color: var(--c-text-muted);
  position: sticky; top: 0;
}
table.data tbody tr:hover { background: var(--c-surface-2); }
table.data tbody tr:last-child td { border-bottom: 0; }

/* Erste Spalte beim Querscrollen fixieren (opt-in via .sticky-first) */
.data-wrap.sticky-first { position: relative; }
.data-wrap.sticky-first table.data thead th:first-child,
.data-wrap.sticky-first table.data tbody td:first-child {
  position: sticky; left: 0; z-index: 1;
  background: var(--c-surface);
  box-shadow: 1px 0 0 0 var(--c-border);
}
.data-wrap.sticky-first table.data tbody tr:hover td:first-child { background: var(--c-surface-2); }
.data-wrap.sticky-first table.data thead th:first-child {
  background: var(--c-surface-2); z-index: 2;
}

/* Karten-Layout für Daten-Tabellen unter 600px */
@media (max-width: 599px) {
  .data-wrap.cards-on-mobile { border: 0; background: transparent; overflow: visible; }
  .data-wrap.cards-on-mobile table.data { min-width: 0; background: transparent; font-size: .95rem; }
  .data-wrap.cards-on-mobile table.data thead { display: none; }
  .data-wrap.cards-on-mobile table.data tr {
    display: block; background: var(--c-surface); border: 1px solid var(--c-border);
    border-radius: var(--r); margin-bottom: .75rem; padding: .25rem .25rem;
    box-shadow: var(--shadow-sm);
  }
  .data-wrap.cards-on-mobile table.data td {
    display: block; border: 0; padding: .55rem .75rem; border-bottom: 1px solid var(--c-border);
  }
  .data-wrap.cards-on-mobile table.data td:last-child { border-bottom: 0; }
  .data-wrap.cards-on-mobile table.data td::before {
    content: attr(data-label);
    display: block; font-weight: 600; font-size: .72rem; text-transform: uppercase;
    color: var(--c-text-soft); letter-spacing: .04em; margin-bottom: .2rem;
  }
}

/* ---------- Bedarfsliste ---------- */

.needs-list { list-style: none; padding: 0; margin: 0; }
.needs-list > li {
  padding: 1rem 0; border-bottom: 1px dashed var(--c-border);
}
.needs-list > li:last-child { border-bottom: 0; }
.need-head { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.need-meta { color: var(--c-text-soft); font-size: .87rem; margin-top: .35rem; }

/* ---------- Stats ---------- */

.stat {
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--r); padding: 1rem 1.1rem; box-shadow: var(--shadow-sm);
}
.stat-label { font-size: .78rem; color: var(--c-text-muted); text-transform: uppercase; letter-spacing: .04em; }
.stat-value { font-size: 1.7rem; font-weight: 700; line-height: 1.2; }
.stat-foot  { font-size: .82rem; color: var(--c-text-muted); margin-top: .3rem; }
.stat-foot a { color: var(--c-primary-700); }
.stats-grid { display: grid; gap: .75rem; grid-template-columns: repeat(2, 1fr); margin-bottom: 1.25rem; }
@media (min-width: 768px) { .stats-grid { gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-bottom: 1.5rem; } }

/* ---------- Admin Shell ---------- */

.admin-shell { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 900px) { .admin-shell { grid-template-columns: 240px 1fr; gap: 1.5rem; } }

.admin-sidebar {
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--r); padding: .5rem; align-self: start;
}
@media (min-width: 900px) { .admin-sidebar { padding: .75rem; position: sticky; top: calc(var(--header-h) + 1rem); } }
.admin-sidebar h4 {
  font-size: .72rem; text-transform: uppercase; color: var(--c-text-soft);
  letter-spacing: .08em; margin: .65rem .65rem .3rem;
}
.admin-sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.admin-sidebar a {
  padding: .65rem .75rem; border-radius: var(--r-sm); text-decoration: none;
  color: var(--c-text); font-size: .94rem; display: flex; gap: .5rem; align-items: center;
  min-height: 44px;
}
.admin-sidebar a:hover { background: var(--c-surface-2); }
.admin-sidebar a.is-active {
  background: var(--c-primary-50); color: var(--c-primary-700); font-weight: 600;
}
/* Auf Mobile: Sidebar in <details> kollabierbar */
.admin-sidebar-toggle {
  list-style: none; cursor: pointer; display: flex; align-items: center;
  justify-content: space-between; padding: .65rem .85rem;
  font-weight: 600; color: var(--c-text); border-radius: var(--r-sm);
  background: var(--c-surface-2); margin-bottom: .25rem;
}
.admin-sidebar-toggle::-webkit-details-marker, .admin-sidebar-toggle::marker { display: none; content: ""; }
.admin-sidebar-toggle::after { content: "▾"; }
.admin-sidebar details[open] .admin-sidebar-toggle::after { content: "▴"; }
.admin-sidebar details > h4,
.admin-sidebar details > nav { display: none; }
.admin-sidebar details[open] > h4,
.admin-sidebar details[open] > nav { display: block; }
.admin-sidebar details[open] > nav { display: flex; flex-direction: column; gap: 2px; }
@media (min-width: 900px) {
  .admin-sidebar-toggle { display: none; }
  .admin-sidebar details > h4,
  .admin-sidebar details > nav { display: block; }
  .admin-sidebar details > nav { display: flex; flex-direction: column; gap: 2px; }
}

.admin-main { min-width: 0; }

.page-head {
  display: flex; flex-direction: column;
  gap: .75rem; margin-bottom: 1.25rem;
}
.page-head h1 { margin: 0; }
.page-head > div:first-child { min-width: 0; flex: 1 1 auto; }
.page-head .flex {
  gap: .5rem; flex-shrink: 0; flex-wrap: wrap;
  width: 100%;
}
@media (max-width: 599px) {
  /* Auf engen Screens: Buttons im page-head full-width stacken */
  .page-head .flex .btn { flex: 1 1 100%; }
  .page-head .flex .btn-sm { flex: 1 1 auto; min-width: 140px; }
}
.page-head .btn { white-space: normal; max-width: 100%; }
@media (min-width: 600px) {
  .page-head { flex-direction: row; align-items: center; justify-content: space-between; gap: 1rem; }
  .page-head .flex { width: auto; }
}

/* ---------- Auth Layout ---------- */

.auth-wrap {
  max-width: 460px; margin: 1.5rem auto;
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--r-lg); padding: 1.25rem; box-shadow: var(--shadow);
}
@media (min-width: 540px) { .auth-wrap { margin: 2.5rem auto; padding: 2rem; } }
.auth-wrap h1 { font-size: 1.5rem; margin-bottom: .35rem; }
.auth-wrap > p:first-of-type { color: var(--c-text-muted); margin-bottom: 1.25rem; }
.auth-wrap .form { padding: 0; border: 0; box-shadow: none; max-width: none; }

/* ---------- Toolbar ---------- */

.toolbar {
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--r); padding: .65rem .85rem;
  display: flex; gap: .5rem; align-items: center; flex-wrap: wrap;
  margin-bottom: 1rem;
}
.toolbar select, .toolbar input[type=text] {
  border: 1px solid var(--c-border-strong); border-radius: var(--r-sm);
  padding: .55rem .7rem; font: inherit; min-height: 40px;
}

/* ---------- Section ---------- */

.section { margin-block: 1.75rem; }
.section-head {
  display: flex; flex-direction: column; gap: .25rem;
  margin-bottom: .75rem;
}
.section-head h2 { margin: 0; }
.section-head p { color: var(--c-text-muted); margin: 0; font-size: .92rem; }
@media (min-width: 600px) {
  .section-head { flex-direction: row; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
}

/* ---------- Print / Aushang ---------- */

@media print {
  .site-header, .site-footer, .no-print { display: none !important; }
  body { background: #fff; }
  .main-content { padding: 0; }
}
.aushang { padding: 1rem; max-width: 800px; margin: 0 auto; }
@media (min-width: 768px) { .aushang { padding: 2rem; } }
.aushang h1 { font-size: clamp(1.5rem, 5vw, 2.2rem); margin-bottom: .25rem; }
.aushang .qr-wrapper { display: flex; justify-content: center; margin: 1.5rem 0; }
.aushang .qr-wrapper svg, .aushang .qr-wrapper img { width: min(280px, 80vw); height: auto; }

/* ---------- Icons ---------- */

.icon {
  display: inline-block; flex-shrink: 0;
  width: 1.1em; height: 1.1em;
  vertical-align: -.18em;
  stroke-width: 2;
}
.icon-sm { width: .95em; height: .95em; }
.icon-lg { width: 1.4em; height: 1.4em; vertical-align: -.25em; }
.icon-xl { width: 1.75rem; height: 1.75rem; }
.icon-xxl { width: 2.25rem; height: 2.25rem; }

/* Stat-Card-Icon im farbigen Kreis */
.stat-icon-bubble {
  display: inline-grid; place-items: center;
  width: 2.4rem; height: 2.4rem;
  border-radius: 12px;
  background: var(--c-primary-50); color: var(--c-primary-700);
  margin-bottom: .55rem;
}
.stat-icon-bubble.accent  { background: var(--c-accent-50); color: var(--c-accent); }
.stat-icon-bubble.success { background: var(--c-success-50); color: var(--c-success); }
.stat-icon-bubble.warn    { background: var(--c-warn-50); color: var(--c-warn); }
.stat-icon-bubble.info    { background: var(--c-info-50); color: var(--c-info); }
.stat-icon-bubble .icon   { width: 1.4rem; height: 1.4rem; stroke-width: 2; }

/* Section-Icon: Kreis mit Icon, neben Überschrift */
.section-head h2 .icon, .section-head h1 .icon { margin-right: .35rem; vertical-align: -.2em; }

/* Step-Icon: Nummer im einfarbigen Kreis (Regenbogen über alle Steps verteilt) */
.step-marker {
  display: inline-grid; place-items: center;
  width: 2rem; height: 2rem; border-radius: 50%;
  background: var(--c-text-soft); color: #fff; font-weight: 700;
  margin-right: .55rem; vertical-align: -.55rem;
  box-shadow: var(--shadow-sm);
}
/* Pro Step in einer Liste eine eigene Regenbogenfarbe */
ol > li:nth-child(1) .step-marker { background: var(--c-rb-red);    }
ol > li:nth-child(2) .step-marker { background: var(--c-rb-orange); }
ol > li:nth-child(3) .step-marker { background: #d4ad0a;            } /* Yellow etwas dunkler für Lesbarkeit */
ol > li:nth-child(4) .step-marker { background: var(--c-rb-green);  }
ol > li:nth-child(5) .step-marker { background: var(--c-rb-blue);   }
ol > li:nth-child(6) .step-marker { background: var(--c-rb-purple); }
ol > li:nth-child(7) .step-marker { background: var(--c-rb-red);    }
ol > li:nth-child(8) .step-marker { background: var(--c-rb-orange); }
ol > li:nth-child(9) .step-marker { background: #d4ad0a;            }

/* Rainbow-CTA-Button: bewusst auffällig */
.btn-rainbow {
  background: var(--rainbow); color: #fff;
  border: 0;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0,0,0,.25);
  box-shadow: 0 2px 6px rgba(216,67,28,.25), 0 4px 16px -4px rgba(106,48,147,.30);
  position: relative;
}
.btn-rainbow:hover {
  color: #fff;
  filter: brightness(1.07);
  transform: translateY(-1px);
}
.btn-rainbow:active { transform: translateY(0); }
.btn-lg {
  padding: .85rem 1.4rem;
  font-size: 1rem;
  min-height: 48px;
}

/* Screenshot-Figur in der ausführlichen Anleitung */
.screenshot {
  margin: 1rem 0; padding: 0;
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--r); overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.screenshot img {
  width: 100%; height: auto; display: block;
  background: var(--c-surface-2);
}
.screenshot figcaption {
  padding: .55rem .85rem; font-size: .85rem;
  color: var(--c-text-muted); border-top: 1px solid var(--c-border);
  background: var(--c-surface-2);
}
.screenshot-placeholder .ph-frame {
  display: grid; place-items: center; gap: .5rem;
  min-height: 220px; padding: 2rem 1rem;
  color: var(--c-text-soft);
  background: repeating-linear-gradient(45deg, var(--c-surface-2), var(--c-surface-2) 12px, var(--c-surface) 12px, var(--c-surface) 24px);
}
.screenshot-placeholder .ph-frame code {
  background: rgba(0,0,0,.04); padding: .15rem .5rem; border-radius: var(--r-sm);
  font-size: .8rem;
}

/* Empty-State Container */
.empty-state {
  text-align: center; padding: 2rem 1rem;
  color: var(--c-text-muted);
}
.empty-state .icon-xxl { color: var(--c-text-soft); margin-bottom: .75rem; }
.empty-state h3 { margin-bottom: .5rem; color: var(--c-text); }

/* ---------- Filter-Form (für lange Filterleisten in Adminansichten) ----------
   Statt vieler Inline-styled Grids — überall, wo eine `.filters`-Form mit vielen
   Selects ist, sorgt diese Klasse für sauberes Stacking auf Mobile. */
.filters {
  display: grid; gap: .6rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
  align-items: end;
}
.filters > div { min-width: 0; }
.filters .filter-actions { display: flex; gap: .4rem; align-items: flex-end; flex-wrap: wrap; }
.filters .filter-actions .btn { flex: 0 0 auto; }
@media (max-width: 539px) {
  .filters { grid-template-columns: 1fr; }
  .filters .filter-actions .btn { flex: 1 1 auto; }
}

/* Optional: Filter unter 600px in <details>-Drawer kollabieren */
.filters-collapsible > summary {
  list-style: none; cursor: pointer; padding: .85rem 1rem;
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--r);
  display: flex; align-items: center; justify-content: space-between;
  font-weight: 600; min-height: 44px;
}
.filters-collapsible > summary::-webkit-details-marker,
.filters-collapsible > summary::marker { display: none; content: ""; }
.filters-collapsible > summary::after { content: "▾"; transition: transform .15s; }
.filters-collapsible[open] > summary { border-radius: var(--r) var(--r) 0 0; border-bottom: 0; }
.filters-collapsible[open] > summary::after { transform: rotate(180deg); }
.filters-collapsible > .filters {
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-top: 0; border-radius: 0 0 var(--r) var(--r);
  padding: .85rem 1rem; margin: 0;
}
@media (min-width: 768px) {
  /* Auf Desktop: Drawer immer offen, Toggle ausblenden */
  .filters-collapsible > summary { display: none; }
  .filters-collapsible > .filters { border-radius: var(--r); padding: .85rem 1rem; }
}

/* ---------- Bessere Wrap-Behavior für .flex-Container ---------- */
@media (max-width: 539px) {
  /* Generische Flex-Reihen mit Buttons bleiben in der Reihe, aber Buttons werden klickbarer */
  .flex .btn-sm, .flex-between .btn-sm { min-height: 40px; }
}

/* ---------- Utility ---------- */

.muted { color: var(--c-text-muted); }
.soft  { color: var(--c-text-soft); }
.tight { margin: 0; }
.center { text-align: center; }
.flex { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.flex-between { display: flex; gap: .5rem; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.flex-between > * { min-width: 0; }
.stack > * + * { margin-top: 1rem; }
.stack-sm > * + * { margin-top: .5rem; }
.mt-2 { margin-top: 2rem; }
.mb-2 { margin-bottom: 2rem; }
.hidden { display: none; }
.no-wrap { white-space: nowrap; }
.full { width: 100%; }
@media (max-width: 599px) {
  .hide-mobile { display: none !important; }
  .full-on-mobile { width: 100% !important; }
}
