/* ════════════════════════════════════════════════════════
   THEME TOKENS  (matches the AppHub design system)
   ════════════════════════════════════════════════════════ */
:root {
  color-scheme: dark;
  --bg:        #0d1117;
  --bg-2:      #161b22;
  --bg-3:      #1d2433;
  --bg-4:      #252d3d;
  --border:    rgba(255,255,255,0.07);
  --border-2:  rgba(255,255,255,0.13);
  --text-1:    #e6edf3;
  --text-2:    #8b949e;
  --text-3:    #56606b;
  --accent:    #008acb;
  --acc-rgb:   0,138,203;
  --acc-soft:  rgba(0,138,203,0.14);
  --acc-ring:  rgba(0,138,203,0.32);
  --green:     #3fb950;
  --g-soft:    rgba(63,185,80,0.12);
  --g-ring:    rgba(63,185,80,0.28);
  --red:       #f85149;
  --r-soft:    rgba(248,81,73,0.12);
  --r-ring:    rgba(248,81,73,0.28);
  --amber:     #d29922;
  --a-soft:    rgba(210,153,34,0.14);
  --shadow:    0 8px 32px rgba(0,0,0,0.55), 0 2px 8px rgba(0,0,0,0.35);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.4);
  --radius:    16px;
  --radius-sm: 10px;
  --t:         0.17s;
  --ease:      cubic-bezier(0.4,0,0.2,1);
}
[data-theme="light"] {
  color-scheme: light;
  --bg:        #f3f4f6;
  --bg-2:      #ffffff;
  --bg-3:      #eaecef;
  --bg-4:      #dde1e6;
  --border:    rgba(0,0,0,0.08);
  --border-2:  rgba(0,0,0,0.14);
  --text-1:    #0d1117;
  --text-2:    #57606a;
  --text-3:    #8c959f;
  --accent:    #0277b0;
  --acc-rgb:   2,119,176;
  --acc-soft:  rgba(2,119,176,0.10);
  --acc-ring:  rgba(2,119,176,0.24);
  --green:     #1a7f37;
  --g-soft:    rgba(26,127,55,0.10);
  --g-ring:    rgba(26,127,55,0.22);
  --red:       #d1242f;
  --r-soft:    rgba(209,36,47,0.09);
  --r-ring:    rgba(209,36,47,0.22);
  --amber:     #9a6700;
  --a-soft:    rgba(154,103,0,0.12);
  --shadow:    0 4px 24px rgba(0,0,0,0.1), 0 1px 4px rgba(0,0,0,0.06);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.08);
}

html.theme-transition *, html.theme-transition *::before, html.theme-transition *::after {
  transition: background-color .28s ease, border-color .28s ease,
              color .28s ease, box-shadow .28s ease !important;
}

/* ════════ RESET ════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
/* The `hidden` attribute must always win over class-based display rules
   (e.g. .modal-backdrop{display:grid}), otherwise hidden overlays stay visible. */
[hidden] { display: none !important; }
button { font: inherit; cursor: pointer; border: none; background: none;
         -webkit-tap-highlight-color: transparent; }
input, select, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 99px; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text-1);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  background-image:
    radial-gradient(ellipse 90% 55% at 50% -8%, rgba(var(--acc-rgb),0.10) 0%, transparent 62%);
}

/* ════════ BUTTONS ════════ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 16px; border-radius: var(--radius-sm); font-weight: 600;
  font-size: 13.5px; color: var(--text-1); background: var(--bg-3);
  border: 1px solid var(--border-2); transition: all var(--t) var(--ease);
  white-space: nowrap;
}
.btn:hover { background: var(--bg-4); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--accent); border-color: transparent; color: #fff; }
.btn-primary:hover { background: var(--accent); filter: brightness(1.08);
  box-shadow: 0 4px 16px var(--acc-ring); }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--bg-hover, rgba(255,255,255,0.05)); }
.btn-danger { background: var(--r-soft); border-color: var(--r-ring); color: var(--red); }
.btn-danger:hover { background: var(--red); color: #fff; border-color: transparent; }
.btn-block { width: 100%; padding: 11px; }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.icon-btn {
  width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center;
  font-size: 16px; color: var(--text-2); transition: all var(--t) var(--ease);
  text-decoration: none; cursor: pointer; flex-shrink: 0;
}
.icon-btn:hover { background: var(--bg-3); color: var(--text-1); }
.icon-btn.danger:hover { background: var(--r-soft); color: var(--red); }
.icon-btn .ic { width: 17px; height: 17px; display: block; }
.ic { width: 18px; height: 18px; display: inline-block; vertical-align: middle; }

/* Admin edit bar inside the event detail modal */
.detail-admin { display: flex; gap: 4px; justify-content: flex-end;
  margin: -4px 0 6px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }

