/* Vereinsplaner – Komponenten. Werte nur aus tokens.css (var(--…)), keine Hex-Farben hier. */

/* ------------------------------------------------------------------ Basis */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-base);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
h1 { font-size: var(--text-2xl); font-weight: var(--weight-2xl); }
h2 { font-size: var(--text-xl); font-weight: var(--weight-xl); }
h3 { font-size: var(--text-lg); font-weight: var(--weight-lg); }
p { margin: 0; }
a { color: var(--c-accent); text-underline-offset: 2px; }
a:hover { color: var(--c-accent-hover); }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--c-focus); outline-offset: 2px; }
::selection { background: var(--c-accent-soft); color: var(--c-on-accent-soft); }

.icon {
  width: 1.25em; height: 1.25em; flex: none;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.icon--sm { width: 1em; height: 1em; }
.icon--lg { width: 1.5em; height: 1.5em; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.muted { color: var(--c-text-muted); }
.small { font-size: var(--text-sm); line-height: var(--leading-sm); }
.xsmall { font-size: var(--text-xs); line-height: var(--leading-xs); font-weight: var(--weight-xs); }
.stack { display: flex; flex-direction: column; gap: var(--space-4); }
.stack--sm { gap: var(--space-2); }
.stack--lg { gap: var(--space-7); }
.row { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.row--between { justify-content: space-between; }

/* ------------------------------------------------------------------ App-Shell */

.app { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  height: var(--topbar);
  display: flex; align-items: center; gap: var(--space-2);
  padding: 0 var(--space-2) 0 var(--space-4);
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
}
.topbar__title { flex: 1; min-width: 0; font-size: var(--text-lg); font-weight: var(--weight-lg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar__brand { display: flex; align-items: center; gap: var(--space-2); color: inherit; text-decoration: none; font-weight: 700; }
.brand-mark {
  width: 32px; height: 32px; border-radius: var(--radius-sm);
  display: grid; place-items: center;
  background: var(--c-accent); color: var(--c-on-accent);
}

.main {
  flex: 1;
  width: 100%; max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--space-4) var(--space-4) calc(var(--tabbar) + var(--space-7));
}
.main--wide { max-width: var(--wide-max); }

.page-header { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-4); }

/* Untere Tab-Leiste (Handy) */
.tabbar {
  position: fixed; inset: auto 0 0 0; z-index: 20;
  height: calc(var(--tabbar) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--c-surface);
  border-top: 1px solid var(--c-border);
}
.tabbar__item {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: var(--tap-min);
  color: var(--c-text-muted); text-decoration: none;
  font-size: var(--text-xs); line-height: var(--leading-xs); font-weight: var(--weight-xs);
  position: relative;
}
.tabbar__item[aria-current="page"] { color: var(--c-accent); }
.tabbar__item[aria-current="page"]::before {
  content: ""; position: absolute; top: 0; left: 30%; right: 30%; height: 3px;
  border-radius: 0 0 3px 3px; background: var(--c-accent);
}
.tabbar__item .icon { width: 24px; height: 24px; }

/* Seitenleiste (Desktop) */
.sidebar { display: none; }

@media (min-width: 1024px) {
  .app { display: grid; grid-template-columns: var(--sidebar) 1fr; grid-template-rows: var(--topbar) 1fr; }
  .topbar { grid-column: 1 / -1; padding: 0 var(--space-6); }
  .sidebar {
    display: flex; flex-direction: column; gap: 2px;
    position: sticky; top: var(--topbar); height: calc(100vh - var(--topbar));
    padding: var(--space-4) var(--space-3);
    background: var(--c-surface); border-right: 1px solid var(--c-border);
    overflow-y: auto;
  }
  .sidebar__section { margin: var(--space-4) var(--space-3) var(--space-1); font-size: var(--text-xs); font-weight: 600; color: var(--c-text-muted); text-transform: uppercase; letter-spacing: .04em; }
  .sidebar__item {
    display: flex; align-items: center; gap: var(--space-3);
    min-height: 40px; padding: 0 var(--space-3);
    border-radius: var(--radius-sm);
    color: var(--c-text); text-decoration: none; font-size: var(--text-sm);
  }
  .sidebar__item:hover { background: var(--c-surface-2); color: var(--c-text); }
  .sidebar__item[aria-current="page"] { background: var(--c-accent-soft); color: var(--c-on-accent-soft); font-weight: 600; }
  .sidebar__item .icon { color: var(--c-text-muted); }
  .sidebar__item[aria-current="page"] .icon { color: inherit; }
  .sidebar__logout { margin-top: auto; padding-top: var(--space-4); }
  .sidebar__logout .sidebar__item { width: 100%; border: 0; background: none; font: inherit; font-size: var(--text-sm); cursor: pointer; }
  .tabbar { display: none; }
  .main { padding: var(--space-7) var(--space-7) var(--space-8); }
}

/* ------------------------------------------------------------------ Buttons */

.btn {
  --btn-bg: var(--c-surface); --btn-fg: var(--c-text); --btn-border: var(--c-border-input);
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: 40px; padding: 0 var(--space-4);
  border: 1px solid var(--btn-border); border-radius: var(--radius-md);
  background: var(--btn-bg); color: var(--btn-fg);
  font-size: var(--text-sm); font-weight: 600; line-height: 1;
  text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background var(--motion-fast) var(--ease), border-color var(--motion-fast) var(--ease), transform var(--motion-fast) var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: var(--c-surface-2); color: var(--btn-fg); }
.btn:active { transform: translateY(1px); }
.btn--primary { --btn-bg: var(--c-accent); --btn-fg: var(--c-on-accent); --btn-border: var(--c-accent); }
.btn--primary:hover { background: var(--c-accent-hover); border-color: var(--c-accent-hover); }
.btn--ghost { --btn-bg: transparent; --btn-border: transparent; }
.btn--danger { --btn-bg: var(--c-surface); --btn-fg: var(--c-danger); --btn-border: var(--c-danger); }
.btn--danger:hover { background: var(--c-reply-no-soft); }
.btn--sm { min-height: 32px; padding: 0 var(--space-3); border-radius: var(--radius-sm); }
.btn--lg { min-height: 48px; padding: 0 var(--space-6); font-size: var(--text-base); }
.btn--block { width: 100%; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; }
.btn[aria-busy="true"] { position: relative; color: transparent; pointer-events: none; }
.btn[aria-busy="true"]::after {
  content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--btn-fg); border-right-color: transparent;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.icon-btn {
  display: inline-grid; place-items: center;
  width: var(--tap-min); height: var(--tap-min);
  border: 0; border-radius: var(--radius-pill); background: transparent;
  color: var(--c-text-muted); cursor: pointer; position: relative;
}
.icon-btn:hover { background: var(--c-surface-2); color: var(--c-text); }
.icon-btn .dot {
  position: absolute; top: 9px; right: 9px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--c-danger); box-shadow: 0 0 0 2px var(--c-surface);
}

.fab {
  position: fixed; z-index: 15;
  right: var(--space-4); bottom: calc(var(--tabbar) + env(safe-area-inset-bottom) + var(--space-4));
  display: inline-flex; align-items: center; gap: var(--space-2);
  height: 56px; padding: 0 var(--space-5);
  border: 0; border-radius: var(--radius-pill);
  background: var(--c-accent); color: var(--c-on-accent);
  box-shadow: var(--shadow-fab); font-weight: 600; text-decoration: none; cursor: pointer;
}
.fab:hover { background: var(--c-accent-hover); color: var(--c-on-accent); }
@media (min-width: 1024px) { .fab { bottom: var(--space-7); right: var(--space-7); } }

/* ------------------------------------------------------------------ Formulare */

.field { display: flex; flex-direction: column; gap: var(--space-1); }
.label { font-size: var(--text-sm); font-weight: 600; }
.label .opt { font-weight: 400; color: var(--c-text-muted); }
.hint { font-size: var(--text-xs); line-height: var(--leading-xs); color: var(--c-text-muted); }
.error-text { display: flex; gap: var(--space-1); align-items: center; font-size: var(--text-sm); color: var(--c-danger); }

.input, .select, .textarea {
  width: 100%; min-height: var(--tap-min);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--c-border-input); border-radius: var(--radius-md);
  background: var(--c-surface); color: var(--c-text);
}
.textarea { min-height: 96px; resize: vertical; }
/* iOS Safari: Datums-/Zeitfelder bringen eigene Mindestbreite, Höhe und zentrierten Text mit */
.input[type="date"], .input[type="time"], .input[type="datetime-local"] { appearance: none; -webkit-appearance: none; min-width: 0; text-align: left; line-height: normal; }
.input::-webkit-date-and-time-value { text-align: left; margin: 0; }
.select { appearance: none; padding-right: var(--space-7);
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.input::placeholder, .textarea::placeholder { color: var(--c-text-muted); opacity: 1; }
.input:focus-visible, .select:focus-visible, .textarea:focus-visible { outline: 2px solid var(--c-focus); outline-offset: 0; border-color: var(--c-focus); }
.input[aria-invalid="true"], .select[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--c-danger); }
.input:disabled, .select:disabled, .textarea:disabled { background: var(--c-surface-2); color: var(--c-text-muted); cursor: not-allowed; }

.grid-2 { display: grid; gap: var(--space-3); grid-template-columns: 1fr 1fr; }
.invite-more { border: 1px solid var(--c-border); border-radius: var(--radius-md); }
.invite-more > summary { display: flex; align-items: center; gap: var(--space-2); min-height: var(--tap-min); padding: 0 var(--space-3); cursor: pointer; list-style: none; font-weight: 600; font-size: var(--text-sm); }
.invite-more > summary::-webkit-details-marker { display: none; }
.invite-more > summary .muted { margin-left: auto; font-weight: 400; text-align: right; }
.invite-more__body { padding: 0 var(--space-3) var(--space-3); }
.person-picks { max-height: 14rem; overflow-y: auto; border: 1px solid var(--c-border); border-radius: var(--radius-md); padding: 0 var(--space-3); }
.person-pick { min-height: 40px; padding: var(--space-1) 0; }
.meeting-fields { display: grid; gap: var(--space-3); grid-template-columns: minmax(7rem, 9rem) 1fr; }

.check { display: flex; align-items: flex-start; gap: var(--space-3); min-height: var(--tap-min); padding: var(--space-2) 0; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--c-accent); flex: none; }

