/* ============================================================
   Eventplaner - Haupt-Stylesheet
   Schlichtes, ansprechendes Design ohne externe Frameworks.
   ============================================================ */

:root {
  --color-bg: #f0f2f5;
  --color-surface: #ffffff;
  --color-border: #e9ecef;
  --color-text: #344767;
  --color-text-muted: #8392ab;
  --color-primary: #5e72e4;
  --color-primary-dark: #4054c4;
  --color-primary-light: #eaecfb;
  --color-danger: #ea0606;
  --color-danger-light: #fde3e3;
  --color-zebra: #fbfcfe;

  /* Material-Dashboard-typischer Indigo/Purple-Verlauf fuer Sidebar, primaere
     Buttons und Hervorhebungen. */
  --gradient-primary: linear-gradient(135deg, #7795f8 0%, #5e72e4 100%);
  --gradient-sidebar: linear-gradient(180deg, #1a1f37 0%, #1a2035 100%);

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;

  --shadow-sm: 0 1px 3px rgba(20, 20, 60, 0.06);
  --shadow-md: 0 8px 26px -4px rgba(20, 20, 60, 0.16), 0 8px 9px -5px rgba(20, 20, 60, 0.06);

  --nav-width: 72px;

  --font: "Work Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 17px;
  line-height: 1.5;
}

a {
  color: var(--color-primary);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

h1, h2, h3 {
  font-weight: 700;
  margin: 0 0 0.5em;
}

h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }

p { margin: 0 0 1em; }

/* ---------------- Layout ---------------- */

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--nav-width);
  background: var(--gradient-sidebar);
  border-right: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 0;
  position: sticky;
  top: 0;
  height: 100vh;
  box-shadow: var(--shadow-md);
}

.sidebar__logo {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--gradient-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  margin-bottom: 24px;
  text-decoration: none;
  box-shadow: var(--shadow-md);
  transition: opacity 0.15s;
}
.sidebar__logo:hover { opacity: 0.9; text-decoration: none; }

.sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.sidebar__link {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #a8b0c4;
  font-size: 20px;
  transition: background 0.15s, color 0.15s;
}

.sidebar__link:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  text-decoration: none;
}

.sidebar__link.is-active {
  background: var(--gradient-primary);
  color: white;
  box-shadow: var(--shadow-md);
}

.icon {
  display: block;
  flex-shrink: 0;
}

.btn .icon { margin-right: 6px; }
.btn--icon .icon { margin-right: 0; }

h1 .icon, h2 .icon, h3 .icon {
  display: inline-block;
  vertical-align: -4px;
  margin-right: 6px;
}

.sidebar__footer {
  margin-top: auto;
}

/* Hamburger-Menu: nur auf Mobile sichtbar (siehe @media unten), auf
   Desktop irrelevant da die Sidebar dort den Platz reserviert. */
.mobile-menu {
  display: none;
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 200;
}

.mobile-menu__toggle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  cursor: pointer;
}

.mobile-menu__panel {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 200px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 8px;
  flex-direction: column;
  gap: 2px;
}
.mobile-menu__panel.is-open { display: flex; }

.mobile-menu__panel a,
.mobile-menu__panel button {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--color-text);
  background: none;
  border: none;
  font-size: 0.9rem;
  font-family: var(--font);
  cursor: pointer;
  width: 100%;
  text-align: left;
}
.mobile-menu__panel a:hover,
.mobile-menu__panel button:hover {
  background: var(--color-primary-light);
  text-decoration: none;
}

.main {
  flex: 1;
  padding: 32px 40px;
  width: 100%;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.topbar__actions {
  display: flex;
  gap: 8px;
}

.topbar__meta {
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--color-text-muted);
  margin-bottom: 6px;
}
.back-link:hover { color: var(--color-primary); text-decoration: none; }

/* ---------------- Cards / Surfaces ---------------- */

