:root {
  --primary: #00B8A9;
  --primary-dark: #009689;
  --accent: #FF6F61;
  --bg: #F4F7F6;
  --bubble-me: #00B8A9;
  --bubble-them: #FFFFFF;
  --text-dark: #1E2A28;
  --text-muted: #6B7B79;
  --danger: #E85555;
  --border: #E3EAE9;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  background: #DDE4E3;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  padding: 12px;
}

.mockup-toolbar {
  width: 100%;
  max-width: 500px;
  background: #2B2F36;
  color: #fff;
  font-size: 12px;
  padding: 8px 12px;
  border-radius: 8px;
  margin-bottom: 14px;
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
}
.mockup-label { opacity: 0.7; }
.mockup-toolbar select {
  font-size: 12px;
  padding: 2px 4px;
  border-radius: 4px;
  border: none;
}

.phone {
  width: 390px;
  height: 844px;
  background: #000;
  border-radius: 46px;
  padding: 12px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.35);
  position: relative;
  flex-shrink: 0;
}
.phone-notch {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 26px;
  background: #000;
  border-radius: 0 0 18px 18px;
  z-index: 10;
}
.screen {
  width: 100%;
  height: 100%;
  background: var(--bg);
  border-radius: 34px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  color: var(--text-dark);
}

@media (max-width: 460px) {
  .phone { width: 100%; max-width: 390px; height: 92vh; border-radius: 28px; padding: 8px; }
  .screen { border-radius: 20px; }
}

/* ---------- Generic layout ---------- */
.topbar {
  background: var(--primary);
  color: #fff;
  padding: 46px 16px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.topbar h1 { font-size: 18px; margin: 0; font-weight: 600; }
.topbar .sub { font-size: 12px; opacity: 0.85; margin: 0; }
.topbar-icon-btn {
  background: rgba(255,255,255,0.18);
  border: none;
  color: #fff;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
}

.content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.bottom-nav {
  display: flex;
  background: #fff;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  padding-bottom: 6px;
}
.bottom-nav button {
  flex: 1;
  background: none;
  border: none;
  padding: 10px 0 4px;
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
}
.bottom-nav button .icon { font-size: 20px; }
.bottom-nav button.active { color: var(--primary); font-weight: 600; }

/* ---------- Auth ---------- */
.auth-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 40px 28px;
  background: linear-gradient(160deg, var(--primary) 0%, #007F74 100%);
  color: #fff;
}
.auth-logo {
  width: 64px; height: 64px;
  background: #fff;
  border-radius: 20px;
  display: flex; align-items: center; justify-content: center;
  font-size: 30px;
  margin-bottom: 18px;
}
.auth-screen h1 { font-size: 24px; margin: 0 0 4px; }
.auth-screen p.tagline { margin: 0 0 28px; opacity: 0.85; font-size: 13px; }
.auth-tabs { display: flex; gap: 6px; margin-bottom: 18px; }
.auth-tabs button {
  flex: 1;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.4);
  background: transparent;
  color: #fff;
  font-size: 13px;
  cursor: pointer;
}
.auth-tabs button.active { background: #fff; color: var(--primary-dark); font-weight: 600; border-color: #fff; }
.auth-form input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: none;
  margin-bottom: 10px;
  font-size: 14px;
}
.auth-form .captcha-box {
  background: rgba(255,255,255,0.12);
  border: 1px dashed rgba(255,255,255,0.5);
  border-radius: 10px;
  padding: 10px;
  font-size: 12px;
  margin-bottom: 14px;
  text-align: center;
  opacity: 0.9;
}
.btn-primary {
  width: 100%;
  padding: 13px;
  border-radius: 10px;
  border: none;
  background: #fff;
  color: var(--primary-dark);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}

/* ---------- Pending ---------- */
.pending-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px;
}
.pending-screen .emoji { font-size: 52px; margin-bottom: 18px; }
.pending-screen h2 { margin: 0 0 8px; font-size: 18px; }
.pending-screen p { color: var(--text-muted); font-size: 13px; line-height: 1.5; }