/* ════════ LOGIN ════════ */
.login-view {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
}
.login-card {
  width: 100%; max-width: 400px; background: var(--bg-2);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 36px 32px;
  display: flex; flex-direction: column; gap: 16px;
  animation: rise .4s var(--ease) both;
}
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
.login-brand { text-align: center; margin-bottom: 6px; }
.login-logo {
  width: 78px; height: 78px; margin: 0 auto 12px; display: block;
  object-fit: cover; object-position: top center;   /* show the crest, crop the wordmark */
}
.login-brand h1 { font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.login-brand p { color: var(--text-2); font-size: 13.5px; margin-top: 4px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field input, .field textarea, .field select {
  background: var(--bg); border: 1px solid var(--border-2); color: var(--text-1);
  padding: 10px 13px; border-radius: var(--radius-sm); transition: all var(--t) var(--ease);
  width: 100%;
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--acc-soft);
}
.field textarea { resize: vertical; min-height: 80px; }
/* iOS Safari renders date/time inputs as native controls with a large intrinsic
   width that ignores width:100%/box-sizing, so they overflow their column.
   Strip the native appearance and let them shrink to the container. */
.field input[type="date"],
.field input[type="time"],
.field input[type="datetime-local"] {
  -webkit-appearance: none; appearance: none;
  min-width: 0; max-width: 100%;
}
.field input[type="datetime-local"]::-webkit-date-and-time-value { text-align: left; margin: 0; }
/* iOS zooms into a focused input whose font-size is < 16px and never zooms back
   out (the page stays enlarged after the modal closes). Keep text-entry controls
   at 16px on touch devices to prevent it; desktop keeps the 14px inherited size. */
@media (pointer: coarse) {
  .field input, .field textarea, .field select,
  .roster-sort select { font-size: 16px; }
}
.login-error {
  background: var(--r-soft); border: 1px solid var(--r-ring); color: var(--red);
  padding: 9px 12px; border-radius: var(--radius-sm); font-size: 13px; text-align: center;
}
.login-or { display: flex; align-items: center; gap: 10px; margin: 14px 0 10px; }
.login-or::before, .login-or::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.login-or span { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; }
#login-passkey-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
#login-passkey-btn.pulse { animation: pkpulse 0.9s var(--ease) 2; }
@keyframes pkpulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--acc-soft); border-color: var(--border-2); }
  50%      { box-shadow: 0 0 0 4px var(--acc-soft); border-color: var(--accent); }
}
.btn .ic { width: 16px; height: 16px; }
.ic-slot { display: inline-flex; }
.login-hint { text-align: center; font-size: 12px; color: var(--text-3); line-height: 1.7; }
.login-hint code {
  background: var(--bg-3); padding: 1px 6px; border-radius: 5px;
  font-size: 11.5px; color: var(--text-2);
}
.login-code-info { font-size: 13px; color: var(--text-2); line-height: 1.5; margin-bottom: 10px; }
.login-code-info strong { color: var(--text-1); }
.login-resend { font-size: 12.5px; color: var(--text-3); margin-top: 8px; text-align: center; }
.login-resend a { color: var(--accent); font-weight: 600; text-decoration: none; }
.login-resend a:hover { text-decoration: underline; }
.code-inputs { display: flex; gap: 8px; justify-content: center; margin: 4px 0 2px; }
.code-digit {
  /* Flexible (shrink to fit, cap at 44px) so the 6-digit row never overflows
     the card on narrow phones. */
  flex: 1 1 0; min-width: 0; max-width: 44px;
  height: 52px; text-align: center; font-size: 22px; font-weight: 700;
  color: var(--text-1); background: var(--bg);
  border: 1px solid var(--border-2); border-radius: var(--radius-sm);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  transition: border-color var(--t) var(--ease), box-shadow var(--t) var(--ease);
}
.code-digit:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--acc-soft);
}
.code-digit:disabled { opacity: .55; }
@media (max-width: 400px) {
  .code-inputs { gap: 6px; }
  .code-digit { max-width: 40px; height: 48px; font-size: 20px; }
}
.form-note { font-size: 12px; color: var(--text-3); line-height: 1.5; margin: -2px 0 2px; }

/* ════════ TOPBAR ════════ */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 18px;
  padding: 12px 22px; background: var(--bg-2);
  border-bottom: 1px solid var(--border); backdrop-filter: blur(12px);
}
.topbar-brand { display: flex; align-items: center; gap: 10px; font-weight: 800;
  letter-spacing: -.02em; }