.card {
  background: var(--color-surface);
  border: none;
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.card__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}
/* Im Karten-Kopf den h2-Unterabstand entfernen, damit Titel und ggf.
   davorstehende Icons (z.B. Checklisten-Typ) sauber zentriert sind. */
.card__header h2 { margin: 0; }

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

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: var(--gradient-primary);
  color: white;
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.2;
  cursor: pointer;
  box-shadow: 0 1px 5px -2px rgba(94, 114, 228, 0.45);
  transition: box-shadow 0.15s, transform 0.05s, opacity 0.15s;
}
.btn:hover { opacity: 0.92; text-decoration: none; }
.btn:active { transform: scale(0.98); }
.btn:disabled,
.btn[disabled] { opacity: 0.45; cursor: not-allowed; pointer-events: none; }

.btn--secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border-color: var(--color-border);
}
.btn--secondary:hover { background: var(--color-bg); }

.btn--danger {
  background: var(--color-danger-light);
  color: var(--color-danger);
}
.btn--danger:hover { background: #f0d4cd; }

.btn--icon {
  padding: 8px;
  width: 36px;
  height: 36px;
  justify-content: center;
}

.btn--sm {
  padding: 6px 12px;
  font-size: 0.82rem;
}

.btn--xs.btn--icon {
  width: 26px;
  height: 26px;
  padding: 4px;
}

.btn--outline {
  background: transparent;
  color: var(--color-primary);
  border-color: var(--color-primary);
}
.btn--outline:hover { background: var(--color-primary-light); }

.btn.is-disabled {
  opacity: 0.4;
  pointer-events: none;
  cursor: default;
}

.zoom-indicator {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  font-weight: 500;
  padding: 0 2px;
  white-space: nowrap;
}

.topbar__meta-sep { display: inline; }

/* ---------------- Forms ---------------- */

.form-group {
  margin-bottom: 18px;
}

.form-row {
  display: flex;
  gap: 16px;
}
.form-row > .form-group { flex: 1; }

.form-row--time {
  gap: 8px;
  align-items: flex-start;
  justify-content: flex-start;
}
.form-row--time > .form-group {
  flex: 0 0 auto;
}
.form-row--time .timepicker__trigger {
  width: auto;
  min-width: 84px;
}
.form-group--sep {
  flex: 0 0 auto;
}
.form-group--sep label {
  visibility: hidden;
}
.form-row--time .form-row__sep {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 0 2px;
  box-sizing: border-box;
  color: var(--color-text-muted);
  font-weight: 500;
}

.form-group--half {
  max-width: 50%;
}

/* ---------------- Timepicker (custom wheel picker, no library) ---------------- */

.timepicker {
  position: relative;
}

.timepicker__trigger {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  font-family: var(--font);
  font-size: 0.92rem;
  text-align: left;
  cursor: pointer;
}
.timepicker__trigger:focus,
.timepicker__trigger:hover {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}

.timepicker__panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 50;
  display: none;
  align-items: center;
  gap: 4px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 8px 12px;
}
.timepicker__panel.is-open { display: flex; }

.timepicker__sep {
  font-weight: 600;
  color: var(--color-text-muted);
}

.timepicker__col {
  width: 56px;
  height: 168px;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
  padding: 72px 0;
}
.timepicker__col::-webkit-scrollbar { display: none; }

.timepicker__option {
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  scroll-snap-align: center;
  font-size: 0.92rem;
  color: var(--color-text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
}
.timepicker__option.is-active {
  color: var(--color-primary-dark);
  font-weight: 600;
  background: var(--color-primary-light);
}

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--color-text-muted);
}

input[type="text"],
input[type="email"],
input[type="number"],
input[type="password"],
input[type="date"],
textarea,
select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.92rem;
  background: var(--color-surface);
  color: var(--color-text);
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}

.field-error {
  color: var(--color-danger);
  font-size: 0.8rem;
  margin-top: 4px;
}

.help-text {
  color: var(--color-text-muted);
  font-size: 0.8rem;
  margin-top: 4px;
}