/* Schalter: <label class="switch"><input type="checkbox" role="switch"><span class="switch__track"></span> Text</label> */
.switch { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); min-height: var(--tap-min); cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch__track {
  order: 2; flex: none; width: 44px; height: 26px; border-radius: var(--radius-pill);
  background: var(--c-reply-none-fill); position: relative; transition: background var(--motion-fast) var(--ease);
}
.switch__track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--c-surface); box-shadow: 0 1px 2px rgba(0,0,0,.3); transition: transform var(--motion-fast) var(--ease);
}
.switch input:checked + .switch__track { background: var(--c-accent); }
.switch input:checked + .switch__track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch__track { outline: 2px solid var(--c-focus); outline-offset: 2px; }
.switch input:disabled + .switch__track { opacity: .5; }

/* Segmentierte Auswahl (Radio-Gruppe) */
.segmented { display: inline-flex; padding: 3px; gap: 3px; border-radius: var(--radius-md); background: var(--c-surface-2); border: 0; margin: 0; }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; }
.segmented span {
  display: inline-flex; align-items: center; min-height: 34px; padding: 0 var(--space-3);
  border-radius: calc(var(--radius-md) - 3px); font-size: var(--text-sm); font-weight: 600; color: var(--c-text-muted); cursor: pointer;
}
.segmented input:checked + span { background: var(--c-surface); color: var(--c-text); box-shadow: var(--shadow-card); }
.segmented input:focus-visible + span { outline: 2px solid var(--c-focus); outline-offset: 1px; }

.form-section { padding: var(--space-4); }
.form-section + .form-section { border-top: 1px solid var(--c-border); }
.form-section__title { font-size: var(--text-sm); font-weight: 700; color: var(--c-text-muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: var(--space-3); }
.form-actions {
  position: sticky; bottom: calc(var(--tabbar) + env(safe-area-inset-bottom));
  display: flex; gap: var(--space-2); justify-content: flex-end;
  padding: var(--space-3) var(--space-4); background: var(--c-surface); border-top: 1px solid var(--c-border);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
@media (min-width: 1024px) { .form-actions { bottom: 0; } }

/* ------------------------------------------------------------------ Karten, Listen */

.card { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); }
.card__body { padding: var(--space-4); }
.card__header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2) var(--space-3); padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--c-border); }

.list { list-style: none; margin: 0; padding: 0; }
.list-item { display: flex; align-items: center; gap: var(--space-3); min-height: 56px; padding: var(--space-2) var(--space-4); }
.list-item + .list-item { border-top: 1px solid var(--c-border); }
.list-item__body { flex: 1; min-width: 0; }
.list-item__title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.list-item { color: inherit; text-decoration: none; }
a.list-item:hover { background: var(--c-surface-2); }

.list-group-title {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: var(--space-5) var(--space-1) var(--space-2);
  font-size: var(--text-sm); font-weight: 700; color: var(--c-text-muted);
}

/* ------------------------------------------------------------------ Chips, Badges, Avatare */

.chip {
  display: inline-flex; align-items: center; gap: var(--space-1);
  height: 24px; padding: 0 var(--space-2); border-radius: var(--radius-pill);
  font-size: var(--text-xs); font-weight: 600; line-height: 1; white-space: nowrap;
  background: var(--c-surface-2); color: var(--c-text);
}
.chip--accent { background: var(--c-accent-soft); color: var(--c-on-accent-soft); }
.chip--warning { background: var(--c-warning-soft); color: var(--c-warning); }
.chip--danger { background: var(--c-reply-no-soft); color: var(--c-reply-no); }
.chip--success { background: var(--c-reply-yes-soft); color: var(--c-reply-yes); }
.chip__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dot, currentColor); }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px var(--space-2); border-radius: var(--radius-sm); border: 1px solid var(--c-border);
  font-size: var(--text-xs); font-weight: 600; color: var(--c-text-muted); background: var(--c-surface);
}

