/* =====================================================================
   IR App — Weboberfläche
   Design eng an der Original-Community-Plattform (coapp) orientiert:
   warmer grauer Hintergrund, flache weiße Karten (kein Schlagschatten,
   Radius 18px), rote Autorennamen, zentrale Suche, „Manage"-Button.
   ===================================================================== */

:root {
  --red: #E50039;               /* echtes IR-Rot (aus dem Logo) */
  --red-dark: #C10030;
  --red-soft: #FCE6EC;
  --red-tint: #FBE9EF;          /* zarte Tönung für aktive Navigation */
  --brand-grey: #766E64;        /* warmes Grau aus dem Logo */
  --surface: #F6F5F4;           /* warmes Grau wie im Original */
  --card: #FFFFFF;
  --ink: #1F2328;
  --ink-soft: #5B6169;
  --ink-faint: #8B9099;
  --line: #ECEBEA;
  --line-strong: #E2E1E0;
  --online: #2FBF71;
  --radius: 18px;
  --radius-sm: 12px;
  --nav-w: 236px;
  --right-w: 300px;
  --header-h: 64px;
  --font: 'Inter', Helvetica, Arial, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* Tastaturbedienung: Wer mit Tabulator arbeitet, muss sehen, wo er steht.
   :focus-visible statt :focus — beim Antippen und Klicken erscheint kein Ring. */
:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Wer im Betriebssystem weniger Bewegung eingestellt hat, bekommt sie nicht.
   Betrifft auch Menschen, die auf Bewegung mit Schwindel reagieren. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

html, body {
  height: 100%;
  font-family: var(--font);
  color: var(--ink);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.55;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font-family: inherit; font-size: inherit; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

.boot {
  position: fixed; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 20px; background: var(--surface);
}
.boot-logo { width: 72px; height: 72px; }
.boot-logo img { width: 100%; height: 100%; object-fit: contain; }
.boot-spin, .spin {
  width: 24px; height: 24px; border-radius: 50%;
  border: 3px solid var(--line-strong); border-top-color: var(--red);
  animation: spin .7s linear infinite; margin: 10px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* =====================================================================
   Login
   ===================================================================== */
.login-wrap {
  min-height: 100dvh; display: grid; place-items: center; padding: 24px; background: var(--surface);
}
.login-card {
  width: 100%; max-width: 400px; background: var(--card);
  border-radius: var(--radius); border: 1px solid var(--line); padding: 34px 30px;
}
.login-brand { display: flex; align-items: center; justify-content: center; margin-bottom: 26px; }
.login-brand .login-logo { height: 46px; width: auto; display: block; }
.login-card h1 { font-size: 21px; margin-bottom: 4px; text-align: center; }
.login-card p.sub { color: var(--ink-soft); margin-bottom: 16px; font-size: 14px; text-align: center; }
.login-note { font-size: 12.5px; line-height: 1.5; color: var(--ink-soft); background: var(--surface);
  border: 1px solid var(--line); border-radius: 12px; padding: 11px 13px; margin-bottom: 20px; text-align: center; }

/* Einwilligungs-Banner für Web-Analyse (Google Analytics) */
#ga-consent {
  position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 2000;
  max-width: 520px; margin: 0 auto; background: var(--card);
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  box-shadow: 0 10px 34px rgba(31,35,40,.18); padding: 16px 18px;
  display: flex; flex-direction: column; gap: 12px;
}
#ga-consent .ga-c-body strong { font-size: 14.5px; }
#ga-consent .ga-c-body p { margin: 4px 0 0; font-size: 13px; color: var(--ink-soft); line-height: 1.5; }
#ga-consent .ga-c-body a { color: var(--red); }
#ga-consent .ga-c-actions { display: flex; gap: 10px; justify-content: flex-end; }
#ga-consent .ga-btn {
  padding: 9px 18px; border-radius: 999px; font-weight: 600; font-size: 14px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
}
#ga-consent .ga-btn.ga-yes { background: var(--red); color: #fff; border-color: var(--red); }
@media (max-width: 520px) {
  #ga-consent .ga-c-actions { justify-content: stretch; }
  #ga-consent .ga-btn { flex: 1; }
}

.field { margin-bottom: 15px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--ink-soft); }
.field input, .field textarea, .field select {
  width: 100%; padding: 12px 14px; border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); background: #fff; color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft);
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px; border-radius: 999px; font-weight: 600; font-size: 14.5px;
  background: var(--red); color: #fff; transition: background .15s, transform .05s;
}
.btn:hover { background: var(--red-dark); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.block { width: 100%; }
.btn.ghost { background: transparent; color: var(--ink-soft); border: 1px solid var(--line-strong); }
.btn.ghost:hover { background: var(--surface); color: var(--ink); }
.btn.sm { padding: 8px 14px; font-size: 13px; }

.form-error { background: var(--red-soft); color: var(--red-dark); padding: 11px 13px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 16px; }
.form-ok { background: #E9F7EF; color: #1A7A44; padding: 11px 13px; border-radius: var(--radius-sm); font-size: 13px; margin-top: 14px; }
.link-btn { color: var(--red); font-weight: 600; font-size: 13.5px; background: none; }
.link-btn:hover { text-decoration: underline; }

/* Modal-Overlay (z. B. Passwort vergessen) */
.modal-overlay {
  position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; padding: 24px;
  background: rgba(20, 25, 35, .45); backdrop-filter: blur(2px);
}
.modal-overlay .login-card { max-width: 400px; }

/* Gefahrenzone / Konto löschen */
.danger-zone { border-color: #F3C9CB; }

/* Admin: Mitglieder verwalten */
.manage-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 4px; border-top: 1px solid var(--line); }
.manage-row:first-child { border-top: none; }
.manage-actions { display: flex; gap: 6px; margin-left: auto; flex-wrap: wrap; }
.status-pill { font-size: 11px; font-weight: 700; padding: 2px 10px; border-radius: 999px; }
.status-pill.on { background: #E9F7EF; color: #1A7A44; }
.status-pill.off { background: var(--surface); color: var(--ink-faint); border: 1px solid var(--line-strong); }
.reset-link-box { flex-basis: 100%; margin-top: 8px; background: var(--surface); border-radius: 10px; padding: 12px; }
.reset-link-box input { width: 100%; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 8px; font-size: 12px; background: #fff; }

/* Social-Login */
.social-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.social-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 11px 16px; border-radius: 999px; font-weight: 600; font-size: 14px;
  border: 1px solid var(--line-strong); background: #fff; color: var(--ink);
  transition: background .12s, border-color .12s;
}
.social-btn:hover { background: var(--surface); }
.social-btn .g-ic { width: 18px; height: 18px; flex-shrink: 0; }
.social-btn.apple { background: #000; color: #fff; border-color: #000; }
.social-btn.apple:hover { background: #1a1a1a; }
.social-btn.facebook { background: #1877F2; color: #fff; border-color: #1877F2; }
.social-btn.facebook:hover { background: #1568d8; }
.divider { display: flex; align-items: center; gap: 12px; margin: 4px 0 18px; color: var(--ink-faint); font-size: 12.5px; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line-strong); }
.login-legal { text-align: center; margin-top: 18px; font-size: 13px; color: var(--ink-faint); display: flex; gap: 10px; justify-content: center; }
.login-legal a { color: var(--ink-soft); }
.login-legal a:hover { color: var(--red); }

/* =====================================================================
   App-Layout & Header
   ===================================================================== */
.app-header {
  position: sticky; top: 0; z-index: 40; height: var(--header-h);
  display: flex; align-items: center; gap: 10px; padding: 0 14px;   /* Basis: Handy */
  background: var(--surface); border-bottom: 1px solid var(--line);
}
@media (min-width: 701px) { .app-header { gap: 18px; padding: 0 22px; } }
.app-header .brand { display: flex; align-items: center; flex-shrink: 0; }
.app-header .brand .brand-logo { height: 30px; width: auto; display: block; }

/* Kopfsuche: am Handy kein Platz (Suche über die Navigation), ab Tablet sichtbar */
.header-search { display: none; flex: 1; max-width: 560px; margin: 0 auto; position: relative; }
.header-search input {
  width: 100%; padding: 10px 16px 10px 40px; border: 1px solid var(--line-strong);
  border-radius: 999px; background: #fff; font-size: 14px;
}
.header-search input:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
.header-search .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-faint); font-size: 15px; }

.header-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.round-btn {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  background: #fff; border: 1px solid var(--line-strong); color: var(--ink-soft); font-size: 17px;
  position: relative; transition: background .12s;
}
.round-btn:hover { background: var(--surface); color: var(--ink); }
.round-btn .badge-dot { position: absolute; top: 7px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--red); border: 1.5px solid #fff; }
.btn-manage { background: var(--red); color: #fff; padding: 9px 14px; border-radius: 999px; font-weight: 700; font-size: 14px; white-space: nowrap; }
@media (min-width: 701px) { .btn-manage { padding: 9px 20px; } }
.btn-manage:hover { background: var(--red-dark); }

/* MOBILE FIRST: Basis ist das Handy — eine Spalte, Platz unten für die
   Bottom-Navigation. Größere Bildschirme erweitern das weiter unten. */
.layout {
  max-width: 640px; margin: 0 auto; padding: 14px 12px 88px;
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px;
  align-items: start;
}
.col-left, .col-right { display: none; }
.col-sticky { position: sticky; top: calc(var(--header-h) + 22px); }

/* ---- linke Navigation: direkt auf dem Hintergrund, keine Karte ---- */
.channel-nav { display: flex; flex-direction: column; gap: 2px; }
.channel-nav .nav-item {
  display: flex; align-items: center; gap: 13px; width: 100%;
  padding: 10px 14px; border-radius: 999px; color: var(--ink); font-weight: 500; font-size: 14.5px;
  text-align: left; transition: background .12s;
}
.channel-nav .nav-item:hover { background: #EFEEED; }
.channel-nav .nav-item.active { background: var(--red-tint); color: var(--ink); font-weight: 600; }
.channel-nav .nav-item .ic { width: 22px; text-align: center; flex-shrink: 0; font-size: 16px; opacity: .85; }
.channel-nav .nav-item .count { margin-left: auto; font-size: 12px; color: var(--ink-faint); font-weight: 500; }
.channel-nav .sep { height: 1px; background: var(--line-strong); margin: 8px 12px; }
.channel-nav .add-channel {
  display: flex; align-items: center; gap: 10px; margin-top: 6px;
  padding: 10px 16px; border-radius: 999px; border: 1px solid var(--line-strong);
  background: #fff; color: var(--ink-soft); font-weight: 600; font-size: 14px; align-self: flex-start;
}
.channel-nav .add-channel:hover { background: var(--surface); }

/* ---- Mittelspalte ---- */
.feed { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.card { background: var(--card); border-radius: var(--radius); border: 1px solid var(--line); overflow: hidden; }

.composer { background: var(--card); border-radius: var(--radius); border: 1px solid var(--line); padding: 16px; }
.composer .composer-top { display: flex; align-items: center; gap: 12px; }
.composer textarea {
  width: 100%; border: 1px solid var(--line-strong); resize: none; min-height: 46px; max-height: 300px;
  padding: 12px 16px; background: var(--surface); border-radius: 999px; transition: border-radius .15s;
}
.composer textarea:focus { outline: none; border-color: var(--red); background: #fff; border-radius: 16px; box-shadow: 0 0 0 3px var(--red-soft); }
.composer .composer-bar { display: none; align-items: center; gap: 10px; margin-top: 12px; }
.composer.open .composer-bar { display: flex; }
.composer.open textarea { border-radius: 16px; background: #fff; }
.composer select { padding: 8px 14px; border: 1px solid var(--line-strong); border-radius: 999px; background: #fff; color: var(--ink-soft); font-size: 13.5px; }
.composer .btn { margin-left: auto; }

/* ---- Beitrag ---- */
.post { padding: 20px 22px; }
.post-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.post-head .meta { min-width: 0; }
.post-head .name { font-weight: 700; color: var(--red); font-size: 15px; display: inline-flex; align-items: center; gap: 7px; }
.post-head .name .who { color: var(--red); }
.post-head .time { font-size: 13px; color: var(--ink-faint); }
.post-head .sub { font-size: 13px; color: var(--ink-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge-channel { font-size: 11px; font-weight: 700; color: var(--red-dark); background: var(--red-soft); padding: 2px 9px; border-radius: 999px; }
.admin-tag { font-size: 10.5px; font-weight: 700; color: var(--ink-faint); background: var(--surface); border: 1px solid var(--line-strong); padding: 1px 7px; border-radius: 999px; text-transform: uppercase; letter-spacing: .03em; }

.post-body { color: var(--ink); word-wrap: break-word; font-size: 15px; line-height: 1.6; }
.post-body p { margin: 0 0 10px; }
.post-body p:last-child { margin-bottom: 0; }
.post-body a { color: var(--red); text-decoration: none; }
.post-body a:hover { text-decoration: underline; }
.post-body.clamp { display: -webkit-box; -webkit-line-clamp: 7; -webkit-box-orient: vertical; overflow: hidden; }
.show-more { display: block; margin: 10px auto 0; padding: 7px 16px; border-radius: 999px; background: var(--surface); color: var(--ink-soft); font-weight: 600; font-size: 13px; }
.show-more:hover { background: #EDECEB; }

.post-menu { margin-left: auto; position: relative; }
.icon-btn { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: var(--ink-faint); transition: background .12s, color .12s; }
.icon-btn:hover { background: var(--surface); color: var(--ink); }

/* Bildergalerie */
.post-images { margin-top: 14px; border-radius: 14px; overflow: hidden; display: grid; gap: 3px; }
.post-images img { width: 100%; height: 100%; object-fit: cover; aspect-ratio: 3 / 2; background: var(--surface); cursor: pointer; transition: opacity .12s; }
.post-images img:hover { opacity: .93; }
.post-images.n-1 { grid-template-columns: 1fr; }
.post-images.n-2, .post-images.n-3, .post-images.n-4 { grid-template-columns: 1fr 1fr; }
.post-images.n-3 img:first-child { grid-column: span 2; aspect-ratio: 2 / 1; }
.post-images .more-wrap { position: relative; }
.post-images .more-badge { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(20,30,45,.55); color: #fff; font-size: 26px; font-weight: 700; cursor: pointer; }

.lightbox { position: fixed; inset: 0; z-index: 200; background: rgba(15,20,30,.9); display: grid; place-items: center; padding: 24px; cursor: zoom-out; }
.lightbox img { max-width: 96vw; max-height: 92vh; border-radius: 8px; }

/* Avatare */
.avatar { width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0; position: relative; background: var(--red); color: #fff; display: grid; place-items: center; font-weight: 600; font-size: 15px; }
.avatar.sm { width: 34px; height: 34px; font-size: 12px; }
.avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.avatar .dot { position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px; border-radius: 50%; background: var(--online); border: 2px solid #fff; }

/* Reaktionen + Aktionen */
.post-actions { display: flex; align-items: center; gap: 8px; margin-top: 16px; }
.react-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.react-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 13px; border-radius: 999px; background: #fff; border: 1px solid var(--line-strong); font-size: 14px; font-weight: 600; color: var(--ink-soft); transition: background .12s, border-color .12s; }
.react-chip:hover { background: var(--surface); }
.react-chip.mine { background: var(--red-soft); border-color: #F0C9CB; color: var(--red-dark); }
.react-chip.react-add { color: var(--ink-faint); font-size: 17px; padding: 6px 12px; }
.action-link { display: inline-flex; align-items: center; gap: 7px; color: var(--ink-soft); font-size: 14px; font-weight: 500; padding: 6px 12px; border-radius: 999px; }
.action-link:hover { background: var(--surface); }
.action-link.right { margin-left: auto; }
.post-actions .spacer { margin-left: auto; }

/* Kommentare */
.comments { border-top: 1px solid var(--line); margin: 16px -22px -20px; padding: 16px 22px; background: #FBFBFA; display: flex; flex-direction: column; gap: 14px; }
.comment { display: flex; gap: 10px; }
.comment .bubble { background: var(--surface); border-radius: 14px; padding: 9px 14px; min-width: 0; }
.comment .bubble .name { font-weight: 700; font-size: 13px; color: var(--red); }
.comment .bubble .text { font-size: 14px; white-space: pre-wrap; word-wrap: break-word; }
.comment .time { font-size: 11.5px; color: var(--ink-faint); margin-top: 3px; padding-left: 4px; }
.comment-form { display: flex; gap: 10px; align-items: flex-start; }
.comment-form textarea { flex: 1; border: 1px solid var(--line-strong); border-radius: 18px; padding: 10px 14px; resize: none; min-height: 42px; background: #fff; }
.comment-form textarea:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }

/* Popover */
.popover { position: absolute; z-index: 50; background: #fff; border: 1px solid var(--line-strong); border-radius: 14px; box-shadow: 0 10px 34px rgba(20,30,45,.14); padding: 6px; top: 100%; right: 0; margin-top: 4px; }
.reaction-picker { display: flex; gap: 2px; }
.reaction-picker button { font-size: 22px; padding: 5px 7px; border-radius: 10px; transition: transform .1s, background .1s; }
.reaction-picker button:hover { background: var(--surface); transform: scale(1.25); }
.menu-list button { display: block; width: 100%; text-align: left; padding: 9px 16px; border-radius: 8px; font-size: 14px; color: var(--ink); white-space: nowrap; }
.menu-list button:hover { background: var(--surface); }
.menu-list button.danger { color: var(--red); }

/* ---- rechte Widgets ---- */
.widget { margin-bottom: 22px; }
.widget-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; padding: 0 6px; }
.widget-head .w-ic { color: var(--ink-soft); font-size: 16px; }
.widget-head h3 { font-size: 15px; font-weight: 700; color: var(--ink); }
.widget-head .chev { margin-left: auto; color: var(--ink-faint); }
.widget .row { display: flex; align-items: center; gap: 11px; padding: 7px 6px; border-radius: 10px; }
.widget a.row:hover { background: #EFEEED; }
.widget .row .meta { min-width: 0; }
.widget .row .name { font-size: 14px; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.widget .row .sub { font-size: 12px; color: var(--ink-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.widget .add-row { display: flex; align-items: center; gap: 11px; padding: 8px 6px; color: var(--red); font-weight: 600; font-size: 14px; }
.widget .add-row .plus { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--red-soft); color: var(--red); }
.event-mini { display: flex; gap: 12px; padding: 8px 6px; align-items: center; border-radius: 10px; }
.event-mini:hover { background: #EFEEED; }
.event-mini .thumb { width: 46px; height: 46px; border-radius: 10px; background: var(--red-soft); color: var(--red-dark); display: grid; place-items: center; text-align: center; flex-shrink: 0; line-height: 1.1; }
.event-mini .thumb .d { font-weight: 800; font-size: 16px; }
.event-mini .thumb .m { font-size: 10px; text-transform: uppercase; }

/* Vorgeschlagene Inhalte (horizontale Kartenreihe) */
.suggested { margin-bottom: 4px; }
.suggested .sug-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; padding: 0 2px; }
.suggested .sug-head .t { font-size: 14px; color: var(--ink-soft); font-weight: 600; }
.suggested .sug-head .reload { font-size: 13px; color: var(--red); font-weight: 600; cursor: pointer; }
.sug-scroll { display: grid; grid-auto-flow: column; grid-auto-columns: 150px; gap: 12px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; }
.sug-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.sug-card .sug-img { height: 110px; background: linear-gradient(135deg, var(--red-soft), #fff); display: grid; place-items: center; color: var(--red); font-size: 30px; }
.sug-card .sug-t { padding: 9px 11px; font-size: 13px; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* =====================================================================
   Seiten (Mitglieder, Events, Profil)
   ===================================================================== */
.page { max-width: 900px; margin: 0 auto; padding: 14px 12px 88px; }
.page-head { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.page-head h1 { font-size: 23px; }
.page-head .btn { margin-left: auto; }

.member-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.member-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; transition: border-color .12s; }
.member-card:hover { border-color: var(--line-strong); }
.member-card .avatar { width: 62px; height: 62px; font-size: 21px; margin-bottom: 6px; }
.member-card .name { font-weight: 700; color: var(--ink); }
.member-card .company { font-size: 13px; color: var(--ink-soft); }
.member-card .role { font-size: 12px; color: var(--ink-faint); }

.event-list { display: flex; flex-direction: column; gap: 14px; }
.event-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: flex; gap: 16px; }
.event-card .date-box { width: 64px; height: 64px; border-radius: 12px; background: var(--red); color: #fff; display: grid; place-items: center; text-align: center; flex-shrink: 0; line-height: 1.15; }
.event-card .date-box .d { font-weight: 800; font-size: 22px; }
.event-card .date-box .m { font-size: 11px; text-transform: uppercase; }
.event-card .info { flex: 1; min-width: 0; }
.event-card .info h3 { font-size: 17px; margin-bottom: 4px; }
.event-card .info .where { font-size: 13px; color: var(--ink-soft); }
.event-card .rsvp { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.chip-toggle { padding: 7px 15px; border-radius: 999px; border: 1px solid var(--line-strong); font-size: 13px; font-weight: 600; color: var(--ink-soft); background: #fff; }
.chip-toggle.on { background: var(--red); color: #fff; border-color: var(--red); }

.empty { text-align: center; color: var(--ink-faint); padding: 50px 20px; }
.empty .big { font-size: 34px; margin-bottom: 10px; }

.toast-wrap { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 999px; font-size: 14px; box-shadow: 0 8px 30px rgba(20,30,45,.2); animation: toast-in .2s ease; }
.toast.err { background: var(--red-dark); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

/* Bottom-Navigation: am Handy die Hauptnavigation (Basis), ab Tablet ausgeblendet */
.bottom-nav {
  display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
  background: rgba(255,255,255,.94); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line-strong); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.bottom-nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 0; min-height: 44px;            /* Touch-Ziel */
  color: var(--ink-faint); font-size: 11px; font-weight: 600;
}
.bottom-nav a.active { color: var(--red); }
.bottom-nav a .ic { font-size: 20px; }
.fab {
  position: fixed; right: 18px; bottom: calc(74px + env(safe-area-inset-bottom)); z-index: 41;
  width: 56px; height: 56px; border-radius: 18px; background: var(--red); color: #fff;
  display: grid; place-items: center; font-size: 26px; box-shadow: 0 8px 30px rgba(193,39,45,.4);
}

/* =====================================================================
   Responsiv
   ===================================================================== */
/* Auswahl-Chips (Funktionen, Regionen) — Mehrfachauswahl per Antippen.
   Touch-Ziel bewusst ≥ 40px hoch (mobile first). */
.chip-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.sel-chip {
  padding: 10px 15px; min-height: 42px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--card);
  color: var(--ink-soft); font-size: 14px; font-weight: 600;
}
.sel-chip.active { background: var(--red); border-color: var(--red); color: #fff; }
/* Vereinsamt: reine Anzeige (von der Verwaltung gepflegt) */
.amt-chip {
  display: inline-flex; align-items: center; padding: 8px 14px; border-radius: 999px;
  background: var(--red-tint); border: 1px solid var(--red-soft);
  color: var(--red-dark); font-size: 13.5px; font-weight: 700;
}
.field .hint { font-size: 12px; color: var(--ink-faint); margin-top: 6px; line-height: 1.45; }
.card-pad { padding: 22px; }

/* Kanal-Chips: am Handy die Kanalauswahl (Basis); ab Tablet ersetzt sie die
   senkrechte Kanalspalte links. */
.channel-chips {
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
  padding: 2px 0; margin-bottom: 14px; -webkit-overflow-scrolling: touch;
}
.channel-chips::-webkit-scrollbar { display: none; }
.channel-chips .chchip {
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 14px; min-height: 40px; border-radius: 999px; background: var(--card);
  border: 1px solid var(--line-strong); color: var(--ink-soft);
  font-size: 13.5px; font-weight: 600; white-space: nowrap;
}
.channel-chips .chchip .ic { font-size: 14px; }
.channel-chips .chchip.active { background: var(--red); border-color: var(--red); color: #fff; }

/* =====================================================================
   Chat (Einzel & Gruppe) — mobile first
   Die Übersicht ist eine gewöhnliche Liste, das Gespräch eine eigene Seite,
   deren Verlauf scrollt und deren Eingabefeld unten stehen bleibt.
   ===================================================================== */
.chat-list { display: flex; flex-direction: column; }
.chat-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 4px; min-height: 64px;
  border-bottom: 1px solid var(--line); color: var(--ink);
}
.chat-row:last-child { border-bottom: 0; }
.chat-row:active { background: var(--card); }
.avatar.gruppe { background: var(--brand-grey); font-size: 19px; }
.chat-meta { flex: 1; min-width: 0; }
.chat-top { display: flex; align-items: baseline; gap: 10px; }
.chat-name { font-weight: 600; font-size: 15px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-time { font-size: 12px; color: var(--ink-faint); flex: none; }
.chat-prev { font-size: 13.5px; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-row.unread .chat-name { font-weight: 700; }
.chat-row.unread .chat-prev { color: var(--ink); font-weight: 600; }
.chat-badge {
  flex: none; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px;
  background: var(--red); color: #fff; font-size: 12px; font-weight: 700;
  display: grid; place-items: center;
}

/* Gesprächsansicht: füllt genau den Raum unter der Kopfzeile — der Verlauf
   scrollt für sich, die Seite selbst nicht. */
.chat-page {
  display: flex; flex-direction: column;
  height: calc(100dvh - var(--header-h));
  padding-bottom: calc(84px + env(safe-area-inset-bottom));   /* Platz für die Bottom-Nav (79 px) */
}
.chat-head {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  background: var(--card); border-bottom: 1px solid var(--line); flex: none;
}
.chat-back { font-size: 28px; line-height: 1; color: var(--ink-soft); width: 32px; text-align: center; }
.chat-head-meta { min-width: 0; flex: 1; }
.chat-mute { flex: none; width: 40px; height: 40px; border-radius: 50%; font-size: 17px;
  background: none; color: var(--ink-soft); display: grid; place-items: center; }
.chat-mute:hover { background: var(--surface); }
.chat-head-name { font-weight: 700; font-size: 15.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-head-sub { font-size: 12.5px; color: var(--ink-faint); }

.msg-scroll {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
  display: flex; flex-direction: column; gap: 8px; padding: 14px 12px;
}
.msg { max-width: 82%; align-self: flex-start; background: var(--card); border: 1px solid var(--line); border-radius: 16px 16px 16px 5px; padding: 9px 13px; }
.msg.mine { align-self: flex-end; background: var(--red); border-color: var(--red); color: #fff; border-radius: 16px 16px 5px 16px; }
.msg-from { font-size: 12px; font-weight: 700; color: var(--red); margin-bottom: 2px; }
.msg-body { font-size: 15px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-foot { font-size: 11px; color: var(--ink-faint); margin-top: 3px; text-align: right; }
.msg.mine .msg-foot { color: rgba(255,255,255,.8); }

.msg-bar {
  flex: none; display: flex; align-items: flex-end; gap: 8px;
  padding: 8px 10px; background: var(--card); border-top: 1px solid var(--line);
}
.msg-bar textarea {
  flex: 1; resize: none; max-height: 140px; padding: 10px 14px;
  border: 1px solid var(--line-strong); border-radius: 20px; background: var(--surface);
  font-family: var(--font); font-size: 15px; line-height: 1.4;
}
.msg-bar textarea:focus { outline: none; border-color: var(--red); background: #fff; }
.msg-send {
  flex: none; width: 44px; height: 44px; border-radius: 50%; background: var(--red);
  color: #fff; font-size: 17px; display: grid; place-items: center;
}
.msg-send:disabled { opacity: .5; }

/* Personenauswahl im Dialog „Neues Gespräch" */
.pick-chosen { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.pick-chosen:empty { display: none; }
.pick-chosen .sel-chip { min-height: 34px; padding: 6px 12px; font-size: 13px; background: var(--red); border-color: var(--red); color: #fff; }
.pick-list { max-height: 46vh; overflow-y: auto; margin-bottom: 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.pick-row {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 12px; min-height: 52px;
  background: none; border: 0; border-bottom: 1px solid var(--line); text-align: left; color: var(--ink);
}
.pick-row:last-child { border-bottom: 0; }
.pick-row.on { background: var(--red-tint); }
.pick-name { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; display: flex; flex-direction: column; }
.pick-name small { font-weight: 400; font-size: 12px; color: var(--ink-faint); }
.pick-mark { color: var(--red); font-weight: 700; width: 16px; }

/* Themenauswahl der Benachrichtigungen: Zeile mit Schiebeschalter.
   Touch-Ziel ≥ 44 px, damit es am Handy sicher trifft. */
.themen-head { margin-top: 22px; margin-bottom: 4px; font-weight: 600; font-size: 14px; }
.themen { display: flex; flex-direction: column; }
.switch-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 10px 0; min-height: 46px; border-bottom: 1px solid var(--line); font-size: 14.5px;
}
.switch-row:last-of-type { border-bottom: 0; }
.themen .hinweis { font-size: 12.5px; color: var(--ink-faint); line-height: 1.5; margin-top: 10px; }
.switch { position: relative; flex: none; width: 46px; height: 26px; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch .slider {
  position: absolute; inset: 0; border-radius: 999px; background: var(--line-strong);
  transition: background .15s; pointer-events: none;
}
.switch .slider::before {
  content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px;
  border-radius: 50%; background: #fff; transition: transform .15s;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.switch input:checked + .slider { background: var(--red); }
.switch input:checked + .slider::before { transform: translateX(20px); }
.switch input:focus-visible + .slider { box-shadow: 0 0 0 3px var(--red-soft); }
.switch input:disabled + .slider { opacity: .55; }

/* Ungelesen-Abzeichen an der Bottom-Navigation */
.bottom-nav a .ic { position: relative; }
.nav-badge {
  position: absolute; top: -4px; left: 12px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 999px; background: var(--red); color: #fff;
  font-size: 10px; font-weight: 700; line-height: 16px; text-align: center;
}

/* ---------------------------------------------------------------------
   Erweiterungen für größere Bildschirme (mobile first → min-width)
   Handy  (Basis)   : eine Spalte, Chips, Bottom-Nav, FAB
   ≥ 701px (Tablet) : Kanäle senkrecht links, Kopfsuche, keine Bottom-Nav
   ≥ 1041px (Desktop): zusätzlich rechte Widget-Spalte
   --------------------------------------------------------------------- */
@media (min-width: 701px) {
  :root { --nav-w: 196px; }
  .layout {
    max-width: 900px; padding: 18px 16px 60px; gap: 18px;
    grid-template-columns: var(--nav-w) minmax(0, 1fr);
  }
  .page { padding: 22px 22px 60px; }
  .col-left { display: block; }        /* Kanäle senkrecht links */
  .channel-chips { display: none; }
  .bottom-nav, .fab { display: none; }
  .header-search { display: block; }
  /* Ohne Bottom-Nav braucht das Gespräch den vollen Raum — und der Knopf für ein
     neues Gespräch bleibt sichtbar, weil es dafür sonst keinen Einstieg gibt. */
  .chat-page { padding-bottom: 0; height: calc(100dvh - var(--header-h)); }
  .fab.always { display: grid; bottom: 26px; }
  .msg { max-width: 62%; }
}

@media (min-width: 1041px) {
  :root { --nav-w: 236px; }
  .layout {
    max-width: 1240px; padding: 22px 22px 60px; gap: 26px;
    grid-template-columns: var(--nav-w) minmax(0, 1fr) var(--right-w);
  }
  .col-right { display: block; }
}