/* ---------------- Daterange picker (custom, no library) ---------------- */

.daterange {
  position: relative;
}

.daterange__display {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: var(--color-surface);
  font-size: 0.92rem;
}

.daterange__popover {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 1000;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 16px;
  display: none;
}
.daterange__popover.is-open { display: block; }

.calendar-month {
  width: 240px;
}

.calendar-month__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-weight: 600;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  text-align: center;
  font-size: 0.8rem;
}

.calendar-grid__weekday {
  color: var(--color-text-muted);
  padding: 4px 0;
  font-weight: 500;
}

.calendar-day {
  padding: 6px 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.calendar-day:hover { background: var(--color-primary-light); }
.calendar-day.is-disabled { color: #ccc; cursor: default; }
.calendar-day.is-disabled:hover { background: none; }
.calendar-day.is-selected { background: var(--color-primary); color: white; }
.calendar-day.is-in-range { background: var(--color-primary-light); }

/* ---------------- Dashboard: gemeinsames Datums-Raster ---------------- */

/*
 * Tage/Teilnehmende/Aufgaben teilen sich EIN CSS-Grid (gleiche Spalten),
 * damit die vertikalen Tages-Trennlinien durchgaengig ueber alle drei
 * Abschnitte verlaufen, statt pro Abschnitt einzeln (und ggf. versetzt)
 * gezeichnet zu werden. Die Trennlinien werden von .dashboard-grid__lines
 * als eine einzige Schicht hinter allen Zeilen gerendert (grid-row: 1 / -1).
 */
.dashboard-grid {
  --label-width: 160px;
  position: relative;
  display: grid;
  grid-template-columns: var(--label-width) repeat(var(--day-count), 1fr);
  row-gap: 6px;
  column-gap: 12px;
  align-items: center;
}

/*
 * Absolut positioniert (statt als Grid-Item platziert): so bleibt die
 * Linien-Schicht aus dem Grid-Auto-Placement-Algorithmus heraus und
 * blockiert keine Zellen fuer die echten Inhalts-Zeilen, deckt aber per
 * top:0/bottom:0 trotzdem die volle Hoehe aller Zeilen ab (durchgaengige
 * Trennlinien über Tage-/Teilnehmer-/Aufgaben-Abschnitt hinweg).
 */
/* top startet erst nach der Tage-Kopfzeile (84px Zeilenhoehe + 6px
   row-gap), nicht bei 0 - die Linien/Hintergruende sollen erst ab der
   Zeile "Teilnehmende" beginnen, nicht durch die Tagesueberschriften
   selbst laufen. */
.dashboard-grid__weekends {
  position: absolute;
  top: 90px;
  bottom: 0;
  left: calc(var(--label-width) + 12px);
  right: 0;
  pointer-events: none;
  /* background-image (Wochenend-Spalten) wird inline pro Event gesetzt */
}

.dashboard-grid__lines {
  position: absolute;
  top: 90px;
  bottom: 0;
  left: calc(var(--label-width) + 12px);
  right: 0;
  /* zwei Schichten: kraeftigere Tagesgrenzen + dezente Drittel-Linien
     (Morgen/Mittag/Abend) fuer die feinere Ausrichtung der Balken */
  background-image:
    repeating-linear-gradient(
      to right,
      var(--color-border) 0,
      var(--color-border) 1px,
      transparent 1px,
      transparent calc(100% / var(--day-count))
    ),
    repeating-linear-gradient(
      to right,
      rgba(0, 0, 0, 0.05) 0,
      rgba(0, 0, 0, 0.05) 1px,
      transparent 1px,
      transparent calc(100% / var(--day-count) / 3)
    );
  pointer-events: none;
}

.dashboard-grid__section-title {
  grid-column: 1 / -1;
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0;
  padding-top: 6px;
  border-top: 1px solid var(--color-border);
}

.dashboard-grid__section-title__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: var(--label-width);
}

/* Summe direkt neben dem Sektionstitel (z.B. "Zusagen 4") */
.dashboard-grid__count {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--color-text-muted);
}

