/* Gemeinsame Designsprache aller Seiten: hell, ruhig, viel Weissraum, Pillen-Buttons, weiche Schatten */
:root {
  --bg: #fbfbfd;
  --soft: #f5f5f7;
  --card: #fff;
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --faint: #86868b;
  --line: #d2d2d7;
  --hair: #ececf0;
  --pink: #ee8f96;
  --pink-soft: #fbe3e5;
  --accent-ink: #b8434e;
  --green: #3aa655;
  --focus: #0071e3;
  --shadow: 0 2px 6px rgba(0, 0, 0, .04), 0 18px 48px rgba(0, 0, 0, .06);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
[hidden] { display: none !important; }
body {
  font-family: -apple-system, "SF Pro Text", "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 17px; color: var(--ink); background: var(--bg); line-height: 1.47;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh; display: flex; flex-direction: column;
}
h1, h2, h3, .brand, nav a { font-family: -apple-system, "SF Pro Display", "Segoe UI", Helvetica, Arial, sans-serif; }
a { color: var(--ink); }

/* Kopfleiste */
.top { position: sticky; top: 0; z-index: 20; background: rgba(251, 251, 253, .82); -webkit-backdrop-filter: saturate(180%) blur(18px); backdrop-filter: saturate(180%) blur(18px); border-bottom: 1px solid rgba(0, 0, 0, .08); }
.top-in { max-width: 1080px; margin: 0 auto; padding: 0 22px; height: 56px; display: flex; align-items: center; gap: 28px; }
.brand { font-size: 18px; font-weight: 700; letter-spacing: -.01em; text-decoration: none; display: flex; align-items: center; gap: 10px; }
.brand-mark { height: 46px; width: auto; display: block; }
.brand-text { font-size: 20px; font-weight: 700; letter-spacing: -.02em; }
.brand-text .org { color: var(--pink); }
nav { display: flex; gap: 24px; margin-left: auto; font-size: 14px; }
nav a { text-decoration: none; color: var(--muted); padding: 4px 0; border-bottom: 2px solid transparent; transition: color .2s; }
nav a:hover { color: var(--ink); }
nav a.on { color: var(--ink); border-bottom-color: var(--pink); }
.crumb { max-width: 1080px; margin: 22px auto 0; padding: 0 22px; font-size: 13px; color: var(--faint); width: 100%; }

main { flex: 1; width: 100%; max-width: 1080px; margin: 0 auto; padding: 22px 22px 56px; }
h1 { font-size: clamp(32px, 5vw, 48px); line-height: 1.08; letter-spacing: -.03em; margin: 10px 0 8px; }
.lead { color: var(--muted); font-size: 19px; margin: 0 0 26px; }

/* Karten */
.card { background: var(--card); border-radius: 26px; box-shadow: var(--shadow); margin-bottom: 24px; overflow: hidden; animation: rise .7s cubic-bezier(.2, .7, .2, 1) both; }
.card:nth-of-type(2) { animation-delay: .08s; } .card:nth-of-type(3) { animation-delay: .16s; } .card:nth-of-type(4) { animation-delay: .24s; }
.card-h { padding: 24px 30px 18px; display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; border-bottom: 1px solid var(--hair); }
.card-h h2 { margin: 0; font-size: 24px; letter-spacing: -.02em; line-height: 1.15; }
.card-h .meta { font-size: 14px; color: var(--muted); margin-top: 3px; }
.card-b { padding: 24px 30px 28px; }

/* Schaltflaechen */
.btn {
  font: inherit; font-weight: 500; font-size: 15px; background: var(--ink); color: #fff; border: 1px solid var(--ink);
  border-radius: 980px; padding: 10px 24px; cursor: pointer; text-decoration: none; display: inline-block;
  transition: background .2s, transform .2s, border-color .2s;
}
.btn:hover { background: #3a3a3d; border-color: #3a3a3d; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: default; transform: none; }
.btn.light { background: #fff; color: var(--ink); border-color: var(--line); }
.btn.light:hover { background: var(--soft); border-color: var(--faint); }
.btn.small { padding: 5px 16px; font-size: 13px; }
.btn.icon { padding: 0; width: 44px; height: 44px; font-size: 20px; line-height: 1; display: inline-flex; align-items: center; justify-content: center; flex: none; }

label { display: block; font-weight: 600; font-size: 14px; margin: 16px 0 6px; }
input, select { font: inherit; width: 100%; padding: 12px 16px; border: 1px solid var(--line); border-radius: 14px; background: #fff; color: var(--ink); transition: border-color .2s, box-shadow .2s; }
input:hover, select:hover { border-color: var(--faint); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 4px rgba(0, 113, 227, .18); }
.btn:focus-visible, a:focus-visible, summary:focus-visible, button:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.row { display: flex; gap: 14px; flex-wrap: wrap; }
.row > * { flex: 1 1 150px; }
.msg-err { color: #b3261e; font-weight: 600; font-size: 15px; min-height: 1.4em; margin: 12px 0 4px; }
.narrow { max-width: 560px; margin-left: auto; margin-right: auto; }
.code-input { font-size: 32px; letter-spacing: 12px; text-align: center; padding: 14px 16px; }
.hint { font-size: 14px; color: var(--muted); }
.art { max-width: 460px; margin: 4px auto 6px; }
.art img { display: block; width: 100%; height: auto; }

/* Chat */
.chat-wrap { display: grid; grid-template-columns: 1fr 240px; gap: 24px; }
.chat-box { height: 62vh; min-height: 340px; overflow-y: auto; padding: 22px 28px; display: flex; flex-direction: column; gap: 10px; background: #fff; scroll-behavior: smooth; }
.bubble { max-width: 78%; padding: 10px 16px; border-radius: 22px 22px 22px 8px; background: var(--soft); align-self: flex-start; word-wrap: break-word; overflow-wrap: anywhere; white-space: pre-wrap; animation: pop .28s cubic-bezier(.2, .7, .2, 1) both; }
.bubble.me { align-self: flex-end; background: var(--pink-soft); border-radius: 22px 22px 8px 22px; }
.bubble .who { font-size: 12px; font-weight: 600; color: var(--muted); display: block; margin-bottom: 1px; }
.bubble .t { font-size: 11px; color: var(--faint); margin-left: 8px; font-weight: 400; }
.sys { align-self: center; font-size: 13px; color: var(--faint); animation: pop .28s ease both; }
.composer { display: flex; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--hair); background: #fff; position: relative; align-items: center; }
.composer input { flex: 1; border-radius: 980px; padding: 12px 20px; background: var(--soft); border-color: transparent; }
.composer input:focus { background: #fff; }
.emoji-panel { position: absolute; left: 24px; bottom: calc(100% + 8px); background: #fff; border-radius: 20px; box-shadow: 0 4px 10px rgba(0, 0, 0, .06), 0 24px 56px rgba(0, 0, 0, .16); padding: 12px; width: min(360px, calc(100% - 48px));
  display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; max-height: 230px; overflow-y: auto; z-index: 5; animation: pop .2s ease both; }
.emoji-panel button { font-size: 22px; line-height: 1.3; background: none; border: 0; border-radius: 10px; cursor: pointer; padding: 3px; }
.emoji-panel button:hover, .emoji-panel button:focus-visible { background: var(--soft); }
.bubble img { display: block; max-width: 260px; max-height: 260px; border-radius: 14px; cursor: zoom-in; margin-top: 4px; }
.bubble img.zoom { max-width: 100%; max-height: none; cursor: zoom-out; }
.bubble .imgnote { font-style: italic; color: var(--muted); font-size: 14px; }
.users { list-style: none; margin: 0; padding: 0; }
.users li { padding: 7px 0; display: flex; align-items: flex-start; gap: 10px; min-width: 0; overflow-wrap: anywhere; font-size: 16px; }
.users li::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--green); flex: none; margin-top: 8px; box-shadow: 0 0 0 4px rgba(58, 166, 85, .15); }
.users li.off::before { background: var(--line); box-shadow: none; }
.lock { font-size: 13px; }
.note-bar { background: var(--soft); border-radius: 18px; padding: 12px 18px; font-size: 14px; color: var(--muted); margin: 0 0 20px; }

/* Haken, Listen, Aufklapper */
.check { display: flex; gap: 12px; align-items: flex-start; font-weight: 400; font-size: 15px; margin: 18px 0 8px; cursor: pointer; }
.check input { width: 22px; height: 22px; flex: none; margin: 1px 0 0; padding: 0; accent-color: var(--ink); box-shadow: none; }
.rules { margin: 6px 0 14px; padding-left: 20px; }
.rules li { margin-bottom: 8px; }
.steps { margin: 8px 0 4px; padding-left: 22px; }
.steps li { margin-bottom: 7px; }
details { border-radius: 18px; margin: 10px 0; background: var(--soft); }
details summary { cursor: pointer; padding: 14px 20px; font-weight: 600; list-style: none; }
details summary::-webkit-details-marker { display: none; }
details summary::after { content: "+"; float: right; font-weight: 400; font-size: 22px; line-height: 1; color: var(--faint); transition: transform .25s; }
details[open] summary::after { transform: rotate(45deg); }
details .steps { padding: 0 20px 12px 42px; margin: 0; }
.legal { max-width: 760px; margin-left: auto; margin-right: auto; }
.legal h3 { font-size: 19px; margin: 26px 0 8px; letter-spacing: -.01em; }

/* Admin: Tabellen und Kennzeichen */
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--faint); }
th, td { text-align: left; padding: 12px 8px; border-bottom: 1px solid var(--hair); vertical-align: top; overflow-wrap: break-word; }
.card-b { overflow-x: auto; }
.card-b table { min-width: 640px; }
td.act { white-space: nowrap; text-align: right; }
td.act .btn { margin-left: 4px; }
.tag { font-size: 12px; font-weight: 600; padding: 3px 11px; border-radius: 980px; background: #e6f4ea; color: #1e6b34; white-space: nowrap; }
.tag.bad { background: #fde7e9; color: #9b2c34; }
.tag.off { background: var(--soft); color: var(--faint); }
.linkbox { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 13px; word-break: break-all; background: var(--soft); border-radius: 14px; padding: 12px 16px; }
.qr { display: block; margin: 12px auto; width: 240px; height: 240px; image-rendering: pixelated; }
code { background: var(--soft); padding: 2px 8px; border-radius: 8px; word-break: break-all; }

/* Betreuer-Einrichtung */
.checks { display: flex; flex-wrap: wrap; gap: 4px 22px; margin: 4px 0 8px; }
.checks .check { margin: 8px 0; }
.setup { background: var(--soft); border-radius: 22px; padding: 22px 24px; margin-top: 20px; }
.setup h3 { margin: 0 0 4px; font-size: 20px; letter-spacing: -.01em; }
.setup-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; align-items: start; }
.setup img { display: block; background: #fff; border-radius: 16px; padding: 8px; width: 240px; max-width: 100%; height: auto; margin: 10px 0; }
.keycode { display: block; letter-spacing: 2px; font-size: 15px; font-family: ui-monospace, "SF Mono", Consolas, monospace; user-select: all; }
.setup input[readonly] { font-size: 13px; font-family: ui-monospace, "SF Mono", Consolas, monospace; background: #fff; }
@media (max-width: 760px) { .setup-grid { grid-template-columns: 1fr; } }

/* Fuss */
footer { color: var(--faint); font-size: 13px; border-top: 1px solid var(--hair); }
footer div { max-width: 1080px; margin: 0 auto; padding: 22px 22px 30px; }
footer a { color: var(--muted); }
footer a:hover { color: var(--ink); }

/* Bewegung (dezent) */
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .card, .bubble, .sys, .emoji-panel { animation: none !important; }
  .btn, input, select, nav a, details summary::after { transition: none; }
  .chat-box { scroll-behavior: auto; }
}

@media (max-width: 760px) {
  .chat-wrap { grid-template-columns: 1fr; }
  .bubble { max-width: 92%; }
  .card-h { padding: 20px 20px 14px; }
  .card-b { padding: 20px 20px 24px; }
  .chat-box { padding: 16px; }
  .composer { padding: 12px; gap: 8px; }
  .emoji-panel { left: 12px; width: calc(100% - 24px); }
  .top-in { gap: 16px; }
  main { padding: 16px 16px 40px; }
}

.flush { margin: 0; }
.side { margin: 0; align-self: start; }
.h-sm { font-size: 19px; }
.rf { margin-top: 18px; align-items: end; }
.rf-btn { flex: 0 0 auto; }
.rf .check { margin: 0 0 10px; }
