/* Bildfreigabe – mobile-first, angelehnt an das Papierformular (Helvetica, feine Linien, Tinte). */

:root {
  --desk: #e6ebef;
  --paper: #ffffff;
  --text: #1d232b;
  --muted: #59636f;
  --rule: #c3cbd4;
  --rule-soft: #dde3e9;
  --ink: #1b2a6b;
  --ink-strong: #121d4d;
  --ink-wash: #eef1f9;
  --error: #b42318;
  --error-wash: #fdf0ee;
  --ok: #1f6b4f;
  --ok-wash: #e9f5ef;
  --warn: #8a5a00;
  --warn-wash: #fdf5e3;

  --font: "Helvetica Neue", Helvetica, Arial, "Liberation Sans", sans-serif;
  --radius: 6px;
  --tap: 48px;
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--desk);
  color: var(--text);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.5;
}

a { color: var(--ink); text-underline-offset: 0.15em; }
a:hover { color: var(--ink-strong); }

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

h1, h2, h3 { line-height: 1.2; margin: 0 0 0.5rem; letter-spacing: -0.01em; }
h1 { font-size: 1.55rem; font-weight: 700; }
h2 { font-size: 1.125rem; font-weight: 700; }
p { margin: 0 0 0.9rem; }
code { font-size: 0.9em; background: var(--rule-soft); padding: 0.05em 0.3em; border-radius: 3px; }

.visually-hidden, .offscreen {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0; padding: 0; margin: -1px;
}

.muted, .hint { color: var(--muted); }
.hint { font-size: 0.9rem; margin: 0.35rem 0 0; }
.break { overflow-wrap: anywhere; }
.mono-ish { font-variant-numeric: tabular-nums; letter-spacing: 0.01em; }

/* ------------------------------------------------------------------ */
/* Seite & Blatt                                                       */
/* ------------------------------------------------------------------ */
.page { padding: 0 0 3rem; }

.sheet {
  background: var(--paper);
  padding: 1.25rem 1rem 2rem;
  max-width: 44rem;
  margin: 0 auto;
}
.sheet-narrow { max-width: 30rem; }
.sheet-medium { max-width: 38rem; }

@media (min-width: 46rem) {
  .page { padding: 2rem 1rem 4rem; }
  .sheet { border: 1px solid var(--rule-soft); border-radius: var(--radius); padding: 2rem 2.25rem 2.5rem; }
}

/* ------------------------------------------------------------------ */
/* Kopf wie im PDF: Titel + Zellen mit kleinen Beschriftungen           */
/* ------------------------------------------------------------------ */
.doc-head h1 { font-size: 1.35rem; margin-bottom: 0.9rem; }

.doc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin: 0 0 1.25rem;
  border-top: 2px solid var(--text);
  border-bottom: 1px solid var(--rule);
}
/* Anlass über die ganze Breite, darunter Fotograf | Datum */
.doc-cell { padding: 0.45rem 0 0.55rem; border-top: 1px solid var(--rule); min-width: 0; }
.doc-cell-title { grid-column: 1 / -1; border-top: 0; }
.doc-cell-date { border-left: 1px solid var(--rule); padding-left: 0.75rem; }
.doc-grid dt { font-size: 0.75rem; color: var(--muted); }
.doc-grid dd { margin: 0.1rem 0 0; font-weight: 600; overflow-wrap: anywhere; }

@media (min-width: 40rem) {
  .doc-grid { grid-template-columns: 2fr 1fr; }
}

.lead { font-size: 1.0625rem; }

/* ------------------------------------------------------------------ */
/* Schritte                                                            */
/* ------------------------------------------------------------------ */
.step { margin-top: 2rem; }
.step h2 {
  display: flex; align-items: baseline; gap: 0.6rem;
  border-top: 2px solid var(--text);
  padding-top: 0.6rem; margin-bottom: 0.8rem;
}
.step-no { color: var(--ink); font-variant-numeric: tabular-nums; }
.step-intro { color: var(--muted); font-size: 0.95rem; margin-bottom: 0.6rem; }
.sub-head { font-weight: 700; font-size: 1rem; padding: 0; margin: 0 0 0.4rem; }

/* Vertragstext */
.contract { margin-top: 0.75rem; font-size: 0.95rem; }
.contract > p { margin-bottom: 0.75rem; }
.clause { border-top: 1px solid var(--rule); }
.clause:last-of-type { border-bottom: 1px solid var(--rule); margin-bottom: 0.9rem; }
.clause summary {
  cursor: pointer; list-style: none; padding: 0.8rem 2rem 0.8rem 0; position: relative;
  font-weight: 600; min-height: var(--tap);
}
.clause summary::-webkit-details-marker { display: none; }
.clause summary::after {
  content: ""; position: absolute; right: 0.4rem; top: 50%; width: 0.55rem; height: 0.55rem;
  border-right: 2px solid var(--ink); border-bottom: 2px solid var(--ink);
  transform: translateY(-70%) rotate(45deg); transition: transform 0.15s ease;
}
.clause[open] summary::after { transform: translateY(-30%) rotate(-135deg); }
.clause-no { color: var(--ink); margin-right: 0.35rem; }
.clause p { margin: 0 0 1rem; hyphens: auto; }
.contract-witness { background: var(--ink-wash); padding: 0.75rem 0.85rem; border-radius: var(--radius); }