.dashboard-day-cell {
  text-align: center;
  padding: 8px 0;
  height: 84px;
  box-sizing: border-box;
}

.dashboard-day-cell__people {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 0.7rem;
  color: var(--color-text-muted);
  margin-top: 2px;
}
.dashboard-day-cell__people .icon { color: var(--color-text-muted); }

.calendar-icon {
  width: 40px;
  margin: 0 auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.calendar-icon__header {
  background: #b02f30;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  line-height: 1;
  padding: 3px 0;
}

.calendar-icon__day {
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.3;
}

.gantt__label {
  grid-column: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gantt__label-full,
.gantt__label-short {
  overflow: hidden;
  text-overflow: ellipsis;
}

.gantt__label-people {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  gap: 3px;
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--color-text-muted);
}
.gantt__label-people .icon { color: var(--color-text-muted); }

.gantt__label-short { display: none; }

.gantt__track {
  grid-column: 2 / -1;
  position: relative;
  height: 18px;
}

/* Schlanker Balken (4px) - der Name "schwebt" als Badge darueber statt
   im Balken selbst zu stehen, damit der Balken die Tages-Drittel-Linien
   nicht verdeckt. */
.gantt__bar {
  position: absolute;
  top: 50%;
  height: 4px;
  margin-top: -2px;
  border-radius: 2px;
  background: var(--bar-color, var(--color-primary));
  cursor: grab;
  user-select: none;
  box-shadow: var(--shadow-sm);
}

/* Ueberlagert den (4px schlanken) Balken zentriert, statt darueber zu
   schweben - weisser Hintergrund, Schrift in der Balkenfarbe. */
.gantt__bar-badge {
  position: absolute;
  top: 50%;
  left: 5px;
  transform: translateY(-50%);
  background: white;
  color: var(--bar-color, var(--color-primary));
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1;
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
  pointer-events: none;
}
.gantt__bar-badge-icon {
  display: inline-flex;
  vertical-align: middle;
  margin-left: 4px;
}
.gantt__bar:active { cursor: grabbing; }

/* Absage-Balken: abgeschwaechtes Rot, nicht interaktiv */
.gantt__bar--declined {
  background: #e9b8b0;
  cursor: default;
}
.gantt__bar-badge--declined {
  color: #b3503f;
}

/* Vergroessert die Grabflaeche fuer "Verschieben" ueber die 4px Optik hinaus */
.gantt__bar::before {
  content: '';
  position: absolute;
  top: -8px;
  bottom: -8px;
  left: 0;
  right: 0;
}

/* Groessere unsichtbare Grabflaeche als der 4px-Balken selbst, damit
   die Drittel-Resize-Handles trotz der schlanken Optik gut greifbar bleiben. */
.gantt__bar-handle {
  position: absolute;
  top: -8px;
  bottom: -8px;
  width: 8px;
  cursor: ew-resize;
}
.gantt__bar-handle--left { left: -1px; }
.gantt__bar-handle--right { right: -1px; }

/* ---------------- Tabellen ---------------- */

table {
  width: 100%;
  border-collapse: collapse;
}

.table--compact th, .table--compact td {
  padding: 5px 12px;
  font-size: 0.85rem;
}
.table--compact .btn--icon {
  width: 28px;
  height: 28px;
  padding: 5px;
}

/* Aktions-Spalte (Bearbeiten/Loeschen/... ) immer rechtsbuendig */
.col-actions {
  text-align: right;
  white-space: nowrap;
}

th, td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.9rem;
}

/* "of" Selektor statt simplem nth-child, damit versteckte .edit-row-Zeilen
   (inline Bearbeitungsformulare) nicht mitgezaehlt werden - sonst wuerde
   jede zweite SICHTBARE Zeile durch die dazwischenliegende ausgeblendete
   Zeile aus dem Streifenmuster herausfallen. */