.topbar-logo {
  width: 34px; height: 34px; object-fit: cover; object-position: top center;
}
.topbar-title { font-size: 16px; }
.tabs { display: flex; gap: 4px; margin-left: 8px; }
.nav-toggle { display: none; }   /* hamburger: mobile only */
.tab {
  padding: 8px 15px; border-radius: var(--radius-sm); font-weight: 600;
  font-size: 13.5px; color: var(--text-2); transition: all var(--t) var(--ease);
}
.tab:hover { color: var(--text-1); background: var(--bg-3); }
.tab.active { color: var(--accent); background: var(--acc-soft); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.sync-status {
  font-size: 11.5px; font-weight: 600; padding: 4px 10px; border-radius: 999px;
  background: var(--a-soft); color: var(--amber); border: 1px solid var(--a-soft);
  white-space: nowrap;
}
.sync-status.is-offline { background: var(--r-soft); color: var(--red); border-color: var(--r-ring); }
.profile { position: relative; }
.user-chip { display: flex; align-items: center; gap: 9px; background: none; border: none;
  cursor: pointer; padding: 4px 8px 4px 4px; border-radius: 10px; color: inherit; font: inherit;
  transition: background var(--t) var(--ease); }
.user-chip:hover { background: var(--bg-3); }
.user-chip .user-meta { text-align: left; }
.chev { display: inline-flex; color: var(--text-3); transition: transform var(--t) var(--ease); }
.chev .ic { width: 15px; height: 15px; }
.user-chip[aria-expanded="true"] .chev { transform: rotate(180deg); }

.profile-menu { position: absolute; top: calc(100% + 8px); right: 0; min-width: 212px;
  background: var(--bg-2); border: 1px solid var(--border-2); border-radius: 12px;
  box-shadow: var(--shadow); padding: 6px; z-index: 50; animation: rise .16s var(--ease) both; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  background: none; border: none; cursor: pointer; padding: 9px 11px; border-radius: 8px;
  color: var(--text-1); font: inherit; font-size: 13.5px;
  transition: background var(--t) var(--ease); }
.menu-item:hover { background: var(--bg-3); }
.menu-item .mi-ic { display: inline-flex; color: var(--text-2); flex-shrink: 0; }
.menu-item .mi-ic .ic { width: 17px; height: 17px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 700; font-size: 13px; color: #fff;
  background: linear-gradient(135deg, var(--accent), #016a9b);
}
.user-meta { display: flex; flex-direction: column; line-height: 1.25; }
.user-name { font-weight: 600; font-size: 13px; }
.user-role { font-size: 11px; color: var(--text-3); text-transform: capitalize; }

/* ════════ LAYOUT ════════ */
.content { max-width: 1080px; margin: 0 auto; padding: 28px 22px 60px; }
.panel-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; margin-bottom: 20px; flex-wrap: wrap;
}
.panel-head h2 { font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.panel-sub { color: var(--text-2); font-size: 13.5px; margin-top: 3px; }
.panel-head-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ════════ VIEW TOGGLE (Kacheln / Liste) ════════ */
.view-toggle { display: inline-flex; background: var(--bg-3); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 3px; gap: 2px; }
.view-btn { padding: 6px 12px; font-size: 12.5px; font-weight: 600; cursor: pointer;
  border: none; background: transparent; color: var(--text-2); border-radius: 7px;
  transition: all var(--t) var(--ease); }
.view-btn:hover { color: var(--text-1); }
.view-btn.active { background: var(--bg-2); color: var(--accent);
  box-shadow: 0 1px 2px rgba(0,0,0,.18); }

/* ════════ EVENT LIST VIEW ════════ */
.event-list { border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; background: var(--bg-2); }
.elist-head, .elist-row { display: grid;
  grid-template-columns: 92px minmax(0,1fr) 120px 208px; gap: 14px; align-items: center;
  padding: 11px 16px; }
.elist-head { font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; color: var(--text-3); background: var(--bg-3); }
.elist-row { border-top: 1px solid var(--border); cursor: pointer;
  transition: background var(--t) var(--ease); }
.elist-row:hover { background: var(--bg-3); }
.elist-row.is-draft { opacity: 0.55; }
.elist-row.is-draft:hover { opacity: 1; }
.elist-date { display: flex; flex-direction: column; font-size: 13px; line-height: 1.3; }
.elist-date b { color: var(--text-1); }
.elist-time { font-size: 11px; color: var(--text-3); }
.elist-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.elist-title { font-weight: 600; font-size: 14px; display: flex; align-items: center;
  gap: 8px; flex-wrap: wrap; }
.elist-loc { font-size: 12px; color: var(--text-2); }
.elist-c-counts { display: flex; gap: 12px; font-size: 13px; font-weight: 600; }
.count-yes { color: var(--green); }
.count-no  { color: var(--red); }
.elist-c-actions { display: flex; gap: 6px; flex-wrap: nowrap; justify-content: flex-end; }
@media (max-width: 720px) {
  .elist-head { display: none; }
  .elist-row { grid-template-columns: 1fr; gap: 8px; }
  .elist-c-counts, .elist-c-actions { justify-content: flex-start; }
}

/* ════════ GENERIC LIST VIEW (Dokumente / Mitglieder) ════════ */
.list-view { border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; background: var(--bg-2); }
.lrow { display: flex; align-items: center; gap: 14px; padding: 11px 16px;
  border-top: 1px solid var(--border); transition: background var(--t) var(--ease); }
.lrow:first-child { border-top: none; }
.lrow:hover { background: var(--bg-3); }
.l-icon { font-size: 18px; flex-shrink: 0; width: 24px; text-align: center; }
.l-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.l-title { font-weight: 600; font-size: 14px; display: flex; align-items: center;
  gap: 8px; flex-wrap: wrap; }
.l-sub { font-size: 12.5px; color: var(--text-2); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.l-meta { font-size: 12px; color: var(--text-3); white-space: nowrap; flex-shrink: 0; }
.l-actions { display: flex; gap: 6px; flex-shrink: 0; align-items: center; }
@media (max-width: 720px) {
  .lrow { flex-wrap: wrap; }
  .l-meta { flex-basis: 100%; }
}

/* ════════ EVENT CARDS ════════ */
/* min(330px, 100%) caps the column floor at the container width so a single
   card never overflows the viewport on phones narrower than 330px. */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(330px, 100%), 1fr)); gap: 16px; }
