:root {
  --brand: #c0151f;
  --ink: #1f2328;
  --muted: #5b6168;
  --line: #d9dce0;
  --bg: #f1f2f4;
  --card: #ffffff;
  --radius: 6px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 var(--font);
}

h1 { font-size: clamp(1.5rem, 1.2rem + 1.5vw, 2.1rem); line-height: 1.2; margin: 0 0 .5rem; }
h2 { font-size: 1.35rem; margin: 0 0 .5rem; }
a { color: var(--brand); }
.muted { color: var(--muted); }
.lead { max-width: 62ch; margin: 0 0 1.5rem; }

:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }

/* ---------- Kopfzeile ---------- */
.topbar { background: #fff; border-top: 5px solid var(--brand); border-bottom: 1px solid var(--line); }
.topbar-inner {
  max-width: 920px; margin: 0 auto; padding: .75rem 1rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.brand { display: flex; align-items: center; gap: .75rem; text-decoration: none; color: var(--ink); }
.brand img { display: block; width: 48px; height: 48px; }
.brand strong { display: block; font-size: 1.15rem; color: var(--brand); line-height: 1.2; }
.brand small { display: block; color: var(--muted); font-size: .85rem; line-height: 1.3; }
.link-quiet { color: var(--muted); font-size: .95rem; }

/* ---------- Inhalt ---------- */
.wrap { max-width: 920px; margin: 0 auto; padding: 2rem 1rem 3rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; }
.foot { max-width: 920px; margin: 0 auto; padding: 0 1rem 2rem; color: var(--muted); font-size: .9rem; }
.foot a { color: var(--muted); }

/* ---------- Formular ---------- */
label { display: block; font-weight: 600; margin: 0 0 .35rem; }
label .muted { font-weight: 400; }
input[type=text], input[type=email], input[type=password] {
  width: 100%; padding: .7rem .8rem; font: inherit; color: inherit;
  background: #fff; border: 1px solid #aeb3b9; border-radius: 4px;
}
input:focus-visible { outline: 3px solid rgba(192, 21, 31, .35); border-color: var(--brand); }

.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 1.5rem 0; }
@media (max-width: 640px) { .fields { grid-template-columns: 1fr; } }

.btn {
  display: inline-block; padding: .8rem 1.4rem; font: inherit; font-weight: 700;
  color: #fff; background: var(--brand); border: 0; border-radius: 4px;
  text-decoration: none; cursor: pointer; text-align: center;
}
.btn:hover { filter: brightness(.92); }
.btn:disabled { background: #b9bdc2; cursor: not-allowed; filter: none; }
.btn-small { padding: .45rem .9rem; font-size: .92rem; }

.alert {
  margin: 1rem 0; padding: .75rem 1rem; border-left: 4px solid var(--brand);
  background: #fdeeee; color: #6b0d13; border-radius: 0 4px 4px 0;
}

/* ---------- Drop-Zone ---------- */
.drop {
  border: 2px dashed var(--brand); border-radius: var(--radius);
  padding: 2.25rem 1rem; text-align: center; cursor: pointer; background: #fff;
}
.drop:hover, .drop.over { background: #fdf1f1; }
.drop p { margin: 0; }
.drop-title { font-size: 1.2rem; font-weight: 700; color: var(--brand); margin-bottom: .25rem !important; }

.thumbs { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; gap: .75rem;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.thumbs li { position: relative; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; background: #fafafa; }
.thumbs img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: #e6e8ea; }
.thumbs .cap { display: block; padding: .3rem .5rem; font-size: .78rem; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thumbs .remove {
  position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; border-radius: 50%;
  border: 0; background: rgba(0, 0, 0, .65); color: #fff; font-size: 1.1rem; line-height: 1; cursor: pointer;
}
.thumbs .remove:hover { background: var(--brand); }
.summary { margin: .75rem 0 0; }

/* ---------- Fortschritt ---------- */
.progress { margin: 0 0 1rem; }
.bar { height: 10px; background: #e3e5e8; border-radius: 5px; overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; background: var(--brand); transition: width .15s linear; }
.progress p { margin: .4rem 0 0; font-size: .9rem; }
@media (prefers-reduced-motion: reduce) { .bar span { transition: none; } }

.done { border-left: 5px solid var(--brand); }
.done .btn { margin-top: .75rem; }

/* ---------- Login / Hinweisseiten ---------- */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 1rem; border-top: 5px solid var(--brand); }
.login-card { width: 100%; max-width: 380px; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 2rem 1.5rem; text-align: center; }
.login-card .logo { display: block; margin: 0 auto 1rem; width: 96px; height: 96px; }
.login-card h1 { font-size: 1.5rem; }
.login-card form { text-align: left; margin-top: 1rem; }
.login-card input { margin-bottom: 1rem; }
.login-card .btn { width: 100%; }

/* ---------- Galerie (Download-Seite) ---------- */
.gallery { list-style: none; margin: 1.5rem 0; padding: 0; display: grid; gap: 1.25rem;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.gallery li { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem; }
.gallery img { display: block; width: 100%; height: auto; max-height: 340px; object-fit: contain;
  background: #e6e8ea; border-radius: 4px; margin-bottom: .75rem; }

/* ---------- QR-Code (kein E-Mail-Versand) ---------- */
.qr { text-align: center; margin: 1rem 0 1.25rem; }
.qr-code { width: min(80vw, 420px); margin: 0 auto; padding: 12px; background: #fff;
  border: 1px solid var(--line); border-radius: var(--radius); }
.qr-code svg { display: block; width: 100%; height: auto; }
.qr-hint { margin: .75rem 0 .25rem; font-size: 1.15rem; font-weight: 700; }
.qr-link { margin: 0; font-size: .8rem; word-break: break-all; }

/* ---------- Verwaltung ---------- */
.topnav { display: flex; gap: 1.25rem; }

input[type=number], select, textarea {
  width: 100%; padding: .7rem .8rem; font: inherit; color: inherit;
  background: #fff; border: 1px solid #aeb3b9; border-radius: 4px;
}
textarea { resize: vertical; line-height: 1.45; }
select:focus-visible, textarea:focus-visible, input[type=number]:focus-visible {
  outline: 3px solid rgba(192, 21, 31, .35); border-color: var(--brand);
}

.tabs { display: flex; gap: .25rem; margin: 1rem 0 1.25rem; border-bottom: 2px solid var(--line); flex-wrap: wrap; }
.tab { padding: .6rem 1.1rem; text-decoration: none; color: var(--muted); font-weight: 600;
  border-bottom: 3px solid transparent; margin-bottom: -2px; }
.tab:hover { color: var(--ink); }
.tab.active { color: var(--brand); border-bottom-color: var(--brand); }

.spaced { margin-top: 1.5rem; }
.notice {
  margin: 1rem 0; padding: .75rem 1rem; border-left: 4px solid #1a7f37;
  background: #eaf6ee; color: #124d24; border-radius: 0 4px 4px 0;
}

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem 1.25rem; }
.grid3 { display: grid; grid-template-columns: 1.2fr 1.2fr 1fr; gap: 1rem 1.25rem; }
.grid2 .full, .grid3 .full { grid-column: 1 / -1; }
.pair { display: grid; grid-template-columns: 1fr 2fr; gap: 1rem; }
@media (max-width: 720px) {
  .grid2, .grid3, .pair { grid-template-columns: 1fr; }
}

.table-wrap { overflow-x: auto; margin-top: 1rem; }
.table { width: 100%; border-collapse: collapse; min-width: 640px; }
.table th, .table td { text-align: left; padding: .6rem .6rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-size: .85rem; color: var(--muted); font-weight: 600; }
.table .actions { white-space: nowrap; }
.table .actions .btn { margin-right: .35rem; }

.btn-secondary { background: #fff; color: var(--ink); border: 1px solid #aeb3b9; }
.btn-secondary:hover { background: #f3f4f6; filter: none; }
.btn-danger { background: #fff; color: #9b1018; border: 1px solid #d9a3a6; }
.btn-danger:hover { background: #fdeeee; filter: none; }
.btn-row { display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; margin-top: 1rem; }

.inline-form { display: flex; gap: .75rem; align-items: flex-end; flex-wrap: wrap; }
.inline-form > div { flex: 1 1 260px; }

fieldset { border: 1px solid var(--line); border-radius: var(--radius); margin: 1.25rem 0 0; padding: 1rem 1.1rem 1.1rem; }
legend { padding: 0 .4rem; font-weight: 700; }
.field { margin-top: .9rem; }
.field:first-of-type { margin-top: 0; }

dl.ph { display: grid; grid-template-columns: max-content 1fr; gap: .25rem 1rem; margin: .5rem 0 0; font-size: .9rem; }
dl.ph dt { margin: 0; } dl.ph dd { margin: 0; color: var(--muted); }
code { background: #eef0f2; padding: .08rem .35rem; border-radius: 3px; font-size: .9em; }

.preview { width: 100%; height: 760px; border: 1px solid var(--line); border-radius: var(--radius); background: #eee; }
h3 { margin: 1.75rem 0 .5rem; font-size: 1.1rem; }