tbody tr:nth-child(odd of tr:not(.edit-row)) { background: var(--color-zebra); }
tbody tr:nth-child(even of tr:not(.edit-row)) { background: var(--color-surface); }

th {
  color: var(--color-text-muted);
  font-weight: 500;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

tr:last-child td { border-bottom: none; }

.edit-row td {
  background: var(--color-primary-light);
  padding: 16px 12px;
}

.edit-row__form .form-row { margin-bottom: 12px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 300;
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
}

/* Status-Badges der Einschreibung (Zusage/Absage/Ausstehend) */
.badge--yes { background: #e3f3e8; color: #2e7d4f; }
.badge--no { background: var(--color-danger-light); color: var(--color-danger); }
.badge--pending { background: var(--color-bg); color: var(--color-text-muted); }

.color-swatch {
  display: inline-block;
  width: 22px;
  height: 22px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
}

/* In der Gruppen-/Familien-Liste die Farbe als breiten Balken ueber die
   ganze Spaltenbreite darstellen (statt nur als kleines Quadrat). */
.col-color { width: 140px; }
.color-swatch--bar {
  display: block;
  width: 100%;
  height: 20px;
}

/* ---------------- Empty states / utility ---------------- */

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--color-text-muted);
}

.empty-state--overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.muted { color: var(--color-text-muted); }

.event-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

.event-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: box-shadow 0.15s, transform 0.1s;
  display: block;
}
.event-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  text-decoration: none;
}

.event-card__image {
  height: 130px;
  background: var(--color-primary-light);
  background-size: cover;
  background-position: center;
}

.event-card__body { padding: 16px; }

.event-card__title {
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 4px;
}

.event-card__dates {
  font-size: 0.82rem;
  color: var(--color-text-muted);
}

/* ---------------- Login ---------------- */

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg);
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-md);
}

.login-card__logo {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--color-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.1rem;
  margin: 0 auto 16px;
}

.alert {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 16px;
}
.alert--error {
  background: var(--color-danger-light);
  color: var(--color-danger);
}
.alert--info {
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
}

/* ---------------- Modal ---------------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal-backdrop.is-open { display: flex; }

.modal {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-md);
}

/* ---------------- Identitaets-Hinweis (persoenlicher Secret-Link) ---------------- */

.identity-banner {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 500;
  background: var(--color-primary);
  color: #fff;
  font-size: 0.75rem;
  padding: 4px 16px;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
}

/* ---------------- Toast (Undo-Hinweis Grundlage) ---------------- */

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--color-text);
  color: white;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 0.88rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 200;
}
.toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}
.toast__action {
  color: #9fd8c4;
  font-weight: 600;
  cursor: pointer;
  background: none;
  border: none;
  font-size: 0.88rem;
}

/* ---------------- Aufgaben: Tageskalender (vertikale Balken) ----------------
 * Eine Zeile (.task-calendar-row) im selben dashboard-grid, die intern
 * dieselbe 160px-Gutter + Tagesspalten-Aufteilung wie die Teilnehmer-
 * Zeilen nachbildet. Vertikale Tages-Trennlinien (dashboard-grid__lines)
 * laufen automatisch durch diese Zeile, da sie ueber die volle Hoehe des
 * .dashboard-grid gezeichnet werden. */

.task-calendar__hours {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--label-width, 160px);
}

.task-calendar__hour-label {
  position: absolute;
  right: 8px;
  transform: translateY(-50%);
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.task-calendar {
  position: absolute;
  left: calc(var(--label-width, 160px) + 12px);
  right: 0;
  top: 0;
  bottom: 0;
  border-radius: var(--radius-sm);
  cursor: crosshair;
  background-image: repeating-linear-gradient(
    to bottom,
    var(--color-border) 0,
    var(--color-border) 1px,
    transparent 1px,
    transparent calc(100% / var(--hour-span))
  );
}

.task-event.task-event--draft {
  background: var(--color-primary-light);
  border: 2px dashed var(--color-primary);
  pointer-events: none;
}

.task-event {
  position: absolute;
  min-height: 22px;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--task-color, var(--color-primary)) 14%, white);
  border-left: 3px solid var(--task-color, var(--color-primary));
  padding: 3px 6px;
  font-size: 0.74rem;
  overflow: hidden;
  cursor: grab;
  user-select: none;
  box-shadow: var(--shadow-sm);
}
.task-event:active { cursor: grabbing; }