.event-card {
  background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 18px 16px; display: flex; flex-direction: column; gap: 12px;
  transition: all var(--t) var(--ease); position: relative; overflow: hidden;
  animation: rise .35s var(--ease) both; cursor: pointer;
}
.event-card:hover { border-color: var(--border-2); transform: translateY(-2px);
  box-shadow: var(--shadow-sm); }
/* Unpublished events (drafts) are dimmed so admins spot them at a glance. */
.event-card.is-draft { opacity: 0.55; }
.event-card.is-draft:hover { opacity: 1; }
.event-card::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: linear-gradient(90deg, var(--accent), transparent);
}
.event-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.event-date {
  flex-shrink: 0; text-align: center; background: var(--bg-3);
  border: 1px solid var(--border); border-radius: 12px; padding: 8px 12px; min-width: 58px;
}
.event-date .d { font-size: 21px; font-weight: 800; line-height: 1; }
.event-date .m { font-size: 11px; font-weight: 700; color: var(--accent);
  text-transform: uppercase; letter-spacing: .05em; margin-top: 3px; }
.event-date .t { font-size: 11px; color: var(--text-3); margin-top: 4px; }
.event-info { flex: 1; min-width: 0; }
.event-title { font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
.event-loc { font-size: 12.5px; color: var(--text-2); margin-top: 3px; display: flex;
  align-items: center; gap: 5px; }
.event-card-desc { font-size: 13px; color: var(--text-2); line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.event-stats { display: flex; gap: 14px; font-size: 12.5px; color: var(--text-2);
  padding-top: 2px; }
.event-stats b { color: var(--text-1); }
.stat-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  margin-right: 5px; vertical-align: middle; }
.dot-yes { background: var(--green); }
.dot-no  { background: var(--red); }
.event-actions { display: flex; gap: 8px; margin-top: auto; padding-top: 6px;
  flex-wrap: wrap; align-items: center; }
.rsvp-group { display: flex; gap: 8px; flex: 1; }
.rsvp-btn { flex: 1; }
.rsvp-btn.active-yes { background: var(--green); color: #fff; border-color: transparent; }
.rsvp-btn.active-no  { background: var(--red); color: #fff; border-color: transparent; }
.rsvp-locked-group { flex-direction: column; align-items: flex-start; gap: 3px; }
.rsvp-locked { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px;
  font-weight: 700; padding: 6px 12px; border-radius: 8px; }
.rsvp-locked.locked-yes { color: var(--green); background: var(--g-soft); }
.rsvp-locked.locked-no  { color: var(--red);   background: var(--r-soft); }
.rsvp-hint { font-size: 11.5px; color: var(--text-3); }
.rsvp-wrap { display: flex; flex-direction: column; gap: 6px; width: 100%; }
.rsvp-wrap .rsvp-group { flex: 0 0 auto; }
.rsvp-window { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px;
  font-weight: 600; color: var(--text-2); background: var(--bg-3);
  border: 1px solid var(--border); padding: 8px 12px; border-radius: 8px; }

.badge {
  font-size: 10.5px; font-weight: 700; padding: 3px 8px; border-radius: 99px;
  text-transform: uppercase; letter-spacing: .04em;
}
.badge-draft  { background: var(--a-soft); color: var(--amber); }
.badge-mine-yes { background: var(--g-soft); color: var(--green); }
.badge-mine-no  { background: var(--r-soft); color: var(--red); }
.badge-pending { background: var(--a-soft); color: var(--amber); text-transform: none; }
/* Not-yet-synced offline writes: slightly muted until the server confirms. */
.is-pending { opacity: 0.7; }
.detail-offline {
  margin-top: 14px; padding: 10px 12px; border-radius: 10px;
  background: var(--a-soft); color: var(--text-2);
  font-size: 13px; line-height: 1.5;
}
.admin-row { display: flex; gap: 6px; }

/* ════════ DOCUMENTS ════════ */
.doc-list { display: flex; flex-direction: column; gap: 10px; }
.doc-item {
  background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 15px 16px; display: flex; align-items: center; gap: 14px;
  transition: all var(--t) var(--ease); animation: rise .3s var(--ease) both;
}
.doc-item:hover { border-color: var(--border-2); }
.doc-icon {
  width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center;
  font-size: 19px; background: var(--acc-soft); flex-shrink: 0;
}
.doc-main { flex: 1; min-width: 0; }
.doc-title { font-weight: 700; font-size: 14.5px; }
.doc-desc { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }
.doc-meta { font-size: 11.5px; color: var(--text-3); margin-top: 4px; }
.doc-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ════════ MEMBERS ════════ */
.member-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 12px; }
.member-card {
  background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 15px; display: flex; align-items: center; gap: 13px;
  transition: all var(--t) var(--ease); animation: rise .3s var(--ease) both;
}
.member-card:hover { border-color: var(--border-2); }
.member-main { flex: 1; min-width: 0; }
.member-name { font-weight: 700; font-size: 14px; display: flex; align-items: center;
  gap: 7px; flex-wrap: wrap; }
.member-email { font-size: 12.5px; color: var(--text-2); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.role-tag { font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 99px;
  text-transform: uppercase; letter-spacing: .04em; }
.role-admin  { background: var(--acc-soft); color: var(--accent); }
.role-member { background: var(--bg-3); color: var(--text-3); }
.pk-badge { display: inline-flex; align-items: center; color: var(--accent);
  vertical-align: middle; }
.pk-badge .ic { width: 14px; height: 14px; }
.member-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ════════ EMPTY ════════ */
.empty {
  text-align: center; padding: 60px 20px; color: var(--text-3);
  border: 1.5px dashed var(--border-2); border-radius: var(--radius);
}
.empty .emoji { font-size: 38px; margin-bottom: 10px; }

/* ════════ MODAL ════════ */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px); display: grid; place-items: center; padding: 20px;
  animation: fade .2s ease both;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  width: 100%; max-width: 540px; max-height: 88vh; overflow: auto;
  background: var(--bg-2); border: 1px solid var(--border-2); border-radius: var(--radius);
  box-shadow: var(--shadow); animation: rise .25s var(--ease) both;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--border); position: sticky; top: 0;
  background: var(--bg-2);
}
.modal-head h3 { font-size: 17px; font-weight: 800; letter-spacing: -.01em; }
.modal-body { padding: 22px; display: flex; flex-direction: column; gap: 15px; }
.modal-row { display: flex; gap: 12px; }
/* min-width:0 lets the columns shrink below the date inputs' large intrinsic
   width instead of overflowing/overlapping. */