/* ------------------------------------------------------------------ */
/* Formularfelder                                                      */
/* ------------------------------------------------------------------ */
.field { margin-bottom: 1rem; }
.field label { display: block; font-weight: 600; font-size: 0.95rem; margin-bottom: 0.3rem; }
.optional { font-weight: 400; color: var(--muted); }

input[type="text"], input[type="email"], input[type="tel"], input[type="password"],
input[type="date"], input:not([type]), textarea {
  width: 100%; min-height: var(--tap);
  font: inherit; font-size: 1.0625rem; color: var(--text);
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--rule); border-radius: var(--radius);
  background: var(--paper);
  appearance: none;
}
textarea { min-height: 5.5rem; resize: vertical; }
input:focus, textarea:focus { border-color: var(--ink); outline: 2px solid var(--ink); outline-offset: 0; }
input[readonly] { background: #f6f8fa; }
input[type="file"] { font: inherit; font-size: 0.95rem; max-width: 100%; }

.has-error input, .has-error textarea { border-color: var(--error); }
.field-error { color: var(--error); font-size: 0.9rem; margin: 0.35rem 0 0; }
.field-error:empty { display: none; }

.field-row { display: grid; gap: 0 0.9rem; }
@media (min-width: 34rem) {
  .field-row { grid-template-columns: 1fr 1fr; }
  .field-row-zip { grid-template-columns: 8rem 1fr; }
}

.check {
  display: flex; gap: 0.75rem; align-items: flex-start;
  min-height: var(--tap); padding: 0.6rem 0; cursor: pointer; font-weight: 600;
}
.check input { width: 1.4rem; height: 1.4rem; margin: 0.05rem 0 0; flex: none; accent-color: var(--ink); }
.check-boxed { border: 1px solid var(--rule); border-radius: var(--radius); padding: 0.85rem; margin: 1rem 0; }
.check-boxed:has(input:checked) { border-color: var(--ink); background: var(--ink-wash); }
.check-boxed.has-error { border-color: var(--error); background: var(--error-wash); }

fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset.guardian {
  border-left: 3px solid var(--ink); padding: 0.25rem 0 0.25rem 0.9rem; margin: 0.5rem 0 1rem;
}
fieldset.guardian > legend { font-weight: 700; padding: 0; margin-bottom: 0.35rem; float: left; width: 100%; }
fieldset.guardian > legend + * { clear: both; }
[hidden] { display: none !important; }

.parental-text { font-size: 0.92rem; color: var(--text); }
.guardian-sign { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--rule); }

/* ------------------------------------------------------------------ */
/* Unterschrift                                                        */
/* ------------------------------------------------------------------ */
.sign-date { margin-bottom: 1rem; }
.sign-date strong { margin-left: 0.4rem; }

.sig { margin: 0 0 1rem; }
.sig-label { font-weight: 600; font-size: 0.95rem; margin-bottom: 0.35rem; }
.sig-pad {
  position: relative; height: 11rem;
  background: var(--paper);
  border: 1px solid var(--rule); border-radius: var(--radius);
  touch-action: none; overscroll-behavior: contain;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
@media (min-width: 34rem) { .sig-pad { height: 12rem; } }
.sig-pad::after {               /* Unterschriftslinie wie im PDF */
  content: ""; position: absolute; left: 1rem; right: 1rem; bottom: 28%;
  border-bottom: 1px solid #8995a2; pointer-events: none;
}
.sig-canvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
  touch-action: none; cursor: crosshair; z-index: 1; border-radius: var(--radius);
}
.sig-x {
  position: absolute; left: 1rem; bottom: calc(28% + 0.15rem);
  font-size: 1.4rem; line-height: 1; color: #8995a2; pointer-events: none;
}
.sig-hint {
  position: absolute; left: 0; right: 0; top: 30%; text-align: center;
  color: var(--muted); font-size: 0.95rem; pointer-events: none; transition: opacity 0.2s ease;
}
.sig.has-ink .sig-hint { opacity: 0; }
.sig.has-error .sig-pad { border-color: var(--error); box-shadow: 0 0 0 1px var(--error); }
.sig-foot { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-top: 0.35rem; }
.sig-foot .field-error { margin: 0.4rem 0 0; }
.sig-foot .btn { margin-left: auto; }