.task-event__title {
  display: block;
  font-weight: 600;
  white-space: normal;
  overflow-wrap: break-word;
  line-height: 1.2;
}

.task-event__handle {
  position: absolute;
  left: 0;
  right: 0;
  height: 8px;
  cursor: ns-resize;
}
.task-event__handle--top { top: -4px; }
.task-event__handle--bottom { bottom: -4px; }

.task-event__avatars {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  margin-top: 3px;
}

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--avatar-color, var(--color-primary));
  color: white;
  font-size: 0.6rem;
  font-weight: 700;
  line-height: 1;
  flex-shrink: 0;
}

/* ---------------- Admin-Hub (pro Event) ---------------- */

.admin-hub {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.admin-hub__card {
  display: block;
  background: var(--color-surface);
  border: none;
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  color: var(--color-text);
  transition: box-shadow 0.15s, transform 0.15s;
}
.admin-hub__card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); text-decoration: none; }
.admin-hub__card .icon { color: var(--color-primary); margin-bottom: 12px; }
.admin-hub__card h2 { margin: 0 0 6px; font-size: 1rem; }
.admin-hub__card p { margin: 0; color: var(--color-text-muted); font-size: 0.85rem; }

/* ---------------- Multiselect-Autocomplete (Aufgaben-Zuweisung) ---------------- */

.multiselect {
  position: relative;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  background: var(--color-surface);
}

.multiselect__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 4px;
}
.multiselect__chips:empty { margin-bottom: 0; }

.multiselect__chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px 4px 10px;
  border-radius: 999px;
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
  font-size: 0.82rem;
  font-weight: 500;
}
.multiselect__chip button {
  border: none;
  background: rgba(0, 0, 0, 0.08);
  color: inherit;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  cursor: pointer;
  line-height: 1;
  font-size: 0.85rem;
}
.multiselect__chip button:hover { background: rgba(0, 0, 0, 0.18); }

.multiselect__input {
  border: none;
  padding: 4px 2px;
  width: 100%;
}
.multiselect__input:focus { outline: none; box-shadow: none; }

/* ---------------- Modal ---------------- */

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  align-items: center;
  justify-content: center;
  z-index: 300;
  padding: 20px;
}

.modal {
  position: relative;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-md);
}

.modal__close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
}

/* ---------------- Print ---------------- */

@media print {
  @page {
    size: landscape;
    margin: 12mm;
  }

  .no-print,
  .sidebar,
  .toast {
    display: none !important;
  }

  .main {
    margin: 0 !important;
    padding: 0 !important;
    background: #fff !important;
  }

  .card {
    background: #fff !important;
    border: none !important;
    box-shadow: none !important;
    filter: none !important;
    backdrop-filter: none !important;
    break-inside: avoid !important;
  }

  .task-event {
    background: #fff !important;
    background-image: none !important;
    color: #000 !important;
    opacity: 1 !important;
    mix-blend-mode: normal !important;
    border: 1px solid #999 !important;
    border-left: 3px solid #666 !important;
  }

  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    box-shadow: none !important;
    text-shadow: none !important;
    filter: none !important;
    backdrop-filter: none !important;
  }

  *::before,
  *::after {
    content: none !important;
    box-shadow: none !important;
    text-shadow: none !important;
    background: none !important;
    background-image: none !important;
    filter: none !important;
    backdrop-filter: none !important;
  }

  table {
    width: 100% !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
    background: #fff !important;
    border: 1px solid #999 !important;
  }

  thead,
  tbody,
  tr {
    background: #fff !important;
  }

  tbody tr:nth-child(odd of tr:not(.edit-row)),
  tbody tr:nth-child(even of tr:not(.edit-row)) {
    background: #fff !important;
  }

  th,
  td {
    background: #fff !important;
    color: #000 !important;
    opacity: 1 !important;
    mix-blend-mode: normal !important;
    border: 0 !important;
    border-right: 1px solid #999 !important;
    border-bottom: 1px solid #999 !important;
  }

  th {
    background: #e8e8e8 !important;
    font-weight: 600 !important;
    border-top: 0 !important;
  }

  th:first-child,
  td:first-child {
    border-left: 0 !important;
  }

  th:last-child,
  td:last-child {
    border-right: 0 !important;
  }

  thead tr:first-child th {
    border-top: 0 !important;
  }

  tbody tr:last-child td {
    border-bottom: 0 !important;
  }

  .edit-row td {
    background: #f5f5f5 !important;
  }
}