.modal-row .field { flex: 1; min-width: 0; }
/* On narrow phones the side-by-side date/time fields get too cramped — stack
   them so each control keeps full width. */
@media (max-width: 520px) {
  .modal-row { flex-direction: column; gap: 15px; }
}
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 4px; }
.checkbox-field { display: flex; align-items: center; gap: 9px; cursor: pointer; }
.checkbox-field input { width: 18px; height: 18px; accent-color: var(--accent); }

/* Attendee list inside detail modal */
.attendees { display: flex; flex-direction: column; gap: 7px; }
.att-group-title { font-size: 12px; font-weight: 700; color: var(--text-2);
  text-transform: uppercase; letter-spacing: .05em; margin-top: 6px; }
.att-row { display: flex; align-items: center; gap: 10px; padding: 8px 11px;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.att-avatar { width: 28px; height: 28px; border-radius: 50%; display: grid;
  place-items: center; font-size: 11px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, var(--accent), #016a9b); flex-shrink: 0; }
.att-name { flex: 1; font-size: 13.5px; font-weight: 500; }
.att-status { font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 99px; }
.att-status.yes { background: var(--g-soft); color: var(--green); }
.att-status.no  { background: var(--r-soft); color: var(--red); }
.att-status.none { background: var(--a-soft); color: var(--amber); }
.att-admin { display: flex; gap: 6px; flex-shrink: 0; }
.att-admin .rsvp-btn { flex: 0 0 auto; min-width: 38px; }

/* Roster filter & sort toolbar (admin event detail) */
.roster-toolbar { display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin: 4px 0 12px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 5px 11px; font-size: 12px; font-weight: 600; cursor: pointer;
  border: 1px solid var(--border); background: var(--bg-3); color: var(--text-2);
  border-radius: 99px; transition: all var(--t) var(--ease); }
.chip:hover { color: var(--text-1); border-color: var(--border-2); }
.chip.active { background: var(--acc-soft); color: var(--accent); border-color: var(--acc-ring); }
.roster-sort { display: flex; align-items: center; gap: 6px; font-size: 12px;
  color: var(--text-3); white-space: nowrap; }
.roster-sort select { padding: 5px 8px; font-size: 12.5px; border-radius: 8px;
  background: var(--bg); border: 1px solid var(--border-2); color: var(--text-1); }
.roster-rows { display: flex; flex-direction: column; gap: 6px; }

/* Member's own RSVP block in the event detail modal */
.modal-rsvp { margin: 14px 0 6px; padding: 12px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--bg-3); }
.modal-rsvp .att-group-title { margin: 0 0 8px; }
.modal-rsvp .rsvp-group { gap: 8px; }
.modal-rsvp .rsvp-btn { flex: 1; }

/* ════════ TOAST ════════ */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(10px);
  background: var(--bg-4); color: var(--text-1); border: 1px solid var(--border-2);
  padding: 11px 18px; border-radius: var(--radius-sm); box-shadow: var(--shadow);
  font-size: 13.5px; font-weight: 500; z-index: 200; opacity: 0;
  transition: all .25s var(--ease); pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { border-color: var(--r-ring); color: var(--red); }

[data-admin] { display: none; }
body.is-admin [data-admin] { display: inline-flex; }
body.is-admin .tab[data-admin] { display: inline-flex; }

@media (max-width: 640px) {
  .topbar { gap: 10px; }
  .nav-toggle { display: grid; }   /* keep .icon-btn's place-items:center (not inline-flex) */
  /* The tab bar becomes a dropdown anchored under the topbar. */
  .tabs {
    position: absolute; top: 100%; left: 0; right: 0; margin: 0;
    display: none; flex-direction: column; gap: 2px; padding: 8px;
    background: var(--bg-2); border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow); z-index: 45;
  }
  .tabs.open { display: flex; animation: rise .16s var(--ease) both; }
  .tab { width: 100%; padding: 12px 14px; font-size: 15px; border-radius: 8px; text-align: center; }
  /* The admin-only "Mitglieder" tab is shown via inline-flex; in the dropdown it
     must be a block so text-align:center applies like the other entries. */
  body.is-admin .tab[data-admin] { display: block; }
  .user-name, .user-role { display: none; }
  .content { padding: 20px 14px 50px; }
}