.privacy-box { margin: 1.25rem 0 1.5rem; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.privacy-box summary { cursor: pointer; padding: 0.8rem 0; font-weight: 600; min-height: var(--tap); }
.privacy { font-size: 0.9rem; color: var(--muted); }
.privacy strong { color: var(--text); }

/* ------------------------------------------------------------------ */
/* Schaltflächen                                                       */
/* ------------------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  min-height: var(--tap); padding: 0.6rem 1.1rem;
  font: inherit; font-weight: 600; font-size: 1rem; line-height: 1.2; text-align: center; text-decoration: none;
  border-radius: var(--radius); border: 1px solid transparent; cursor: pointer;
}
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { background: var(--ink-strong); color: #fff; }
.btn-primary:disabled { background: #6b76a3; cursor: progress; }
.btn-quiet { background: var(--paper); color: var(--text); border-color: var(--rule); }
.btn-quiet:hover { border-color: var(--ink); color: var(--ink); }
.btn-danger { background: var(--error); color: #fff; }
.btn-danger-quiet { background: var(--paper); color: var(--error); border-color: var(--rule); }
.btn-danger-quiet:hover { border-color: var(--error); }
.btn-small { min-height: 2.5rem; padding: 0.4rem 0.8rem; font-size: 0.9rem; }
.btn-block { display: flex; width: 100%; margin: 0.5rem 0 1rem; }

.linklike {
  background: none; border: 0; padding: 0; font: inherit; color: var(--ink); cursor: pointer;
  text-decoration: underline; text-underline-offset: 0.15em;
}
form.inline { display: inline; }

/* ------------------------------------------------------------------ */
/* Meldungen                                                           */
/* ------------------------------------------------------------------ */
.flash { padding: 0.75rem 0.9rem; border-radius: var(--radius); margin: 0 auto 1rem; max-width: 44rem; }
.flash-ok { background: var(--ok-wash); color: var(--ok); }
.flash-error { background: var(--error-wash); color: var(--error); }
.flash-warn { background: var(--warn-wash); color: var(--warn); }
.page > .flash { margin: 1rem; }
@media (min-width: 46rem) { .page > .flash { margin: 0 auto 1rem; } }

.error-summary {
  border: 2px solid var(--error); border-radius: var(--radius); background: var(--error-wash);
  padding: 0.85rem 1rem; margin: 1rem 0;
}
.error-summary ul { margin: 0.25rem 0 0.6rem; padding-left: 1.2rem; }
.error-summary a { color: var(--error); }
.error-summary p:last-child { margin: 0; }

.done-mark { color: var(--ok); margin-bottom: 0.75rem; }

/* ------------------------------------------------------------------ */
/* Admin                                                               */
/* ------------------------------------------------------------------ */
body.admin .page { max-width: 62rem; margin: 0 auto; padding: 1.25rem 1rem 4rem; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  padding: 0.75rem 1rem; background: var(--paper); border-bottom: 1px solid var(--rule-soft);
}
.brand { font-weight: 700; color: var(--text); text-decoration: none; }
.topnav { display: flex; gap: 1.1rem; align-items: center; font-size: 0.95rem; }
.topnav a { color: var(--text); text-decoration: none; }
.topnav a:hover { color: var(--ink); text-decoration: underline; }

.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.page-head h1 { margin-bottom: 0.25rem; overflow-wrap: anywhere; }
.crumb { margin: 0 0 0.4rem; font-size: 0.95rem; }

.panel { background: var(--paper); border: 1px solid var(--rule-soft); border-radius: var(--radius); padding: 1rem; margin-bottom: 1.25rem; }
@media (min-width: 46rem) { .panel { padding: 1.25rem 1.5rem; } }
.panel-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.6rem; margin-bottom: 0.6rem; }
.panel-head h2 { margin: 0; }
.count { color: var(--muted); font-weight: 400; margin-left: 0.25rem; }

.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.stack > * + * { margin-top: 0.25rem; }
.empty { color: var(--muted); padding: 1rem 0; }
.empty .btn { margin-top: 0.5rem; }

.event-list { list-style: none; margin: 0; padding: 0; background: var(--paper); border: 1px solid var(--rule-soft); border-radius: var(--radius); }
.event-row { display: grid; grid-template-columns: 1fr auto; gap: 0.25rem 0.75rem; align-items: center; padding: 0.85rem 1rem; }
.event-row + .event-row { border-top: 1px solid var(--rule-soft); }
.event-link { grid-row: span 2; text-decoration: none; color: var(--text); min-width: 0; }
.event-title { display: block; font-weight: 700; color: var(--ink); overflow-wrap: anywhere; }
.event-meta { display: block; color: var(--muted); font-size: 0.9rem; }
.event-folder { display: flex; align-items: center; gap: 0.35rem; color: var(--muted); font-size: 0.85rem; margin-top: 0.15rem; overflow-wrap: anywhere; }
.event-count { justify-self: end; font-weight: 700; font-variant-numeric: tabular-nums; }
@media (min-width: 40rem) {
  .event-row { grid-template-columns: 1fr 4rem 8rem; }
  .event-link { grid-row: auto; }
}