/* ---------------- Mobile ---------------- */

@media (max-width: 700px) {
  /* Sidebar reserviert keinen Platz mehr - Navigation lebt nur noch im
     floating Hamburger-Menu oben rechts (.mobile-menu). */
  .sidebar { display: none; }
  .mobile-menu { display: block; }

  .main { padding: 16px; }

  /* Teilnehmer-Spalte: nur Kuerzel statt vollem Namen, damit die
     Label-Spalte im Datums-Raster schmaler werden kann. */
  .dashboard-grid { --label-width: 64px; }
  .gantt__label-full { display: none; }
  .gantt__label-short { display: inline; }

  /* Aufgaben-Titel/Button kleiner */
  .dashboard-grid__section-title { font-size: 0.85rem; }
  .dashboard-grid__section-title .btn--xs.btn--icon { width: 22px; height: 22px; }

  /* Drucken auf Mobile ausblenden, "Event bearbeiten" nur als Icon */
  .btn-print { display: none; }
  .btn--icon-labelled .btn__label { display: none; }
  .btn--icon-labelled { padding: 8px; width: 36px; height: 36px; justify-content: center; }

  /* Tage-Anzahl direkt hinter dem Datumsbereich (inline), nicht auf
     eigener Zeile. */
  .topbar__meta-sep { display: inline; }
  .topbar__meta-days { display: inline; }


}

/* ---------------- Checklisten ---------------- */

/*
 * Echtes Masonry-Stacking statt CSS-Grid: mit multi-column-Layout
 * fliesst jede Karte unabhaengig in die jeweils kuerzere Spalte, statt
 * dass (wie bei CSS Grid) Karten in derselben Reihe sich gegenseitig
 * in der Hoehe beeinflussen.
 */
.checklist-grid {
  column-count: 2;
  column-gap: 20px;
}
.checklist-grid > .card {
  break-inside: avoid;
  -webkit-column-break-inside: avoid;
  display: inline-block;
  width: 100%;
  vertical-align: top;
  /* Isoliert Layout/Style-Neuberechnung auf die einzelne Karte: ohne
     "contain" zwingt jede Hoehenaenderung innerhalb einer Karte (z.B.
     Tippen in einem Titel-/Item-Feld) den Browser dazu, das gesamte
     mehrspaltige column-count-Raster (und damit potenziell alle anderen
     Karten) neu zu fliessen - das macht sich bei vielen Checklisten als
     spuerbares Tipp-Lag bemerkbar. */
  contain: layout style;
}
@media (max-width: 800px) {
  .checklist-grid { column-count: 1; }
  #add-checklist-card { width: 100% !important; }
  .checklist__item-title { font-size: 0.82rem; }

  /* "Neuer Eintrag" und "Zuweisen zu" untereinander statt in einer engen
     Zeile, damit beide Felder auf Mobile genug Breite zum Tippen haben. */
  .checklist__add-form {
    flex-wrap: wrap;
  }
  .checklist__add-title {
    flex: 1 1 100%;
  }
  .checklist__add-form .autocomplete {
    flex: 1 1 100%;
  }
}