/* ════════ WIDER MODALS (desktop) ════════ */
/* Detail + event-form modals get more breathing room on a real screen; on
   phones they stay full-width like every other modal. */
@media (min-width: 720px) {
  .modal--wide { max-width: 760px; }
}

/* ════════ RICH EVENT DESCRIPTION ════════ */
.event-desc { line-height: 1.6; margin: 4px 0 2px; color: var(--text-1); }
.event-desc > *:first-child { margin-top: 0; }
.event-desc > *:last-child { margin-bottom: 0; }
.event-desc h3 { font-size: 16px; font-weight: 800; margin: 14px 0 6px; letter-spacing: -.01em; }
.event-desc h4 { font-size: 14px; font-weight: 700; margin: 12px 0 5px; }
.event-desc p { margin: 8px 0; }
.event-desc ul, .event-desc ol { margin: 8px 0; padding-left: 22px; }
.event-desc ul { list-style: disc; }       /* override the global `ul{list-style:none}` reset */
.event-desc ol { list-style: decimal; }
.event-desc li { margin: 3px 0; }
.event-desc a { color: var(--accent); text-decoration: underline; word-break: break-word; }
.event-desc blockquote {
  margin: 10px 0; padding: 6px 14px; border-left: 3px solid var(--acc-ring);
  color: var(--text-2); background: var(--acc-soft); border-radius: 0 8px 8px 0;
}