.avatar {
  --size: 36px;
  width: var(--size); height: var(--size); flex: none; border-radius: 50%;
  display: inline-grid; place-items: center; overflow: hidden;
  background: var(--c-accent-soft); color: var(--c-on-accent-soft);
  font-size: calc(var(--size) * .38); font-weight: 700; letter-spacing: .02em;
}
.avatar--sm { --size: 28px; }
.avatar--lg { --size: 48px; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ------------------------------------------------------------------ Termin: Datumsblock */

.date-block {
  width: 56px; flex: none; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.date-block__wd { font-size: var(--text-xs); font-weight: 700; color: var(--c-text-muted); text-transform: uppercase; }
.date-block__day { font-size: var(--text-xl); font-weight: 700; line-height: 1; }
.date-block__mon { font-size: var(--text-xs); color: var(--c-text-muted); }
.date-block__time { font-size: var(--text-xs); font-weight: 600; margin-top: 2px; }
.deadline {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: var(--text-xs); font-weight: 600; color: var(--c-text-muted);
}
.deadline--soon { color: var(--c-warning); }
.deadline--closed { color: var(--c-text-muted); text-decoration: line-through; }

/* ------------------------------------------------------------------ Rückmelde-Balken */

.reply-bar { display: flex; height: 8px; border-radius: var(--radius-pill); overflow: hidden; background: var(--c-reply-none-fill); }
.reply-bar span { display: block; height: 100%; }
.reply-bar .yes { background: var(--c-reply-yes-fill); }
.reply-bar .maybe { background: var(--c-reply-maybe-fill); }
.reply-bar .no { background: var(--c-reply-no-fill); }
.reply-counts { display: flex; gap: var(--space-3); font-size: var(--text-xs); font-weight: 600; margin-top: 4px; }
.reply-counts .yes { color: var(--c-reply-yes); }
.reply-counts .maybe { color: var(--c-reply-maybe); }
.reply-counts .no { color: var(--c-reply-no); }
.reply-counts .none { color: var(--c-reply-none); }
.reply-counts span { display: inline-flex; align-items: center; gap: 2px; }

/* ------------------------------------------------------------------ Rückmelde-Steuerung (✓ ? ✕) */

.reply-control { display: grid; grid-template-columns: repeat(var(--n, 3), minmax(0, 1fr)); gap: var(--space-2); }
.reply-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-1);
  min-width: 0; min-height: 48px; padding: 0 var(--space-2);
  border-radius: var(--radius-md); border: 1.5px solid var(--c-border-input);
  background: var(--c-surface); color: var(--c-text);
  font-weight: 700; font-size: var(--text-sm); cursor: pointer;
  transition: background var(--motion-fast) var(--ease), color var(--motion-fast) var(--ease);
}
.reply-btn .icon { width: 20px; height: 20px; }
.reply-btn--yes { color: var(--c-reply-yes); }
.reply-btn--maybe { color: var(--c-reply-maybe); }
.reply-btn--no { color: var(--c-reply-no); }
.reply-btn--yes:hover { background: var(--c-reply-yes-soft); }
.reply-btn--maybe:hover { background: var(--c-reply-maybe-soft); }
.reply-btn--no:hover { background: var(--c-reply-no-soft); }
.reply-btn--yes[aria-pressed="true"] { background: var(--c-reply-yes-fill); border-color: var(--c-reply-yes-fill); color: var(--c-on-fill); }
.reply-btn--maybe[aria-pressed="true"] { background: var(--c-reply-maybe-fill); border-color: var(--c-reply-maybe-fill); color: var(--c-on-fill-maybe); }
.reply-btn--no[aria-pressed="true"] { background: var(--c-reply-no-fill); border-color: var(--c-reply-no-fill); color: var(--c-on-fill); }
.reply-btn:disabled { opacity: .5; cursor: not-allowed; }
.reply-control--compact .reply-btn { min-height: 40px; }
.reply-control--compact .reply-btn span { display: none; }

/* Status-Symbol (Kreis mit Icon) – Farbe nie allein: immer mit Icon */
.reply-dot {
  width: 24px; height: 24px; flex: none; border-radius: 50%;
  display: inline-grid; place-items: center;
  background: var(--c-reply-none-soft); color: var(--c-reply-none);
}
.reply-dot .icon { width: 14px; height: 14px; stroke-width: 3; }
.reply-dot--yes { background: var(--c-reply-yes-fill); color: var(--c-on-fill); }
.reply-dot--maybe { background: var(--c-reply-maybe-fill); color: var(--c-on-fill-maybe); }
.reply-dot--no { background: var(--c-reply-no-fill); color: var(--c-on-fill); }

/* ------------------------------------------------------------------ Termin-Listeneintrag */

.appt-list { display: flex; flex-direction: column; gap: var(--space-2); list-style: none; margin: 0; padding: 0; }
.appt {
  position: relative; overflow: hidden;
  background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}
.appt__content {
  position: relative; z-index: 1;
  display: flex; gap: var(--space-3); padding: var(--space-3) var(--space-3) var(--space-3) var(--space-2);
  background: var(--c-surface); color: inherit; text-decoration: none;
  transition: transform var(--motion-base) var(--ease);
  touch-action: pan-y;
}
.appt__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.appt__title { font-weight: 700; line-height: 1.3; }
.appt__meta { display: flex; flex-wrap: wrap; gap: 4px var(--space-3); font-size: var(--text-sm); color: var(--c-text-muted); }
.appt__meta > span { display: inline-flex; align-items: center; gap: 4px; }
.appt__chips { display: flex; flex-wrap: wrap; gap: 4px; }
.appt__side { display: flex; flex-direction: column; align-items: flex-end; justify-content: space-between; gap: var(--space-2); }
.appt__accent { position: absolute; left: 0; top: 0; bottom: 0; width: 4px; z-index: 2; background: var(--appt-color, transparent); }
.appt--cancelled .appt__title { text-decoration: line-through; color: var(--c-text-muted); }
.appt--past { opacity: .75; }