.chip { display: inline-block; font-size: 0.8rem; font-weight: 600; padding: 0.2rem 0.55rem; border-radius: 999px; justify-self: end; white-space: nowrap; }
.chip-aktiv { background: var(--ok-wash); color: var(--ok); }
.chip-deaktiviert, .chip-abgelaufen { background: var(--warn-wash); color: var(--warn); }
.chip-archiviert { background: var(--rule-soft); color: var(--muted); }

.copy-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.5rem; }
.send-row { margin-bottom: 1.1rem; }
.copy-row input { flex: 1 1 18rem; font-size: 0.95rem; }

.qr-row { display: flex; flex-wrap: wrap; gap: 1rem 1.5rem; align-items: center; margin-bottom: 0.75rem; }
.qr { width: 11rem; height: 11rem; image-rendering: pixelated; border: 1px solid var(--rule-soft); border-radius: var(--radius); }
.qr-actions { flex: 1 1 14rem; display: flex; flex-direction: column; align-items: flex-start; gap: 0.5rem; }
.qr-actions p { margin: 0; color: var(--muted); }

.share-text summary { cursor: pointer; font-weight: 600; padding: 0.5rem 0; }
.share-text textarea { margin: 0.25rem 0 0.5rem; font-size: 0.95rem; }

.ico-folder { flex: none; color: var(--ink); }
.folder-name, .folder-preview { display: flex; align-items: center; gap: 0.5rem; margin: 0 0 0.75rem; overflow-wrap: anywhere; }
.folder-name { font-weight: 600; font-variant-numeric: tabular-nums; }
.folder-preview { color: var(--muted); font-size: 0.92rem; margin-top: -0.25rem; }
.folder-preview strong { color: var(--text); font-weight: 600; }
.file-cell { font-size: 0.85rem; color: var(--muted); overflow-wrap: anywhere; }

.table { width: 100%; border-collapse: collapse; font-size: 0.97rem; }
.table th { text-align: left; font-size: 0.8rem; color: var(--muted); font-weight: 600; padding: 0.4rem 0.5rem; border-bottom: 2px solid var(--text); }
.table td { padding: 0.55rem 0.5rem; border-bottom: 1px solid var(--rule-soft); vertical-align: middle; }
.row-actions { text-align: right; white-space: nowrap; }
.row-actions > * + * { margin-left: 0.35rem; }
@media (max-width: 39.99rem) {
  .table thead { display: none; }
  .table tr { display: grid; grid-template-columns: 1fr auto; gap: 0.1rem 0.75rem; padding: 0.7rem 0; border-bottom: 1px solid var(--rule-soft); }
  .table td { border: 0; padding: 0; }
  .table td[data-label="Name"] { font-weight: 700; }
  .table td[data-label="Datum"], .table td[data-label="Minderjährig"] { color: var(--muted); font-size: 0.9rem; }
  .table td[data-label="Minderjährig"]::before { content: "Minderjährig: "; }
  .row-actions { grid-column: 2; grid-row: 1 / span 4; align-self: center; }
}

.facts { display: grid; grid-template-columns: 1fr; gap: 0.15rem 1rem; margin: 0; }
.facts dt { color: var(--muted); font-size: 0.85rem; margin-top: 0.5rem; }
.facts dd { margin: 0; }
@media (min-width: 40rem) {
  .facts { grid-template-columns: 11rem 1fr; }
  .facts dt { margin-top: 0; }
  .facts dt, .facts dd { padding: 0.35rem 0; border-bottom: 1px solid var(--rule-soft); }
}
.selfie { margin: 1rem 0 0; }
.selfie img { max-width: min(100%, 16rem); border-radius: var(--radius); display: block; }
.selfie figcaption { color: var(--muted); font-size: 0.85rem; margin-top: 0.3rem; }

/* QR-Vollbild zum Vorzeigen vor Ort */
body.qr-page { background: #fff; }
.qr-full { text-align: center; padding: 1.5rem 1rem; max-width: 36rem; margin: 0 auto; }
.qr-full img { width: min(86vw, 70vh, 30rem); height: auto; image-rendering: pixelated; display: block; margin: 1rem auto; }
.qr-url { font-size: 0.85rem; color: var(--muted); overflow-wrap: anywhere; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}

@media print {
  body { background: #fff; }
  .topbar, .btn, form { display: none !important; }
}