/* ════════ EVENT PHOTO GALLERY (detail view) ════════ */
.event-photos { display: flex; gap: 10px; margin: 14px 0 4px; flex-wrap: wrap; }
.event-thumb {
  position: relative; width: 132px; height: 100px; padding: 0; border: 1px solid var(--border-2);
  border-radius: var(--radius-sm); overflow: hidden; cursor: pointer; background: var(--bg-3);
  transition: transform var(--t) var(--ease), box-shadow var(--t) var(--ease);
}
.event-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.event-thumb:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.event-thumb:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.event-thumb-more img { filter: brightness(.45); }
.event-thumb-overlay {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 22px; font-weight: 800; color: #fff;
}
.event-photos-note { font-size: 12px; color: var(--text-3); margin: 2px 0 0; }

/* ════════ EVENT ATTACHMENTS (download list) ════════ */
.event-files { margin: 16px 0 4px; }
.event-files-title { font-size: 13px; font-weight: 700; color: var(--text-2); margin: 0 0 8px; }
.event-file {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; margin-bottom: 6px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-3);
  color: var(--text-1); text-decoration: none; transition: background var(--t) var(--ease);
}
.event-file:hover { background: var(--bg-4); }
.event-file-ic { font-size: 16px; }
.event-file-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.event-file-size { font-size: 12px; color: var(--text-3); flex: 0 0 auto; }

/* ════════ WYSIWYG EDITOR ════════ */
.wysiwyg { border: 1px solid var(--border-2); border-radius: var(--radius-sm); overflow: hidden; background: var(--bg-3); }
.wysiwyg-toolbar {
  display: flex; align-items: center; gap: 2px; padding: 6px 8px; flex-wrap: wrap;
  background: var(--bg-4); border-bottom: 1px solid var(--border);
}
.wz-btn {
  min-width: 30px; height: 30px; padding: 0 7px; border: 1px solid transparent; border-radius: 7px;
  background: transparent; color: var(--text-1); font-size: 14px; cursor: pointer; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background var(--t) var(--ease), border-color var(--t) var(--ease);
}
.wz-btn:hover { background: var(--bg-2); }
.wz-btn.is-active { background: var(--acc-soft); border-color: var(--acc-ring); color: var(--accent); }
.wz-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.wz-sep { width: 1px; height: 18px; background: var(--border-2); margin: 0 4px; }
.wysiwyg-area {
  min-height: 120px; max-height: 320px; overflow-y: auto; padding: 12px 14px;
  font-size: 14px; line-height: 1.6; color: var(--text-1); outline: none;
}
.wysiwyg-area:empty::before { content: attr(data-placeholder); color: var(--text-3); }
.wysiwyg-area:focus { box-shadow: inset 0 0 0 2px var(--acc-ring); }
.wysiwyg-area h3 { font-size: 16px; font-weight: 800; margin: 12px 0 6px; }
.wysiwyg-area ul, .wysiwyg-area ol { padding-left: 22px; margin: 8px 0; }
.wysiwyg-area ul { list-style: disc; }
.wysiwyg-area ol { list-style: decimal; }
.wysiwyg-area blockquote {
  margin: 8px 0; padding: 4px 12px; border-left: 3px solid var(--acc-ring); color: var(--text-2);
}
.wysiwyg-area a { color: var(--accent); }

/* ════════ MEDIA MANAGEMENT (edit modal) ════════ */
.media-section { display: flex; flex-direction: column; gap: 14px; padding-top: 4px; border-top: 1px solid var(--border); margin-top: 2px; }
.btn-file { position: relative; align-self: flex-start; cursor: pointer; font-size: 13px; }
.media-grid { display: flex; flex-wrap: wrap; gap: 9px; margin-bottom: 9px; }
.media-thumb {
  position: relative; width: 86px; height: 86px; border-radius: var(--radius-sm); overflow: hidden;
  border: 1px solid var(--border-2); background: var(--bg-3);
}
.media-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-files { display: flex; flex-direction: column; gap: 6px; margin-bottom: 9px; }
.media-file {
  display: flex; align-items: center; gap: 9px; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-3); font-size: 13px;
}
.media-file-ic { font-size: 15px; }
.media-file-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-file-size { font-size: 12px; color: var(--text-3); }
.media-rm {
  flex: 0 0 auto; width: 22px; height: 22px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(0,0,0,0.55); color: #fff; font-size: 12px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
}
.media-thumb .media-rm { position: absolute; top: 4px; right: 4px; }
.media-rm:hover { background: var(--red); }
.media-empty { font-size: 12.5px; color: var(--text-3); margin: 0 0 6px; }