/* Wisch-Aktionen: liegen unter dem Inhalt, werden beim Wischen nach links sichtbar */
.appt__actions {
  position: absolute; inset: 0 0 0 auto; z-index: 0;
  display: flex;
}
.appt__actions button {
  width: 72px; border: 0; display: grid; place-items: center; gap: 2px; cursor: pointer;
  font-size: var(--text-xs); font-weight: 700;
}
.appt__actions .yes { background: var(--c-reply-yes-fill); color: var(--c-on-fill); }
.appt__actions .maybe { background: var(--c-reply-maybe-fill); color: var(--c-on-fill-maybe); }
.appt__actions .no { background: var(--c-reply-no-fill); color: var(--c-on-fill); }
.appt.is-open .appt__content { transform: translateX(calc(-72px * var(--n, 3))); }
/* Langes Wischen wie in Mail-Apps: Farbe und Symbol folgen dem Finger, ab ~40 % wird ausgelöst */
.appt__swipe { position: absolute; inset: 0; z-index: 0; display: none; align-items: center; justify-content: space-between; padding: 0 var(--space-5); font-weight: 700; font-size: var(--text-sm); }
.appt__swipe > span { display: inline-flex; align-items: center; gap: var(--space-2); transition: transform var(--motion-fast, 120ms) var(--ease); }
.appt__swipe .icon { width: 22px; height: 22px; stroke-width: 3; }
.appt[data-drag="right"] .appt__swipe { display: flex; background: var(--c-reply-yes-fill); color: var(--c-on-fill); }
.appt[data-drag="left"].is-armed .appt__swipe { display: flex; justify-content: flex-end; background: var(--c-reply-no-fill); color: var(--c-on-fill); }
.appt[data-drag="right"] .appt__swipe-no, .appt[data-drag="left"] .appt__swipe-yes { display: none; }
.appt.is-armed .appt__swipe > span { transform: scale(1.25); }
.appt.is-dragging .appt__content { transition: none; }
.appt.is-flying .appt__content { transition: transform 220ms ease-in; }
.appt--flash { animation: appt-flash 900ms var(--ease); }
@keyframes appt-flash { from { box-shadow: 0 0 0 3px var(--c-accent); } to { box-shadow: var(--shadow-card); } }
.appt__reason { padding: var(--space-3); border-top: 1px solid var(--c-border); background: var(--c-surface); position: relative; z-index: 1; }
@media (prefers-reduced-motion: reduce) { .appt__content, .appt.is-flying .appt__content { transition: none; } .appt--flash { animation: none; } }

/* ------------------------------------------------------------------ Tabs */

.tabs { display: flex; gap: var(--space-1); border-bottom: 1px solid var(--c-border); overflow-x: auto; scrollbar-width: none; }
.tabs a, .tabs button {
  flex: none; display: inline-flex; align-items: center; gap: var(--space-2);
  min-height: var(--tap-min); padding: 0 var(--space-3);
  border: 0; border-bottom: 2px solid transparent; background: none;
  color: var(--c-text-muted); font-size: var(--text-sm); font-weight: 600; text-decoration: none; cursor: pointer;
}
.tabs [aria-selected="true"], .tabs [aria-current="page"] { color: var(--c-accent); border-bottom-color: var(--c-accent); }
.tabs .count { font-size: var(--text-xs); padding: 0 6px; border-radius: var(--radius-pill); background: var(--c-surface-2); color: var(--c-text-muted); }

/* ------------------------------------------------------------------ Hinweise, Leerzustand, Toast */

.alert {
  display: flex; gap: var(--space-3); align-items: flex-start;
  padding: var(--space-3) var(--space-4); border-radius: var(--radius-md);
  background: var(--c-accent-soft); color: var(--c-on-accent-soft); font-size: var(--text-sm);
}
.alert .icon { margin-top: 1px; }
.alert--warning { background: var(--c-warning-soft); color: var(--c-warning); }
.alert--danger { background: var(--c-reply-no-soft); color: var(--c-reply-no); }
.alert--success { background: var(--c-reply-yes-soft); color: var(--c-reply-yes); }
.alert strong { display: block; }

.empty { text-align: center; padding: var(--space-8) var(--space-4); display: flex; flex-direction: column; align-items: center; gap: var(--space-3); }
.empty__icon { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: var(--c-surface-2); color: var(--c-text-muted); }
.empty__icon .icon { width: 28px; height: 28px; }
.empty p { color: var(--c-text-muted); max-width: 32ch; }

.toast-region {
  position: fixed; z-index: 50; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--tabbar) + env(safe-area-inset-bottom) + var(--space-4));
  display: flex; flex-direction: column; gap: var(--space-2); width: min(92vw, 420px); pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3) var(--space-4); border-radius: var(--radius-md);
  background: var(--c-text); color: var(--c-surface); box-shadow: var(--shadow-pop);
  font-size: var(--text-sm); pointer-events: auto;
  animation: toast-in var(--motion-base) var(--ease);
}
.toast button { margin-left: auto; background: none; border: 0; color: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
@media (min-width: 1024px) { .toast-region { bottom: var(--space-7); } }

/* ------------------------------------------------------------------ Dialog / Bottom-Sheet */

.dialog {
  width: min(92vw, 480px); max-height: 85vh; padding: 0;
  border: 0; border-radius: var(--radius-lg);
  background: var(--c-surface); color: var(--c-text); box-shadow: var(--shadow-pop);
}
.dialog::backdrop { background: color-mix(in srgb, var(--c-scrim) 55%, transparent); }
.dialog__header { display: flex; align-items: center; justify-content: space-between; padding: var(--space-4) var(--space-4) 0; }
.dialog__body { padding: var(--space-3) var(--space-4) var(--space-4); }
.dialog__footer { display: flex; justify-content: flex-end; gap: var(--space-2); padding: var(--space-3) var(--space-4); border-top: 1px solid var(--c-border); }
@media (max-width: 719px) {
  .dialog--sheet { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: var(--radius-lg) var(--radius-lg) 0 0; padding-bottom: env(safe-area-inset-bottom); }
}

/* ------------------------------------------------------------------ Teilnehmerliste */

.people-group + .people-group { margin-top: var(--space-2); }
.people-group summary {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
  min-height: var(--tap-min); padding: 0 var(--space-4); cursor: pointer; list-style: none;
  font-weight: 700; background: var(--c-surface-2);
}
.people-group summary::-webkit-details-marker { display: none; }
.person { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) var(--space-4); }
.person + .person { border-top: 1px solid var(--c-border); }
.person__name { flex: 1; min-width: 0; }
.person__comment { font-size: var(--text-sm); color: var(--c-text-muted); font-style: italic; }

.lineup-status { display: inline-flex; align-items: center; gap: 4px; font-size: var(--text-xs); font-weight: 700; }
.lineup-status--ok { color: var(--c-reply-yes); }
.lineup-status--short { color: var(--c-reply-no); }

/* ------------------------------------------------------------------ Matrix (Rückmeldungstabelle) */