.checklist__title--editable {
  cursor: pointer;
  display: inline-block;
  padding: 2px 8px;
  margin: -2px -8px;
  border-radius: var(--radius-sm);
  transition: background 0.12s, color 0.12s;
}
.checklist__title--editable:hover {
  color: var(--color-primary);
  background: var(--color-primary-light);
}

.checklist__rename-form {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
}
.checklist__rename-form input { flex: 1; }
.checklist__rename-form select { flex: 0 0 auto; width: auto; }
.checklist__rename-form .btn--icon { width: 40px; height: 40px; flex-shrink: 0; }

/* Typ-Icon (persoenlich/geteilt) im Checklisten-Kopf */
.checklist__type-icon {
  display: inline-flex;
  align-items: center;
  color: var(--color-text-muted);
  flex-shrink: 0;
}

/* Auswahl der Listen-Art im Anlege-Formular */
.checklist__type-option {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
  cursor: pointer;
}
.checklist__type-option .icon { color: var(--color-text-muted); }

.checklist__item-edit-form {
  display: flex;
  gap: 8px;
  align-items: center;
  flex: 1;
  flex-wrap: wrap;
}

.checklist {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.checklist__item {
  display: flex;
  align-items: start;
  gap: 12px;
  padding: 8px 10px;
}
.checklist__item:nth-child(odd) { background: var(--color-zebra); }
.checklist__item:nth-child(even) { background: var(--color-surface); }

.checklist__item-toggle { display: flex; }

.checklist__checkbox {
  width: 22px;
  height: 22px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--color-border);
  background: var(--color-surface);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
.checklist__item.is-checked .checklist__checkbox {
  background: var(--color-primary);
  border-color: var(--color-primary);
}
.checklist__checkbox:disabled { cursor: default; opacity: 0.6; }

/* Kurzer Pulse, solange die Toggle-Anfrage unterwegs ist */
.checklist__checkbox.is-pending {
  animation: checklist-pulse 0.7s ease-in-out infinite;
}

/* "Save"-Pop, sobald der Server die Aenderung bestaetigt hat */
.checklist__checkbox.is-saved {
  animation: checklist-pop 0.35s ease-out;
}

@keyframes checklist-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

@keyframes checklist-pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.35); box-shadow: 0 0 0 6px var(--color-primary-light); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 transparent; }
}

.checklist__item-body {
  flex: 1;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.checklist__item-body[onclick] {
  cursor: pointer;
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  margin: -4px -8px;
  transition: background 0.12s;
}
.checklist__item-body[onclick]:hover {
  background: var(--color-primary-light);
}
.checklist__item-body[onclick]:hover .checklist__item-title { color: var(--color-primary); }

.checklist__item-title {
  font-size: 0.92rem;
}
.checklist__item.is-checked .checklist__item-title {
  text-decoration: line-through;
  color: var(--color-text-muted);
}

.checklist__item-meta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.75rem;
  font-weight: 300;
  color: var(--color-text-muted);
}
.checklist__item-meta .icon { flex-shrink: 0; }
.checklist__item-meta [data-checked-by] { font-weight: 300; }

.checklist__add-form {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
}
.checklist__add-title { flex: 1; }
.checklist__add-form .btn--icon,
.checklist__item-edit-form .btn--icon {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

/* ---------------- Autocomplete (Checklisten-Zuweisung) ---------------- */

.autocomplete {
  position: relative;
  width: 220px;
}

.autocomplete-select {
  position: relative;
  width: 100%;
}

.autocomplete__dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 1000;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  max-height: 200px;
  overflow-y: auto;
}
.autocomplete__dropdown.is-open { display: block; }

.autocomplete__option {
  padding: 8px 12px;
  font-size: 0.88rem;
  cursor: pointer;
}
.autocomplete__option:hover,
.autocomplete__option.is-highlighted { background: var(--color-primary-light); }