/* ════════ LIGHTBOX (photo viewer) ════════ */
.lightbox {
  position: fixed; inset: 0; z-index: 300; background: rgba(0,0,0,0.92);
  display: grid; grid-template-columns: auto 1fr auto; align-items: center;
  padding: 24px; gap: 8px; animation: fade .2s ease both;
}
.lb-stage { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 12px; min-width: 0; }
#lb-img {
  max-width: min(92vw, 1400px); max-height: 82vh; object-fit: contain;
  border-radius: 8px; box-shadow: 0 12px 48px rgba(0,0,0,0.6);
}
.lb-caption { color: rgba(255,255,255,0.78); font-size: 13px; text-align: center; }
.lb-nav {
  width: 48px; height: 48px; border-radius: 50%; border: 1px solid rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.08); color: #fff; font-size: 28px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: background var(--t) var(--ease);
}
.lb-nav:hover { background: rgba(255,255,255,0.2); }
.lb-nav:focus-visible, .lb-close:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.lb-close {
  position: absolute; top: 18px; right: 20px; width: 42px; height: 42px; font-size: 20px;
  color: #fff; background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.25);
}
.lb-close:hover { background: rgba(255,255,255,0.2); }
.lb-counter {
  position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%);
  color: rgba(255,255,255,0.78); font-size: 13px; font-weight: 600;
}
@media (max-width: 640px) {
  .lightbox { grid-template-columns: 1fr; padding: 16px; }
  .lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 42px; height: 42px; }
  .lb-prev { left: 10px; } .lb-next { right: 10px; }
}

/* ════════ MESSAGES (admin broadcasts) ════════ */
.msg-badge {
  display: inline-block; vertical-align: middle; margin-left: 6px;
  font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px;
  border: 1px solid var(--border-2);
}
.msg-badge.is-draft { color: var(--amber); background: var(--a-soft); border-color: var(--a-soft); }
.msg-badge.is-sent  { color: var(--green); background: var(--g-soft); border-color: var(--g-ring); }
.doc-item.is-clickable { cursor: pointer; transition: background var(--t) var(--ease), border-color var(--t) var(--ease); }
.doc-item.is-clickable:hover { background: var(--bg-3); border-color: var(--border-2); }
.doc-item.is-clickable:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.doc-chev { color: var(--text-3); font-size: 22px; line-height: 1; flex: 0 0 auto; align-self: center; }
.msg-detail-meta { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 13px; margin: 2px 0 10px; }

/* ════════ SETUP WIZARD + SETTINGS ════════ */
.setup-view { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.setup-card {
  width: 100%; max-width: 480px; background: var(--bg-2); border: 1px solid var(--border-2);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 26px 26px 22px;
  animation: rise .25s var(--ease) both;
}
.setup-progress { display: flex; gap: 8px; justify-content: center; margin-bottom: 20px; }
.setup-dot {
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  font-size: 12px; font-weight: 700; color: var(--text-3);
  background: var(--bg-3); border: 1px solid var(--border-2);
}
.setup-dot.active { color: #fff; background: var(--accent); border-color: transparent; }
.setup-dot.done { color: var(--accent); border-color: var(--acc-ring); background: var(--acc-soft); }
.setup-body h2 { font-size: 19px; font-weight: 800; letter-spacing: -.01em; margin-bottom: 8px; }
.setup-body { display: flex; flex-direction: column; gap: 13px; }
.setup-lead { color: var(--text-2); font-size: 14px; line-height: 1.6; margin-bottom: 2px; }
.setup-hint { color: var(--text-3); font-size: 12px; margin-top: 4px; }
.setup-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 8px; }
.setup-review { list-style: none; display: flex; flex-direction: column; gap: 7px;
  background: var(--bg-3); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px; }
.setup-review b { color: var(--text-2); font-weight: 600; }
.setup-logo {
  width: 96px; height: 96px; border-radius: var(--radius-sm); border: 1px solid var(--border-2);
  background: #fff; display: grid; place-items: center; overflow: hidden; margin-bottom: 8px;
}
.setup-logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.color-row { display: flex; align-items: center; gap: 10px; }
.color-row input[type="color"] {
  width: 46px; height: 38px; padding: 2px; border: 1px solid var(--border-2);
  border-radius: var(--radius-sm); background: var(--bg); cursor: pointer; flex: 0 0 auto;
}
.color-row input[id$="-hex"], .color-row input[id$="-color-hex"] { flex: 1; }
.set-sep { border: none; border-top: 1px solid var(--border); margin: 6px 0 2px; }
@media (max-width: 520px) {
  .setup-card { padding: 20px 16px; }
}