.matrix-wrap { overflow: auto; max-height: 70vh; border: 1px solid var(--c-border); border-radius: var(--radius-lg); background: var(--c-surface); }
.matrix { border-collapse: separate; border-spacing: 0; font-size: var(--text-sm); }
.matrix th, .matrix td { padding: 0; border-bottom: 1px solid var(--c-border); border-right: 1px solid var(--c-border); }
.matrix thead th {
  position: sticky; top: 0; z-index: 2; background: var(--c-surface);
  padding: var(--space-2); min-width: 64px; vertical-align: bottom; font-size: var(--text-xs); text-align: center;
}
.matrix thead th .d { display: block; font-size: var(--text-sm); font-weight: 700; }
.matrix tbody th, .matrix thead th:first-child {
  position: sticky; left: 0; z-index: 1; background: var(--c-surface);
  text-align: left; padding: var(--space-2) var(--space-3); white-space: nowrap; font-weight: 600; min-width: 160px;
}
.matrix thead th:first-child { z-index: 3; }
.matrix .group th { background: var(--c-surface-2); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .04em; color: var(--c-text-muted); }
.matrix .group td { background: var(--c-surface-2); }
.matrix td { position: relative; text-align: center; height: 36px; }
.matrix td.yes { background: var(--c-reply-yes-soft); color: var(--c-reply-yes); }
.matrix td.no { background: var(--c-reply-no-soft); color: var(--c-reply-no); }
.matrix td.maybe { background: var(--c-reply-maybe-soft); color: var(--c-reply-maybe); }
.matrix td.none { color: var(--c-reply-none); }
.matrix td .icon { margin: auto; width: 16px; height: 16px; stroke-width: 3; }
.matrix tfoot td, .matrix tfoot th { position: sticky; bottom: 0; background: var(--c-surface); font-weight: 700; font-size: var(--text-xs); padding: var(--space-2); }

/* ------------------------------------------------------------------ Umfrage-Ergebnis */

.poll-option { display: grid; grid-template-columns: 1fr auto; gap: 4px var(--space-3); align-items: center; }
.poll-option__bar { grid-column: 1 / -1; height: 8px; border-radius: var(--radius-pill); background: var(--c-surface-2); overflow: hidden; }
.poll-option__bar span { display: block; height: 100%; background: var(--c-accent); border-radius: inherit; }
.poll-option--mine .poll-option__label { font-weight: 700; }

/* ------------------------------------------------------------------ Lade-Skelett */

.skeleton { border-radius: var(--radius-sm); background: linear-gradient(90deg, var(--c-surface-2), var(--c-border), var(--c-surface-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }

/* ------------------------------------------------------------------ Design-Seite */

.ds-section { scroll-margin-top: calc(var(--topbar) + var(--space-4)); }
.ds-section > h2 { margin-bottom: var(--space-3); }
.ds-swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: var(--space-2); }
.ds-swatch { border: 1px solid var(--c-border); border-radius: var(--radius-md); overflow: hidden; background: var(--c-surface); font-size: var(--text-xs); }
.ds-swatch i { display: block; height: 44px; background: var(--sw); border-bottom: 1px solid var(--c-border); }
.ds-swatch span { display: block; padding: 6px 8px; font-family: var(--font-mono); word-break: break-all; }
.ds-demo { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }

/* ------------------------------------------------------------------ Schlichte Seiten (Login, Setup, Antwort-Link) */

.plain {
  width: 100%; max-width: 480px; margin: 0 auto;
  padding: var(--space-7) var(--space-4) var(--space-8);
  display: flex; flex-direction: column; gap: var(--space-4);
}
.plain--wide { max-width: 640px; }
.plain__brand { display: flex; align-items: center; gap: var(--space-2); font-weight: 700; font-size: var(--text-lg); }
.divider { display: flex; align-items: center; gap: var(--space-3); color: var(--c-text-muted); font-size: var(--text-sm); }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--c-border); }
.code { font-family: var(--font-mono); font-size: var(--text-sm); word-break: break-all; background: var(--c-surface-2); padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: var(--space-1) var(--space-4); font-size: var(--text-sm); }
.kv dt { color: var(--c-text-muted); }
.kv dd { margin: 0; }

[data-hide-mobile] { display: none; }
@media (min-width: 1024px) {
  [data-hide-mobile] { display: inline-flex; }
  .main .fab { display: none; }
  [data-swipe-hint] { display: none; }
}
[hidden] { display: none !important; }

/* Zeile mit Symbol + Text, der umbrechen darf (Termin-Eckdaten) */
.meta-line { display: flex; align-items: flex-start; gap: var(--space-2); }
.meta-line .icon { margin-top: 2px; }
.meta-line > span { min-width: 0; }

/* In der Mail gewählte Antwort: deutlich markieren, bis sie bestätigt ist */
.reply-btn--yes[data-suggested] { background: var(--c-reply-yes-soft); border-color: var(--c-reply-yes); }
.reply-btn--maybe[data-suggested] { background: var(--c-reply-maybe-soft); border-color: var(--c-reply-maybe); }
.reply-btn--no[data-suggested] { background: var(--c-reply-no-soft); border-color: var(--c-reply-no); }

/* Ganze Listenzeile klickbar über einen Link im Titel (Buttons in der Zeile bleiben bedienbar) */
.list-item { position: relative; }
.list-item a.stretched { color: inherit; text-decoration: none; }
.list-item a.stretched::after { content: ""; position: absolute; inset: 0; }
.list-item a.stretched:hover { text-decoration: underline; }
.list-item form, .list-item .btn { position: relative; z-index: 1; }

/* Zuordnungs-Tabelle (Person × Rolle) */
.assign-row { display: grid; grid-template-columns: 1fr minmax(0, 11rem); align-items: center; gap: var(--space-3); padding: var(--space-2) var(--space-4); }
.assign-row + .assign-row { border-top: 1px solid var(--c-border); }
.assign-row .select { min-height: 40px; }
.assign-row.is-in { background: var(--c-accent-soft); }

/* Quote-Balken in der Statistik */
.rate { display: grid; grid-template-columns: 1fr 3.2em; gap: var(--space-2); align-items: center; min-width: 120px; }
.rate__bar { height: 8px; border-radius: var(--radius-pill); background: var(--c-surface-2); overflow: hidden; }
.rate__bar span { display: block; height: 100%; background: var(--c-reply-yes-fill); }
.rate__bar.low span { background: var(--c-reply-no-fill); }
.rate__bar.mid span { background: var(--c-reply-maybe-fill); }
.rate b { text-align: right; font-variant-numeric: tabular-nums; }
.table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.table th, .table td { padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--c-border); text-align: left; }
.table th { font-size: var(--text-xs); color: var(--c-text-muted); text-transform: uppercase; letter-spacing: .04em; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table tr.group td { background: var(--c-surface-2); font-weight: 700; font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .04em; color: var(--c-text-muted); }
.table-wrap { overflow-x: auto; }
.filters { display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); align-items: end; }
.filters > * { min-width: 0; }
@media (max-width: 719px) { .filters { grid-template-columns: 1fr; } }
.matrix td.attended-1 { box-shadow: inset 0 -3px 0 var(--c-reply-yes-fill); }
.matrix td.attended-0 { box-shadow: inset 0 -3px 0 var(--c-reply-no-fill); }
.rate { min-width: 96px; grid-template-columns: 1fr auto; }
.rate b { white-space: nowrap; }
.table td:first-child { white-space: nowrap; }
@media (max-width: 719px) {
  .table th, .table td { padding: var(--space-2); }
  .table .hide-mobile { display: none; }
}

/* ------------------------------------------------------------------ Kalender (Monat) */