/* ---------- Chat list ---------- */
.chat-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
}
.avatar {
  width: 46px; height: 46px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 600; font-size: 15px;
  flex-shrink: 0;
}
.chat-item-body { flex: 1; min-width: 0; }
.chat-item-top { display: flex; justify-content: space-between; align-items: baseline; }
.chat-item-name { font-size: 14px; font-weight: 600; }
.chat-item-time { font-size: 11px; color: var(--text-muted); }
.chat-item-preview {
  font-size: 12.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.unread-badge {
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 5px;
  margin-left: 6px;
}
.section-label {
  padding: 10px 16px 4px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  background: var(--bg);
}

/* ---------- Chat view ---------- */
.chat-header {
  background: var(--primary);
  color: #fff;
  padding: 46px 12px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.chat-header .back { background: none; border: none; color: #fff; font-size: 18px; cursor: pointer; padding: 4px 6px; }
.chat-header .name { font-size: 15px; font-weight: 600; }
.chat-header .meta { font-size: 11px; opacity: 0.8; }

.messages { flex: 1; overflow-y: auto; padding: 14px 12px; display: flex; flex-direction: column; gap: 10px; }
.msg-row { display: flex; flex-direction: column; max-width: 78%; }
.msg-row.me { align-self: flex-end; align-items: flex-end; }
.msg-row.them { align-self: flex-start; align-items: flex-start; }
.msg-sender { font-size: 11px; color: var(--primary-dark); font-weight: 600; margin-bottom: 2px; padding: 0 4px; }
.bubble {
  padding: 9px 12px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.4;
  position: relative;
  box-shadow: 0 1px 1px rgba(0,0,0,0.04);
}
.msg-row.me .bubble { background: var(--bubble-me); color: #fff; border-bottom-right-radius: 4px; }
.msg-row.them .bubble { background: var(--bubble-them); color: var(--text-dark); border-bottom-left-radius: 4px; }
.bubble img { max-width: 100%; border-radius: 10px; display: block; margin-top: 4px; }
.msg-time { font-size: 10px; color: var(--text-muted); margin-top: 3px; padding: 0 4px; }
.reactions {
  display: flex; gap: 3px; margin-top: 4px;
  background: #fff; border: 1px solid var(--border);
  border-radius: 12px; padding: 2px 7px; font-size: 12px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}
.system-msg {
  align-self: center;
  font-size: 11.5px;
  color: var(--text-muted);
  background: #E9F2F1;
  padding: 5px 12px;
  border-radius: 10px;
}
.broadcast-lock {
  align-self: center;
  font-size: 11px;
  color: var(--text-muted);
  display: flex; align-items: center; gap: 4px;
}

.composer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: #fff;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.composer button.icon-btn {
  background: none; border: none; font-size: 20px; color: var(--text-muted); cursor: pointer;
}
.composer input[type=text] {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 9px 14px;
  font-size: 13.5px;
  background: var(--bg);
}
.composer .send-btn {
  background: var(--primary);
  color: #fff;
  border: none;
  width: 36px; height: 36px;
  border-radius: 50%;
  font-size: 15px;
  cursor: pointer;
}
.composer-blocked {
  padding: 14px 16px;
  background: #fff;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  flex-shrink: 0;
}

/* ---------- Admin ---------- */
.admin-card {
  background: #fff;
  margin: 10px 12px;
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.admin-card-top { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.admin-card-name { font-weight: 600; font-size: 14px; }
.admin-card-meta { font-size: 11.5px; color: var(--text-muted); }
.admin-actions { display: flex; gap: 8px; }
.admin-actions button {
  flex: 1;
  padding: 8px;
  border-radius: 8px;
  border: none;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.btn-approve { background: var(--primary); color: #fff; }
.btn-reject { background: #F1E4E4; color: var(--danger); }
.role-pill {
  display: inline-block;
  font-size: 10.5px;
  padding: 2px 8px;
  border-radius: 8px;
  background: var(--bg);
  color: var(--text-muted);
  margin-top: 4px;
}

.empty-state {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* ---------- Extra: real-app additions (Fehler, Modal, Formulare) ---------- */
.error-box {
  background: #FCEBEB;
  color: var(--danger);
  border: 1px solid #F1CFCF;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12.5px;
  margin-bottom: 10px;
}
.info-box {
  background: #E9F2F1;
  color: var(--primary-dark);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12.5px;
  margin-bottom: 10px;
}
.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.35);
  display: flex;
  align-items: flex-end;
  z-index: 50;
}
.modal-sheet {
  background: #fff;
  width: 100%;
  border-radius: 18px 18px 0 0;
  padding: 18px 16px 24px;
  max-height: 80%;
  overflow-y: auto;
}
.modal-sheet h2 { margin: 0 0 12px; font-size: 16px; }
.modal-sheet label { display: block; font-size: 12px; color: var(--text-muted); margin: 10px 0 4px; }
.modal-sheet input[type=text], .modal-sheet select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 13.5px;
}
.type-tabs { display: flex; gap: 6px; margin-top: 6px; }
.type-tabs button {
  flex: 1;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  font-size: 12.5px;
  cursor: pointer;
}
.type-tabs button.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.member-list { max-height: 180px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; margin-top: 4px; }
.member-row { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-bottom: 1px solid var(--border); font-size: 13px; }
.member-row:last-child { border-bottom: none; }
.modal-actions { display: flex; gap: 8px; margin-top: 16px; }
.modal-actions button { flex: 1; }
.btn-secondary {
  padding: 13px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-dark);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}
.role-select {
  font-size: 11px;
  padding: 3px 6px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
}
.admin-card-actions { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; align-items: center; }
.status-pill {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 8px;
  font-weight: 600;
}
.status-pill.aktiv { background: #E4F6EE; color: #1F9D5A; }
.status-pill.wartend { background: #FFF3DE; color: #B8860B; }
.status-pill.gesperrt { background: #FCEBEB; color: var(--danger); }
.composer input[type=file] { display: none; }
.msg-row .bubble { white-space: pre-wrap; word-break: break-word; }
.msg-delete {
  background: none; border: none; color: var(--text-muted); font-size: 10px; cursor: pointer; padding: 2px 4px;
}
.logout-btn {
  background: rgba(255,255,255,0.18);
  border: none;
  color: #fff;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
}
.spinner-line { text-align: center; padding: 20px; color: var(--text-muted); font-size: 12.5px; }