.cal { overflow: hidden; }
.cal__head, .cal__grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal__head div { padding: var(--space-2) 0; text-align: center; font-size: var(--text-xs); font-weight: 700; color: var(--c-text-muted); border-bottom: 1px solid var(--c-border); }
.cal__day {
  min-height: 56px; padding: 4px; display: flex; flex-direction: column; gap: 2px; min-width: 0;
  border-right: 1px solid var(--c-border); border-bottom: 1px solid var(--c-border);
}
.cal__day:nth-child(7n) { border-right: 0; }
.cal__day.is-weekend { background: color-mix(in srgb, var(--c-surface-2) 45%, transparent); }
.cal__day.is-other .cal__num { color: var(--c-text-muted); opacity: .6; }
.cal__day.is-absent { background-image: repeating-linear-gradient(135deg, transparent 0 6px, var(--c-surface-2) 6px 9px); }
.cal__num { align-self: flex-start; min-width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; font-size: var(--text-sm); font-weight: 600; color: var(--c-text); text-decoration: none; }
a.cal__num:hover { background: var(--c-surface-2); }
.cal__day.is-today .cal__num { background: var(--c-accent); color: var(--c-on-accent); }
.cal__item {
  display: flex; gap: 4px; align-items: center; min-width: 0;
  padding: 1px 4px; border-radius: 4px; font-size: var(--text-xs); line-height: 1.35; text-decoration: none;
  color: var(--c-text); background: var(--c-reply-none-soft); border-left: 3px solid var(--c-reply-none-fill);
}
.cal__item--yes { background: var(--c-reply-yes-soft); border-left-color: var(--c-reply-yes-fill); }
.cal__item--maybe { background: var(--c-reply-maybe-soft); border-left-color: var(--c-reply-maybe-fill); }
.cal__item--no { background: var(--c-reply-no-soft); border-left-color: var(--c-reply-no-fill); }
.cal__item--cancelled { text-decoration: line-through; color: var(--c-text-muted); }
.cal__time { font-weight: 700; font-variant-numeric: tabular-nums; }
.cal__title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal__more { font-size: var(--text-xs); color: var(--c-text-muted); text-decoration: none; }
.cal-legend { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--fill); }
.cal-legend--absent { border-radius: 3px; background: repeating-linear-gradient(135deg, transparent 0 3px, var(--c-text-muted) 3px 4px); }
.cal-title { white-space: nowrap; }
@media (max-width: 719px) { .cal-title { font-size: var(--text-xl); } }
/* Handy: statt Titeln farbige Punkte */
@media (max-width: 719px) {
  .cal__day { min-height: 52px; align-items: center; padding: 3px 2px; }
  .cal__num { align-self: center; }
  .cal__item { width: 8px; height: 8px; padding: 0; border-radius: 50%; border: 0; display: inline-block; background: var(--c-reply-none-fill); }
  .cal__item--yes { background: var(--c-reply-yes-fill); }
  .cal__item--maybe { background: var(--c-reply-maybe-fill); }
  .cal__item--no, .cal__item--cancelled { background: var(--c-reply-no-fill); }
  .cal__item .cal__time, .cal__item .cal__title { display: none; }
  .cal__day { flex-direction: column; }
  .cal__day .cal__item { margin: 0 1px; }
}
@media (min-width: 1024px) { .cal__day { min-height: 96px; } }

/* ------------------------------------------------------------------ Umfragen */

.poll-choices { display: flex; flex-direction: column; gap: var(--space-2); }
.poll-choice {
  display: flex; align-items: center; gap: var(--space-3); min-height: var(--tap-min);
  padding: var(--space-2) var(--space-3); border: 1.5px solid var(--c-border-input); border-radius: var(--radius-md);
  background: var(--c-surface); cursor: pointer;
}
.poll-choice input { width: 20px; height: 20px; margin: 0; accent-color: var(--c-accent); flex: none; }
.poll-choice__label { flex: 1; min-width: 0; }
.poll-choice:has(input:checked) { border-color: var(--c-accent); background: var(--c-accent-soft); color: var(--c-on-accent-soft); }
.poll-choice:has(input:focus-visible) { outline: 2px solid var(--c-focus); outline-offset: 2px; }
.poll-choice.is-taken { cursor: not-allowed; background: var(--c-surface-2); color: var(--c-text-muted); }
.poll-choice.is-taken .poll-choice__label { text-decoration: line-through; }
.poll-card { display: block; color: inherit; text-decoration: none; }
.poll-card:hover { color: inherit; }
.poll-card .card__body { display: flex; flex-direction: column; gap: var(--space-2); }
.count-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--radius-pill); background: var(--c-danger); color: var(--c-on-fill); font-size: var(--text-xs); font-weight: 700; display: inline-grid; place-items: center; }
.tab-dot { position: absolute; top: 8px; left: calc(50% + 8px); width: 9px; height: 9px; border-radius: 50%; background: var(--c-danger); box-shadow: 0 0 0 2px var(--c-surface); }

/* Kalender-Abo: zwei Varianten mit Ampel-Legende */
.ical-legend { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-4); margin: 0; }
.ical-option { display: grid; gap: var(--space-2); padding: var(--space-3); border: 1px solid var(--c-border); border-radius: var(--radius-md); }
.ical-option .hint { display: block; }

/* Ausgeblendete Einträge (z. B. archivierte Termin-Arten) */
.is-muted { opacity: .6; }
.alert summary::-webkit-details-marker { display: none; }

/* Besetzung: Register + Rolle je Person */
.assign-row--2 { grid-template-columns: minmax(0, 1fr) auto; }
.assign-row--2 .select { width: auto; max-width: 11rem; }
@media (max-width: 560px) {
  .assign-row--2 { grid-template-columns: 1fr; gap: var(--space-2); }
  .assign-row--2 .select { max-width: none; flex: 1; min-width: 0; }
}

/* Besetzungsregeln je Register */
.lineup-rules { display: grid; gap: var(--space-1); margin-top: var(--space-2); }
.lineup-rules__head, .lineup-rules__row { display: grid; grid-template-columns: minmax(0, 1fr) 5rem 5rem; gap: var(--space-2); align-items: center; }
.lineup-rules__row .input { min-height: 36px; text-align: center; }

/* Rollen-Auswahl: Checkboxen als Chips (mehrere Rollen je Einheit) */
.role-picks { display: flex; flex-wrap: wrap; gap: var(--space-2); grid-column: 1 / -1; }
.role-pick { position: relative; }
.role-pick input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.role-pick span {
  display: inline-flex; align-items: center; gap: var(--space-1); min-height: 32px; padding: 0 var(--space-3);
  border: 1px solid var(--c-border); border-radius: var(--radius-pill); font-size: var(--text-sm); color: var(--c-text-muted); background: var(--c-surface);
}
.role-pick input:checked + span { background: var(--c-accent); border-color: var(--c-accent); color: var(--c-on-accent); }
.role-pick input:focus-visible + span { outline: 2px solid var(--c-focus); outline-offset: 2px; }
.role-pick input:disabled + span { opacity: .55; cursor: not-allowed; }
.assign-row:not(.is-in) .role-picks { display: none; }

/* Rollen & Rechte */
.rights { display: grid; gap: var(--space-1); }
.right-row { display: grid; grid-template-columns: minmax(0, 1fr) 11rem; align-items: center; gap: var(--space-3); padding: 2px 0; }
.right-row .select { min-height: 36px; }
@media (max-width: 30rem) { .right-row { grid-template-columns: 1fr; gap: 2px; } }
.role-card__summary { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-3) var(--space-4); cursor: pointer; min-height: var(--tap-min); }
.role-card details[open] .role-card__summary { border-bottom: 1px solid var(--c-border); }
.role-card__summary > span:last-child { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }

/* Rückmeldungs-Verlauf */
.history { list-style: none; margin: 0; padding: var(--space-2) var(--space-4); }
.history__item { display: flex; gap: var(--space-3); align-items: flex-start; padding: var(--space-2) 0; }
.history__item + .history__item { border-top: 1px solid var(--c-border); }
.history__item .reply-dot { width: 10px; height: 10px; min-width: 10px; margin-top: 6px; border-radius: 50%; padding: 0; }
.history__body { min-width: 0; flex: 1; overflow-wrap: anywhere; }
.history__comment { color: var(--c-text-muted); font-style: italic; margin-left: var(--space-1); }
.history__flag { color: var(--c-warning); font-weight: 600; }

/* Kacheln der Auswertung */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: var(--space-3); margin-bottom: var(--space-4); }
.tile { padding: var(--space-4); }
.tile h2 { font-size: var(--text-base); margin: 0; }
.tile__hint { margin: 2px 0 var(--space-3); }
.tile ol { list-style: none; margin: 0; padding: 0; counter-reset: rank; }
.tile li { display: flex; justify-content: space-between; gap: var(--space-3); padding: 4px 0; counter-increment: rank; }
.tile li::before { content: counter(rank); width: 1.25rem; color: var(--c-text-muted); font-variant-numeric: tabular-nums; }
.tile li span:first-of-type { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile li b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.tile--good h2 { color: var(--c-reply-yes); }
.stat-num { font-size: 1.75rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.history-box { border-top: 1px solid var(--c-border); }
.history-box > summary { list-style: none; }
.history-box > summary::-webkit-details-marker { display: none; }

/* Auswertung: eingeklappte Filterleiste mit Kurzfassung */
.filter-box__summary { display: flex; align-items: center; gap: var(--space-3); min-height: var(--tap-min); padding: var(--space-2) var(--space-4); cursor: pointer; list-style: none; }
.filter-box__summary::-webkit-details-marker { display: none; }
.filter-box__chips { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; gap: var(--space-1); }
.filter-box__chevron { color: var(--c-text-muted); transition: transform var(--motion-fast) var(--ease); }
.filter-box[open] .filter-box__chevron { transform: rotate(180deg); }
.filter-box[open] .filter-box__summary { border-bottom: 1px solid var(--c-border); }
.filter-box__body { padding: var(--space-4); }
/* Mehrfachauswahl als Pillen (Checkbox versteckt) */
.pick-pills { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.pick-pill { position: relative; }
.pick-pill input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.pick-pill span {
  display: inline-flex; align-items: center; gap: 4px; min-height: 36px; padding: 0 var(--space-3);
  border: 1px solid var(--c-border-input); border-radius: var(--radius-pill); background: var(--c-surface);
  font-size: var(--text-sm); font-weight: 600; white-space: nowrap;
}
.pick-pill .icon { display: none; }
.pick-pill input:checked + span { background: var(--c-accent-soft); color: var(--c-on-accent-soft); border-color: var(--c-accent); }
.pick-pill input:checked + span .icon { display: inline-block; }
.pick-pill input:focus-visible + span { outline: 2px solid var(--c-focus); outline-offset: 1px; }

/* Vorschläge für Absagegründe */
.reason-picks { display: flex; flex-wrap: wrap; gap: var(--space-1); margin-top: var(--space-1); }
.reason-pick {
  min-height: 32px; padding: 0 var(--space-3); border: 1px solid var(--c-border); border-radius: var(--radius-pill);
  background: var(--c-surface); color: var(--c-text); font: inherit; font-size: var(--text-sm); cursor: pointer;
}
.reason-pick:hover { border-color: var(--c-accent); }
.reason-pick[aria-pressed="true"] { background: var(--c-accent-soft); border-color: var(--c-accent); color: var(--c-on-accent-soft); }

/* ------------------------------------------------------------------ Karten-Modus „Offene Termine abarbeiten“ */
.work { max-width: 30rem; margin: 0 auto; display: flex; flex-direction: column; gap: var(--space-3); }
.work__head { display: flex; justify-content: space-between; align-items: center; }
.work__stack { position: relative; min-height: 26rem; }
.swipe-card {
  position: absolute; inset: 0; display: flex; flex-direction: column; gap: var(--space-2);
  padding: var(--space-5); overflow: hidden; touch-action: none; user-select: none; cursor: grab;
  background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius-lg); box-shadow: var(--shadow-card);
  transform: translateY(calc(min(var(--depth, 0), 2) * 10px)) scale(calc(1 - min(var(--depth, 0), 2) * .04));
  transition: transform 260ms var(--ease), opacity 260ms var(--ease);
}
.swipe-card[hidden] { display: none; }
.swipe-card.is-dragging { transition: none; cursor: grabbing; }
.swipe-card__title { font-size: var(--text-2xl); line-height: 1.2; margin: var(--space-1) 0 0; }
.swipe-card__date { display: flex; flex-direction: column; font-size: var(--text-lg); }
.swipe-card__day { font-weight: 700; color: var(--c-accent); }
.swipe-card__desc { white-space: pre-line; color: var(--c-text-muted); font-size: var(--text-sm); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; margin: 0; }
.swipe-card__link { margin-top: auto; align-self: flex-start; }
.swipe-card__reason { margin-top: auto; padding-top: var(--space-3); border-top: 1px solid var(--c-border); }
.swipe-card__stamp {
  position: absolute; top: var(--space-5); display: inline-flex; align-items: center; gap: var(--space-1);
  padding: var(--space-1) var(--space-3); border: 3px solid currentColor; border-radius: var(--radius-md);
  font-weight: 800; font-size: var(--text-lg); text-transform: uppercase; letter-spacing: .04em;
  opacity: 0; pointer-events: none; background: var(--c-surface);
}
.swipe-card__stamp--yes { left: var(--space-4); color: var(--c-reply-yes); transform: rotate(-12deg); opacity: var(--yes, 0); }
.swipe-card__stamp--no { right: var(--space-4); color: var(--c-reply-no); transform: rotate(12deg); opacity: var(--no, 0); }
.swipe-card__stamp--maybe { left: 50%; top: auto; bottom: var(--space-6, 3rem); color: var(--c-reply-maybe-fill); transform: translateX(-50%); opacity: var(--maybe, 0); }
.work__buttons { display: flex; justify-content: center; gap: var(--space-4); }
.work-btn {
  width: 64px; height: 64px; border-radius: 50%; border: 2px solid currentColor; background: var(--c-surface);
  display: grid; place-items: center; cursor: pointer; box-shadow: var(--shadow-card); position: relative;
}
.work-btn span { position: absolute; top: 100%; margin-top: 4px; font-size: var(--text-xs); font-weight: 700; white-space: nowrap; }
.work-btn .icon { width: 28px; height: 28px; stroke-width: 3; }
.work-btn--yes { color: var(--c-reply-yes); }
.work-btn--no { color: var(--c-reply-no); }
.work-btn--maybe { color: var(--c-reply-maybe-fill); width: 52px; height: 52px; align-self: center; }
.work-btn:active { transform: scale(.92); }
.work-btn[disabled] { opacity: .35; cursor: default; }
.work__hint { text-align: center; margin-top: var(--space-4); }
.work__done { text-align: center; padding: var(--space-6, 3rem) var(--space-4); }
.work__party { font-size: 4rem; animation: party 900ms var(--ease); }
@keyframes party { 0% { transform: scale(.2) rotate(-30deg); opacity: 0; } 60% { transform: scale(1.2) rotate(10deg); opacity: 1; } 100% { transform: none; } }
.undo-bar {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h, 64px) + var(--space-4)); transform: translateX(-50%); z-index: 50;
  display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) var(--space-2) var(--space-2) var(--space-4);
  background: var(--c-text); color: var(--c-surface); border-radius: var(--radius-pill); box-shadow: var(--shadow-card); font-size: var(--text-sm);
}
.undo-bar[hidden] { display: none; }
.work-banner { margin: var(--space-2) 0; text-decoration: none; }
@media (prefers-reduced-motion: reduce) { .swipe-card { transition: none; } .work__party { animation: none; } }

.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--c-accent); text-decoration: underline; cursor: pointer; }
.link-btn[hidden] { display: none; }

/* Formulare mit mehreren Abschnitten: auf dem Desktop jeder Abschnitt eine eigene Karte, im Raster (Spalten füllen sich wie Mauerwerk); die Aktionen stehen dann oben im Seitenkopf */
@media (min-width: 1024px) {
  .form-grid { background: none; border: 0; box-shadow: none; columns: 2 24rem; column-gap: var(--space-4); }
  .form-grid > .form-section {
    break-inside: avoid; margin-bottom: var(--space-4);
    background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius-lg); box-shadow: var(--shadow-card);
    padding: var(--space-5);
  }
  .form-grid > .form-section + .form-section { border-top: 1px solid var(--c-border); }
}

/* Aktionen eines Formulars: auf dem Handy unten in der festen Leiste, auf dem Desktop oben rechts im Seitenkopf */
.page-actions { display: none; }
.btn--danger-text { color: var(--c-reply-no); }
@media (min-width: 1024px) {
  .page-actions { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; justify-content: flex-end; }
  .form-grid > .form-actions { display: none; }
}

/* ------------------------------------------------------------------ Belegungsplan Räume */
@media (max-width: 639px) { .hide-sm { display: none !important; } }
.plan-bar { display: flex; flex-wrap: wrap; gap: var(--space-3); justify-content: space-between; align-items: center; margin-bottom: var(--space-3); }
.plan-bar .select { min-width: 12rem; }
.plan { display: none; overflow: hidden; margin-bottom: var(--space-4); }
.plan__head, .plan__body { display: grid; grid-template-columns: 3.5rem repeat(7, minmax(0, 1fr)); }
.plan__head { border-bottom: 1px solid var(--c-border); background: var(--c-surface-2); }
.plan__head span { padding: var(--space-2); font-size: var(--text-sm); color: var(--c-text-muted); text-align: center; }
.plan__head .is-today { color: var(--c-accent); }
.plan__body { height: calc(var(--hours) * 44px); }
.plan__hours { display: grid; grid-template-rows: repeat(var(--hours), 1fr); font-size: var(--text-xs); color: var(--c-text-muted); }
.plan__hours span { padding: 2px var(--space-2); border-top: 1px solid var(--c-border); text-align: right; }
.plan__day {
  position: relative; border-left: 1px solid var(--c-border);
  background-image: linear-gradient(to bottom, var(--c-border) 1px, transparent 1px); background-size: 100% calc(100% / var(--hours));
}
.plan__day.is-today { background-color: var(--c-accent-soft); }
.plan__item {
  position: absolute; margin: 0 1px; padding: 2px 4px; overflow: hidden; border-radius: var(--radius-sm);
  font-size: var(--text-xs); line-height: 1.25; text-decoration: none; color: var(--c-on-accent); background: var(--c-accent);
  border: 1px solid var(--c-surface);
}
.plan__item small { display: block; opacity: .85; }
.plan__item--res, .plan-key.plan__item--res { background: var(--c-reply-maybe-fill); color: var(--c-on-fill-maybe); }
.plan__item--ext, .plan-key.plan__item--ext { background: repeating-linear-gradient(135deg, var(--c-surface-2) 0 6px, var(--c-border) 6px 12px); color: var(--c-text); }
.plan-key { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; margin: 0 2px 0 var(--space-2); background: var(--c-accent); position: static; }
.plan__allday { display: block; margin: 2px; padding: 2px 4px; font-size: var(--text-xs); border-radius: var(--radius-sm); background: var(--c-surface-2); color: inherit; text-decoration: none; position: relative; z-index: 1; }
@media (min-width: 1024px) { .plan { display: block; } }
.plan-list__day { padding: var(--space-2) var(--space-4); background: var(--c-surface-2); font-size: var(--text-sm); font-weight: 700; }
.plan-list__item { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-3); align-items: center; padding: var(--space-3) var(--space-4); border-top: 1px solid var(--c-border); }
.plan-list__item > div { flex: 1 1 12rem; min-width: 0; }
.plan-list__item > form { margin-left: auto; }
.plan-list__time { width: 6.5rem; flex: none; font-variant-numeric: tabular-nums; font-size: var(--text-sm); }
.plan-list__item:target { background: var(--c-accent-soft); }
/* Belegungsplan: Ziehen zum Reservieren und Verschieben */
.plan__day { cursor: crosshair; touch-action: none; user-select: none; -webkit-user-select: none; }
.plan__item { cursor: pointer; }
.plan__item.is-draggable { cursor: grab; }
.plan__item.is-dragging { cursor: grabbing; opacity: .85; box-shadow: var(--shadow-card); z-index: 3; }
.plan__resize { position: absolute; left: 0; right: 0; bottom: 0; height: 8px; cursor: ns-resize; }
.plan__resize::after { content: ""; position: absolute; left: 40%; right: 40%; bottom: 2px; height: 2px; border-radius: 2px; background: currentColor; opacity: .5; }
.plan__ghost {
  position: absolute; left: 1px; right: 1px; z-index: 2; pointer-events: none; padding: 2px 4px;
  border: 2px dashed var(--c-accent); border-radius: var(--radius-sm); background: var(--c-accent-soft);
  font-size: var(--text-xs); font-weight: 600; color: var(--c-on-accent-soft);
}
.plan-hint { display: none; margin-top: var(--space-2); }
@media (min-width: 1024px) { .plan-hint { display: block; } }
