/* ========================================================================
   Team-Kalender - Stylesheet
   Mobile-first, dark/light-tauglich (über CSS-Variablen)
   ======================================================================== */

:root {
  --app-bg: #0f172a;
  --bg: #f1f5f9;
  --bg-soft: #f8fafc;
  --card: #ffffff;
  --border: #e2e8f0;
  --border-soft: #edf2f7;
  --text: #1e293b;
  --text-muted: #64748b;
  --primary: #3788d8;
  --primary-soft: rgba(55,136,216,0.1);
  --primary-dark: #2d6fb8;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #f59e0b;
  --shadow-sm: 0 1px 2px rgba(15,23,42,0.04);
  --shadow: 0 1px 3px rgba(15,23,42,0.06), 0 4px 12px rgba(15,23,42,0.04);
  --shadow-lg: 0 10px 25px rgba(15,23,42,0.10), 0 4px 8px rgba(15,23,42,0.04);
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --transition: 150ms ease;
  --event-font-size: 0.78rem;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: linear-gradient(180deg, var(--app-bg), #020617);
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  /* Kein horizontales Scrollen / keine "Ueberbreite" auf dem Handy */
  overflow-x: hidden;
  max-width: 100%;
}
body { min-height: 100vh; position: relative; overflow-x: hidden; }
/* Sicherheitsnetz: nichts darf breiter als der Viewport werden */
#topbar, main, #view-calendar, #calendar-container, #sidebar,
.view, .modal-box { max-width: 100%; }

/* ========== HEADER ========== */
#topbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  /* Top-Padding wachsen lassen, damit der Header die Android-/iOS-Statusleiste nicht ueberdeckt */
  padding: calc(0.7rem + env(safe-area-inset-top, 0px)) 1.2rem 0.7rem;
  display: flex; align-items: center;
  gap: 1rem;
  position: sticky; top: 0; z-index: 50;
  flex-wrap: wrap;
  box-shadow: var(--shadow-sm);
}
.brand {
  font-weight: 700; font-size: 1.15rem;
  display: flex; align-items: center; gap: 0.5rem;
  background: linear-gradient(135deg, var(--primary), #5a9eea);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: -0.01em;
}
.brand span { display: inline-block; }
.header-avatar-left.avatar-sm { width: 34px; height: 34px; font-size: 0.85rem; }
nav { display: flex; gap: 0.25rem; flex: 1; }
.tab {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  padding: 0.55rem 1rem;
  border-radius: var(--radius); cursor: pointer; color: var(--text);
  font-size: 0.95rem; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
  min-height: 2.45rem;
  transition: background var(--transition), color var(--transition), transform var(--transition);
}
.tab.active {
  background: var(--bg);
  color: var(--text);
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
  font-weight: 700;
}
.tab:hover:not(.active) {
  background: var(--bg);
  transform: translateY(-1px);
}
.user-menu { display: flex; gap: 0.5rem; align-items: center; }
.mobile-menu-btn,
.mobile-menu-panel { display: none; }
.mobile-menu-btn {
  border: 1px solid rgba(245, 158, 11, 0.35);
  background: linear-gradient(135deg, #f97316, #facc15);
  color: #231600;
  border-radius: var(--radius);
  font-size: 1.15rem;
  font-weight: 800;
  width: 2.5rem;
  height: 2.5rem;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}
.mobile-menu-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 0.45rem;
  gap: 0.35rem;
}
.mobile-menu-panel button,
.mobile-menu-panel a {
  width: 100%;
  border: 1px solid var(--border-soft);
  background: var(--bg-soft);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 0.72rem 0.8rem;
  text-align: left;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.95rem;
}
.mobile-menu-panel button.active {
  background: linear-gradient(135deg, #f97316, #facc15);
  color: #231600;
  border-color: rgba(249, 115, 22, 0.55);
}
.user-menu a, .user-menu button {
  background: transparent; border: none; cursor: pointer;
  font-size: 1.05rem; padding: 0.45rem 0.65rem; border-radius: var(--radius);
  color: var(--text-muted); text-decoration: none;
  transition: background var(--transition);
}
.user-menu a:hover, .user-menu button:hover { background: var(--bg); }
#settings-btn {
  width: 2.45rem; height: 2.45rem;
  padding: 0 !important;
  font-size: 1.05rem !important;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--bg) !important;
  border: 1px solid var(--border-soft) !important;
  box-shadow: var(--shadow-sm);
}
#settings-btn:hover {
  background-color: var(--primary-soft) !important;
  transform: translateY(-1px);
}
#user-name { font-weight: 500; color: var(--text); font-size: 0.95rem; }
#app-version {
  position: fixed; right: 6px; bottom: 4px;
  z-index: 1200;
  font-size: 0.65rem; color: var(--text-muted);
  font-family: ui-monospace, Menlo, monospace; opacity: 0.72;
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  padding: 1px 5px;
  box-shadow: var(--shadow-sm);
  pointer-events: none; user-select: none;
}
#topbar { position: sticky; top: 0; }   /* falls nicht schon */
.btn-logout {
  font-size: 0.9rem !important; padding: 0.4rem 0.7rem !important;
  background: rgba(220,53,69,0.08) !important; color: #b02a37 !important;
  font-weight: 500;
}
.btn-logout:hover { background: rgba(220,53,69,0.16) !important; }
@media (max-width: 600px) {
  .btn-logout { font-size: 0 !important; padding: 0.4rem 0.55rem !important; }
  .btn-logout::before { content: "🚪"; font-size: 1.05rem; }
}

@media (max-width: 600px) {
  .brand span { display: none; }
  .brand { font-size: 0; }
  .header-avatar-left.avatar-sm { width: 34px; height: 34px; }
  /* Tabs: Icons + kurzer Text untereinander, gleichmaessig verteilt */
  nav { gap: 0.15rem; }
  .tab {
    padding: 0.4rem 0.5rem; font-size: 0.72rem;
    flex: 1; text-align: center; line-height: 1.1;
    flex-direction: column; gap: 0.15rem;
  }
  /* Garantiert mindestens 28px Top-Padding auf Handys, plus echte Safe-Area falls vorhanden */
  #topbar { padding: max(28px, calc(0.45rem + env(safe-area-inset-top, 0px))) 0.6rem 0.45rem; gap: 0.4rem; flex-wrap: nowrap; }
  #user-name { display: none; }
  .user-menu { gap: 0.25rem; }
  .btn-logout { font-size: 0 !important; padding: 0.4rem 0.5rem !important; }
  #header-avatar.avatar-sm { width: 26px; height: 26px; font-size: 0.7rem; }

  main { padding: 0.6rem 0; }
  #sidebar { padding: 0.9rem 0.4rem; border-radius: var(--radius); }
  #calendar-container { padding: 0.6rem 0; border-radius: var(--radius); }
  #sidebar button { padding: 0.8rem 0.9rem; font-size: 0.95rem; }
  .team-filter { padding: 0.65rem 0.6rem; }
  .cb-row { padding: 0.55rem 0.5rem; font-size: 0.95rem; }
  .fc .fc-button { padding: 0.5rem 0.7rem !important; font-size: 0.85rem !important; }
  .fc .fc-toolbar-title { font-size: 1.1rem !important; }
}
@media (max-width: 380px) {
  .tab { padding: 0.5rem 0.35rem; min-width: 44px; }
}

/* ========== MAIN ========== */
main { padding: 1rem; min-height: calc(100vh - 4.5rem); position: relative; z-index: 1; }
.view { display: none; }
.view.active { display: block; }

/* ========== KALENDER-VIEW ========== */
#view-calendar { display: none; gap: 1rem; }
#view-calendar.active { display: flex; }
#sidebar {
  position: fixed;
  top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(90vw, 700px);
  max-height: 85vh;
  overflow-y: auto;
  z-index: 1000;
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 1rem;
  box-shadow: var(--shadow);
  height: fit-content;
  border: 1px solid var(--border-soft);
  transition: width 0.25s ease, padding 0.25s ease, opacity 0.2s ease;
  overflow: hidden;
}
#sidebar:not(.sidebar-open) {
  display: none;
}
#sidebar.sidebar-open {
  box-shadow: 0 10px 40px rgba(0,0,0,0.35);
  border-radius: 12px;
}
#sidebar-close {
  position: sticky; top: 0; float: right;
  width: 36px; height: 36px;
  background: var(--bg); border: 1px solid var(--border-soft); border-radius: 50%;
  cursor: pointer; font-size: 1.3rem; line-height: 1;
  color: var(--text); font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  z-index: 5;
  margin-bottom: -36px;
}
#sidebar-close:hover { background: #dc3545; color: #fff; border-color: #dc3545; }
#sidebar-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 999;
}
#sidebar-backdrop.active { display: block; }
#sidebar h3 { font-size: 0.78rem; text-transform: uppercase; color: var(--text-muted);
              margin: 1.4rem 0 0.6rem; letter-spacing: 0.08em; font-weight: 600; }
#sidebar h3:first-child { margin-top: 0; }

.sidebar-toggle {
  display: block;
  margin: 0.6rem auto 0;
  min-width: 110px; height: 32px; padding: 0 1rem;
  background: var(--primary); border: 1px solid var(--primary);
  border-radius: 16px;
  cursor: pointer; font-size: 0.85rem; color: #fff; font-weight: 600;
  text-align: center;
  transition: background 0.15s, color 0.15s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
}
.sidebar-toggle:hover { background: var(--primary-soft); color: var(--primary); }

#view-calendar { position: relative; }

.sidebar-sub {
  font-size: 0.72rem; text-transform: uppercase; color: var(--text-muted);
  margin: 0.8rem 0 0.3rem; letter-spacing: 0.06em; font-weight: 600;
}
.sidebar-sub:first-child { margin-top: 0; }

.sidebar-btn-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.3rem;
}
.sidebar-btn-grid button { font-size: 0.8rem; padding: 0.5rem 0.4rem; text-align: center; }

#sidebar .sidebar-section { margin-bottom: 0.3rem; }
#sidebar .sidebar-section summary {
  font-size: 0.82rem; font-weight: 600; padding: 0.5rem 0.2rem;
  cursor: pointer; color: var(--text); list-style: none;
  display: flex; align-items: center; gap: 0.3rem;
}
#sidebar .sidebar-section summary::before {
  content: '▶'; font-size: 0.6rem; transition: transform 0.15s; flex-shrink: 0;
}
#sidebar .sidebar-section[open] summary::before { transform: rotate(90deg); }
#sidebar .sidebar-section summary::-webkit-details-marker { display: none; }
#sidebar button {
  width: 100%; padding: 0.65rem 0.8rem; margin-bottom: 0.4rem;
  background: var(--bg); border: 1px solid transparent; border-radius: var(--radius);
  cursor: pointer; font-size: 0.9rem; color: var(--text);
  text-align: left;
  transition: background var(--transition), border-color var(--transition), transform var(--transition);
  font-weight: 500;
}
#sidebar button:hover { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
#sidebar button.primary { background: var(--primary); color: white; border-color: var(--primary); }
#sidebar button.primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: white; }
.team-filter {
  display: flex; align-items: center; gap: 0.55rem;
  padding: 0.5rem 0.6rem; border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--transition);
}
.team-filter:hover { background: var(--bg); }
.team-filter .swatch {
  width: 14px; height: 14px; border-radius: 4px; flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.08);
}
.team-filter input { margin: 0; cursor: pointer; }
.author-filter {
  display: flex; align-items: center; gap: 0.55rem;
  padding: 0.45rem 0.6rem; border-radius: var(--radius);
  cursor: pointer; transition: background var(--transition);
}
.author-filter:hover { background: var(--bg); }
.author-filter input { margin: 0; cursor: pointer; }
.author-filter .avatar.avatar-sm {
  width: 22px; height: 22px; font-size: 0.65rem;
}
.author-filter.is-hidden {
  opacity: 0.58;
}
.event-author-row {
  display: flex; align-items: center; gap: 0.5rem;
  margin: 0.45rem 0 0.2rem;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background: var(--bg-soft);
  color: var(--text-muted);
  font-size: 0.88rem;
}
.event-author-row .avatar.avatar-sm {
  width: 24px; height: 24px; font-size: 0.68rem;
}
.team-shared-marker-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.35rem;
}
.team-edit-btn {
  background: transparent !important; border: none; padding: 0.15rem 0.35rem !important;
  cursor: pointer; opacity: 0.4; font-size: 0.85rem;
  width: auto !important; margin: 0 !important;
}
.team-filter:hover .team-edit-btn { opacity: 1; }
.cb-row { display: flex; align-items: center; gap: 0.5rem; padding: 0.4rem 0.5rem;
          font-size: 0.9rem; cursor: pointer; user-select: none; }
.cb-row input { margin: 0; }
#calendar-container { flex: 1;
                      position: relative; overflow: visible;
                      background: var(--card);
                      border-radius: var(--radius-lg);
                      padding: 1.2rem; box-shadow: var(--shadow); min-width: 0;
                      border: 1px solid var(--border-soft); }
.open-day-btn {
  width: 100%;
  margin: 0 0 0.9rem;
  padding: 0.8rem 0.95rem;
  border: 1px solid rgba(55,136,216,0.35);
  border-radius: var(--radius);
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-weight: 800;
  text-align: center;
}
.reminder-empty {
  display: block;
  margin: 0.2rem 0 0.45rem;
}

@media (max-width: 800px) {
  /* Auf Mobile: Kalender OBEN, Sidebar (Teams/Tags/Anzeigen/Aktionen) DARUNTER.
     order auf den Children, NICHT flex-direction:column-reverse (das brach FullCalendar). */
  #view-calendar.active { flex-direction: column; }
  #calendar-container { width: 100%; order: 1; min-height: 70vh; }
  #sidebar           { width: 100%; order: 2; }
  #calendar { min-height: 65vh; }   /* FullCalendar misst sonst 0 */
}

/* MOBILE EDGE-TO-EDGE KALENDER
   Rueckgaengig machen: diesen ganzen Block loeschen oder die Werte wieder
   auf main padding 0.55rem und #calendar-container padding 0.45rem setzen. */
@media (max-width: 640px) {
  main {
    padding-left: 0;
    padding-right: 0;
  }
  #calendar-container {
    padding-left: 0;
    padding-right: 0;
    border-left: 0;
    border-right: 0;
    border-radius: 0;
  }
  .calendar-toolbar-extra {
    padding-left: 0.55rem;
    padding-right: 0.55rem;
  }
  #sidebar {
    width: calc(100% - 1.1rem);
    margin-left: 0.55rem;
    margin-right: 0.55rem;
  }
}

/* ========== NOTIZEN ========== */
.notes-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 1rem;
}
#notes-list, #teams-list {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}
.note-card, .team-card {
  background: var(--card); border-radius: var(--radius);
  padding: 1rem; box-shadow: var(--shadow);
  border-left: 4px solid var(--primary);
  position: relative; cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
}
.note-card:hover, .team-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.1);
}
.note-card.pinned { background: #fffaeb; }
.note-card .pin { position: absolute; top: 0.5rem; right: 0.5rem; font-size: 1.1rem; }
.note-card h3, .team-card h3 { margin: 0 0 0.4rem 0; font-size: 1rem; }
.note-card .content { color: var(--text-muted); font-size: 0.9rem;
                      white-space: pre-wrap; max-height: 6em; overflow: hidden; }
.note-card .meta, .team-card .meta {
  display: flex; gap: 0.5rem; margin-top: 0.6rem;
  font-size: 0.75rem; color: var(--text-muted);
}
.note-card .attach-thumbs { display: flex; gap: 0.3rem; margin-top: 0.5rem; }
.note-card .attach-thumbs img { width: 50px; height: 50px; object-fit: cover; border-radius: 4px; }

/* ========== MODALS ========== */
.modal {
  display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15,23,42,0.55); z-index: 100;
  align-items: center; justify-content: center; padding: 1rem;
}
.modal.show { display: flex; }
.modal-box {
  background: var(--card); border-radius: var(--radius-lg);
  width: 100%; max-width: 560px; max-height: 90vh;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
}
.modal-box-small { max-width: 420px; }
.modal-box header {
  padding: 1rem 1.5rem; border-bottom: 1px solid var(--border-soft);
  display: flex; justify-content: space-between; align-items: center;
}
.modal-box header h2 { margin: 0; font-size: 1.15rem; font-weight: 600; }
.modal-box .close {
  background: none; border: none; font-size: 1.4rem; cursor: pointer;
  color: var(--text-muted); padding: 0;
  width: 2.2rem; height: 2.2rem; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--transition), color var(--transition);
}
.modal-box .close:hover { background: var(--bg); color: var(--text); }
.modal-body { padding: 1.4rem 1.5rem; overflow-y: auto; flex: 1; }
.holiday-detail { text-align: center; }
.holiday-icon { font-size: 2.4rem; line-height: 1; margin-bottom: 0.4rem; }
.holiday-detail h3 { margin: 0.2rem 0 0.25rem; font-size: 1.25rem; }
.holiday-date { margin: 0; color: var(--text-muted); font-weight: 600; }
.modal-box footer {
  padding: 0.9rem 1.5rem; border-top: 1px solid var(--border-soft);
  display: flex; gap: 0.5rem; justify-content: flex-end; flex-wrap: wrap;
  background: var(--bg-soft); border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  /* Sticky am Bottom der Modal-Box - Buttons IMMER sichtbar, auch wenn Body scrollt */
  position: sticky; bottom: 0; z-index: 2;
  box-shadow: 0 -4px 12px rgba(0,0,0,0.04);
}
.modal-box footer button { flex: 1 1 auto; min-width: max-content; }

/* Mobile: Modals nehmen mehr Platz, footer-Buttons groesser, Body bekommt extra Padding */
@media (max-width: 600px) {
  .modal {
    padding: 0;
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 22px);
    align-items: flex-end;
  }
  .modal-box {
    max-width: 100%;
    max-height: calc(92dvh - env(safe-area-inset-bottom, 0px) - 22px);
    border-radius: var(--radius-lg);
    width: 100%;
  }
  .modal-box footer {
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    padding: 0.7rem 0.9rem calc(0.9rem + env(safe-area-inset-bottom, 0px));
    gap: 0.4rem;
  }
  .modal-box footer button {
    flex: 1 1 calc(50% - 0.4rem);   /* zwei Buttons pro Zeile */
    padding: 0.85rem 0.6rem; font-size: 0.92rem; min-width: 0;
  }
  /* Wenn nur 1-2 Buttons: nicht stretchen */
  .modal-box footer:has(button:nth-child(-n+2):last-child) button { flex: 1 1 auto; }
  .modal-body { padding: 1rem 1.1rem 1.4rem; }
}

/* ========== FORM ========== */
label { display: block; margin: 0.9rem 0 0.35rem; font-size: 0.85rem;
        font-weight: 500; color: var(--text); }
input[type=text], input[type=email], input[type=password], input[type=datetime-local],
input[type=date], input[type=color], input[type=number], input[type=time],
textarea, select {
  width: 100%; padding: 0.65rem 0.85rem;
  border: 1.5px solid var(--border); border-radius: var(--radius);
  font-size: 0.95rem; font-family: inherit;
  background: var(--card); color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
input[type=color] { padding: 0.2rem; height: 2.5rem; cursor: pointer; }
.row { display: flex; gap: 0.8rem; }
.row > div { flex: 1; }
@media (max-width: 500px) { .row { flex-direction: column; } }

.note-pin-color {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.9rem;
}
.note-pin-row {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}
.note-color-native {
  max-width: 9rem;
}
.note-color-native label {
  margin-top: 0;
}
.note-color-native input[type=color] {
  width: 4.25rem;
  min-width: 4.25rem;
  padding: 0.15rem;
}

/* ========== BUTTONS ========== */
button {
  padding: 0.65rem 1.2rem; border: 1.5px solid var(--border);
  border-radius: var(--radius); background: var(--card); cursor: pointer;
  font-size: 0.95rem; font-weight: 500; color: var(--text);
  font-family: inherit;
  transition: background 180ms ease, border-color 180ms ease,
              transform 140ms cubic-bezier(.2,.8,.2,1),
              box-shadow 180ms ease, color 180ms ease;
}
button:hover { background: var(--bg); border-color: var(--text-muted); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
button:active { transform: translateY(1px) scale(0.98); box-shadow: none; }
button:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--primary-soft), var(--shadow-sm); }
button:disabled, button[aria-disabled="true"] {
  cursor: not-allowed; opacity: 0.55; transform: none !important;
  box-shadow: none !important; filter: grayscale(0.15);
}
button.primary {
  background: linear-gradient(135deg, var(--primary), #4f9dea);
  color: white; border-color: transparent;
  box-shadow: 0 4px 12px rgba(55,136,216,0.22);
}
button.primary:hover {
  background: linear-gradient(135deg, var(--primary-dark), #3f8edf);
  border-color: transparent; color: white;
  box-shadow: 0 8px 18px rgba(55,136,216,0.34);
  transform: translateY(-2px);
}
button.danger {
  background: linear-gradient(135deg, var(--danger), #ef4444);
  color: white; border-color: transparent;
}
button.danger:hover {
  background: linear-gradient(135deg, #b91c1c, #dc2626);
  border-color: transparent; color: white;
  box-shadow: 0 7px 16px rgba(220,38,38,0.3);
  transform: translateY(-2px);
}
.button-busy {
  pointer-events: none; color: transparent !important; position: relative;
}
.button-busy::before {
  content: ""; position: absolute; inset: 50% auto auto 50%;
  width: 1.05em; height: 1.05em; margin: -0.525em 0 0 -0.525em;
  border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; color: white;
}
.btn-mini { padding: 0.4rem 0.8rem; font-size: 0.85rem; cursor: pointer;
            border: 1px solid var(--border); border-radius: var(--radius-sm);
            background: var(--card); display: inline-flex; align-items: center; gap: 0.3rem;
            transition: background var(--transition), border-color var(--transition),
                        transform 120ms ease, box-shadow var(--transition); }
.btn-mini:hover { background: var(--bg); border-color: var(--text-muted); transform: translateY(-1px); box-shadow: var(--shadow-sm); }

@media (prefers-reduced-motion: reduce) {
  button, .btn-mini { transition: background var(--transition), border-color var(--transition), color var(--transition) !important; }
  button:hover, .btn-mini:hover, button:active { transform: none !important; }
}

/* ========== ATTACHMENTS ========== */
.attach-buttons { display: flex; gap: 0.5rem; margin-top: 0.5rem; align-items: center;
                  flex-wrap: wrap; }
#ev-attachments, #note-attachments { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.attach-item {
  display: flex; align-items: center; gap: 0.4rem;
  padding: 0.3rem 0.5rem 0.3rem 0.3rem;
  background: rgba(0,0,0,0.04); border-radius: 6px;
  font-size: 0.85rem;
}
.attach-item img { width: 40px; height: 40px; object-fit: cover; border-radius: 4px; }
.attach-item audio { max-width: 200px; height: 30px; }
.attach-item .remove { background: none; border: none; cursor: pointer;
                       color: var(--danger); padding: 0.2rem 0.4rem; }

/* ========== TOAST ========== */
#toast {
  position: fixed; bottom: 2rem; left: 50%; transform: translateX(-50%) translateY(20px);
  background: #1e293b; color: white; padding: 0.85rem 1.4rem;
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none;
  transition: opacity 200ms ease, transform 200ms ease;
  z-index: 200; max-width: 90vw; font-size: 0.92rem; font-weight: 500;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.error { background: var(--danger); }
#toast.success { background: var(--success); }

/* ========== TEAMS ========== */
.team-card .members { display: flex; gap: 0.3rem; margin-top: 0.5rem; flex-wrap: wrap; }
.team-card .member-chip {
  background: rgba(0,0,0,0.06); padding: 0.15rem 0.5rem;
  border-radius: 12px; font-size: 0.75rem;
}
.member-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.6rem 0.4rem; border-bottom: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
}
.member-row:last-child { border-bottom: none; }
.member-row:hover { background: var(--bg-soft); }

/* FullCalendar-Polish */
.fc .fc-button {
  background: var(--card) !important; color: var(--text) !important;
  border: 1.5px solid var(--border) !important;
  border-radius: var(--radius) !important;
  font-weight: 500 !important;
  padding: 0.45rem 0.9rem !important;
  text-transform: capitalize !important;
  box-shadow: none !important;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}
.fc .fc-button:hover { background: var(--primary-soft) !important; border-color: var(--primary) !important; color: var(--primary) !important; }
.fc .fc-button-active, .fc .fc-button-primary:not(:disabled).fc-button-active,
.fc .fc-button-primary:not(:disabled):active {
  background: var(--primary) !important; color: white !important;
  border-color: var(--primary) !important;
  box-shadow: var(--shadow-sm) !important;
}
.fc .fc-toolbar-title { font-size: 1.35rem !important; font-weight: 600 !important; letter-spacing: -0.01em; }
.fc-event {
  position: relative;
  overflow: hidden;
  border-radius: 7px !important; padding: 2px 7px !important; font-weight: 600;
  border: 1px solid rgba(0,0,0,0.1) !important;
  background-image: none !important;
  box-shadow: none;
  text-shadow: none;
  transition: filter 100ms ease, border-color 100ms ease;
  font-size: var(--event-font-size) !important;
}
.fc-event .fc-event-title,
.fc-event .fc-event-time,
.fc-list-event .fc-list-event-title {
  font-size: var(--event-font-size) !important;
}
/* Uhrzeit bei terminierten Events im Kalender ausblenden (Listenansicht behaelt sie) */
.fc-daygrid-event .fc-event-time,
.fc-timegrid-event .fc-event-time { display: none !important; }
/* Mindesthoehe fuer Events: bei kleiner Schriftgroesse (z.B. 7px) wuerden
   mehrtaegige Fortsetzungen sonst zu einem nicht erkennbaren Streifen schrumpfen. */
.fc .fc-daygrid-event,
.fc .fc-h-event { min-height: 1.4rem !important; }
.fc .fc-h-event .fc-event-main,
.fc .fc-h-event .fc-event-title-container,
.fc .fc-h-event .fc-event-title {
  display: flex;
  align-items: center;
  min-height: 1.2rem;
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Auf Folge-Tagen einer Mehrtages-Episode wird der Titel via JS injiziert (eventDidMount). */
.fc .fc-h-event .fc-continued-title {
  display: inline-block;
  padding: 0 0.45rem;
  opacity: 0.85;
  font-style: italic;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
  line-height: 1.2;
}
/* Harness und Event-Container ebenfalls Mindesthoehe geben, sonst kollabiert die Fortsetzung */
.fc .fc-daygrid-event-harness { min-height: 1.4rem; }
.fc-event .fc-event-main,
.fc-event .fc-event-title,
.fc-event .fc-event-title-container {
  position: relative;
  z-index: 1;
}
.fc-event:hover {
  filter: brightness(0.97);
  box-shadow: none !important;
}
.fc .fc-daygrid-event-harness {
  z-index: 6;
  /* KEIN position-Override — FC setzt selbst absolute fuer Mehrtages-Balken,
     sonst werden die auf 1 Tag eingeschnuert. */
}
.fc .fc-h-event:not(.fc-event-start) {
  border-top-left-radius: 0 !important;
  border-bottom-left-radius: 0 !important;
}
.fc .fc-h-event:not(.fc-event-end) {
  border-top-right-radius: 0 !important;
  border-bottom-right-radius: 0 !important;
}
.fc-event.event-shared {
  position: relative;
  overflow: hidden;
}
.fc-event.event-shared-stripe {
  box-shadow: inset 3px 0 0 var(--shared-origin-color, #0ea5e9), 0 1px 4px rgba(15,23,42,0.12) !important;
}
.fc-event.event-shared-badge .fc-event-title::before,
.fc-list-event.event-shared-badge .fc-list-event-title a::before {
  content: "↔";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25em;
  height: 1.25em;
  margin-right: 0.22em;
  border-radius: 999px;
  background: rgba(255,255,255,0.78);
  color: var(--shared-origin-color, #0f172a);
  font-weight: 800;
  line-height: 1;
}
.fc-event.event-shared-pattern {
  background-image:
    repeating-linear-gradient(135deg, rgba(255,255,255,0.22) 0 3px, rgba(255,255,255,0) 3px 7px) !important;
  background-blend-mode: soft-light;
}
.fc-event.event-shared-origin-color {
  outline: 1px solid var(--shared-origin-color, currentColor);
  outline-offset: -1px;
}
.fc-list-event.event-shared-stripe td:first-child {
  box-shadow: inset 3px 0 0 var(--shared-origin-color, #0ea5e9);
}
.fc-event.event-birthday {
  background-image: none !important;
  box-shadow: none !important;
  position: relative;
  padding-right: 2.1rem !important;
}
.fc-event.event-birthday .fc-event-title,
.fc-event.event-birthday .fc-list-event-title {
  font-weight: 700;
}
.fc-event.event-birthday::after {
  content: "🥳";
  position: absolute;
  right: 0.45rem;
  top: 50%;
  font-size: 0.95rem;
  transform: translateY(-50%);
  pointer-events: none;
}
.fc-event.event-holiday {
  cursor: pointer;
}
.fc-event.event-holiday .fc-event-title,
.fc-event.event-holiday .fc-list-event-title {
  font-weight: 700;
}
/* Monats-Tageskacheln */
.fc .fc-daygrid-day {
  background: transparent !important;
}
.fc .fc-daygrid-day-frame {
  position: relative;
  margin: 3px;
  border-radius: 10px;
  background: var(--card) !important;
  border: 1px solid var(--border-soft);
  box-shadow: none;
  overflow: visible;
}
.fc .fc-daygrid-day.fc-day-other .fc-daygrid-day-frame {
  background:
    repeating-linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.92) 0,
      rgba(255, 255, 255, 0.92) 10px,
      rgba(226, 232, 240, 0.72) 10px,
      rgba(226, 232, 240, 0.72) 20px
    ) !important;
  border-color: rgba(203, 213, 225, 0.72);
}
.fc .fc-daygrid-day.fc-day-other .fc-daygrid-day-number {
  opacity: 0.58;
  color: #94a3b8;
}

/* Finale Fremdmonat-Optik: muss spaeter als Theme-Regeln gewinnen. */
body .fc .fc-daygrid-day.fc-day-other .fc-daygrid-day-frame,
body[data-bg] .fc .fc-daygrid-day.fc-day-other .fc-daygrid-day-frame,
body[data-bg="kein"] .fc .fc-daygrid-day.fc-day-other .fc-daygrid-day-frame {
  background:
    repeating-linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.94) 0,
      rgba(255, 255, 255, 0.94) 8px,
      rgba(148, 163, 184, 0.24) 8px,
      rgba(148, 163, 184, 0.24) 16px
    ) !important;
  border-color: rgba(148, 163, 184, 0.34) !important;
}

body[data-bg="sterne"] .fc .fc-daygrid-day.fc-day-other .fc-daygrid-day-frame {
  background:
    repeating-linear-gradient(
      135deg,
      rgba(15, 23, 42, 0.34) 0,
      rgba(15, 23, 42, 0.34) 8px,
      rgba(148, 163, 184, 0.20) 8px,
      rgba(148, 163, 184, 0.20) 16px
    ) !important;
}
.fc .fc-daygrid-day:hover .fc-daygrid-day-frame {
  background: var(--bg-soft) !important;
  border-color: var(--border);
}
/* Heute-Hervorhebung deutlich: Akzent-Streifen oben + Hintergrund + dicke Tageszahl */
.fc-day-today {
  background: transparent !important;
  position: relative;
}
.fc-day-today .fc-daygrid-day-frame {
  background: linear-gradient(180deg, rgba(55,136,216,0.12), var(--card)) !important;
  border-color: rgba(55,136,216,0.28);
  box-shadow: inset 0 3px 0 var(--primary);
}
.fc-day-today .fc-daygrid-day-number {
  color: white !important; font-weight: 700;
  background: var(--primary); border-radius: 50%;
  width: 1.8rem; height: 1.8rem;
  display: inline-flex !important; align-items: center; justify-content: center;
  margin: 0.25rem; box-shadow: 0 1px 3px rgba(55,136,216,0.4);
}
/* Auch in Time-Grid Views (Woche/Tag) den heutigen Spaltenkopf farbig */
.fc-timegrid .fc-day-today .fc-col-header-cell-cushion,
.fc .fc-day-today.fc-col-header-cell {
  color: var(--primary) !important; font-weight: 700;
}
/* Tag-Zellen weicher */
.fc .fc-daygrid-day-frame { transition: background var(--transition), border-color var(--transition), box-shadow var(--transition); }
.fc th { font-weight: 600 !important; color: var(--text-muted); font-size: 0.85rem; padding: 0.6rem 0 !important; }
.fc-scrollgrid {
  background: var(--card) !important;
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.fc-scrollgrid, .fc-scrollgrid td, .fc-scrollgrid th {
  border-color: var(--border-soft) !important;
}
.fc .fc-col-header-cell {
  background: var(--bg-soft) !important;
}
.short-month-notice {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  min-height: 2.4rem;
  padding: 0.45rem 0.75rem;
  margin: 0 0 0.5rem;
  background: color-mix(in srgb, var(--primary) 9%, var(--card));
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 600;
  border-top: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-soft);
}
.short-month-notice-text {
  min-width: 0;
}
.short-month-toggle {
  border: 1px solid var(--primary);
  border-radius: 6px;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.1;
  padding: 0.42rem 0.68rem;
  white-space: nowrap;
}
.short-month-toggle:hover {
  filter: brightness(0.96);
}
/* Kalenderwochen-Spalte: eigene Optik, klare Trennung vom Wochentag-Header */
.fc .fc-day-grid-week-number,
.fc .fc-week-number,
.fc-daygrid-week-number {
  background: var(--bg-soft) !important;
  color: var(--text-muted) !important;
  font-size: calc(0.8rem - 2px) !important; font-weight: 600 !important;
  padding: 0.4rem 0.6rem !important;
  border-right: 1.5px solid var(--border) !important;
  text-align: center !important;
  min-width: 2.6rem;
}
/* Header-Cell der KW-Spalte nicht beschriften: "KW" kollidiert auf Mobile mit "Mo". */
.fc .fc-col-header-cell.fc-day .fc-col-header-cell-cushion { padding: 0.6rem 0.3rem; }
.fc-theme-standard th.fc-col-header-cell:first-child::before {
  content: none;
}
.member-row .role { color: var(--text-muted); font-size: 0.8rem; }

/* ========== WIEDERHOLUNG / WOCHENTAGE ========== */
.weekday-buttons {
  display: flex; gap: 0.3rem; flex-wrap: wrap; margin-top: 0.3rem;
}
.weekday-buttons button {
  flex: 1; min-width: 38px; padding: 0.4rem 0.2rem;
  border: 1px solid var(--border); border-radius: 6px;
  background: var(--card); color: var(--text); cursor: pointer;
  font-size: 0.85rem; font-weight: 500;
}
.weekday-buttons button.active {
  background: var(--primary); color: white; border-color: var(--primary);
}

/* ========== REMINDER-CHIPS ========== */
#ev-reminders { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-bottom: 0.4rem; min-height: 1.5rem; }
.reminder-chip {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.2rem 0.5rem; background: rgba(55,136,216,0.1);
  border: 1px solid rgba(55,136,216,0.3); border-radius: 12px;
  font-size: 0.8rem; color: var(--primary);
}
.reminder-chip .remove {
  background: none; border: none; color: var(--primary);
  cursor: pointer; padding: 0; font-size: 1rem; line-height: 1;
}
select.small { padding: 0.4rem 0.6rem; font-size: 0.85rem; }

/* ========== SETTINGS-SECTIONS ========== */
.settings-section {
  padding: 0.8rem; background: rgba(0,0,0,0.02);
  border-radius: 6px; border: 1px solid var(--border);
}
.settings-section h4 { font-size: 0.95rem; }

/* ========== SETTINGS TABS REDESIGN ========== */
.modal-box-settings { max-width: 640px; }
.modal-box-settings .modal-body.settings-body { padding: 0; }

.settings-tabs {
  display: flex; gap: 0; border-bottom: 2px solid var(--border);
  padding: 0 1rem; overflow-x: auto; -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.settings-tabs::-webkit-scrollbar { display: none; }
.settings-tab {
  flex-shrink: 0; padding: 0.6rem 0.9rem; border: none; background: none;
  font-size: 0.82rem; color: var(--text-muted); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s; white-space: nowrap;
}
.settings-tab:hover { color: var(--text); }
.settings-tab.active {
  color: var(--primary, #3b82f6); border-bottom-color: var(--primary, #3b82f6);
  font-weight: 600;
}

.settings-pane { display: none; padding: 1rem; }
.settings-pane.active { display: block; }

.settings-card {
  background: rgba(0,0,0,0.02); border: 1px solid var(--border);
  border-radius: 8px; padding: 1rem; margin-bottom: 0.8rem;
}
.settings-card:last-child { margin-bottom: 0; }
.settings-card-title {
  font-size: 0.95rem; font-weight: 600; margin: 0 0 0.7rem;
  padding-bottom: 0.4rem; border-bottom: 1px solid var(--border);
}
.settings-card-danger { border-color: #dc354560; }

.settings-field { margin-bottom: 0.5rem; }
.settings-field label {
  display: block; font-size: 0.82rem; margin-bottom: 0.15rem;
  color: var(--text-muted); font-weight: 500;
}
.settings-field input,
.settings-field select,
.settings-field textarea { width: 100%; }

.settings-row { display: flex; gap: 0.8rem; }
.settings-row > * { flex: 1; }
.settings-btn-row { display: flex; gap: 0.4rem; flex-wrap: wrap; }

.plugin-manager { display: grid; gap: 1rem; }
.plugin-category h3 {
  margin: 0 0 0.45rem;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.plugin-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.55rem; }
.plugin-card {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  min-height: 74px;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  cursor: pointer;
}
.plugin-card:hover { border-color: rgba(55,136,216,0.45); }
.plugin-card input { margin-top: 0.18rem; flex: 0 0 auto; }
.plugin-card-main { display: grid; gap: 0.2rem; }
.plugin-card-title { font-weight: 700; color: var(--text); }
.plugin-card-desc { font-size: 0.82rem; color: var(--text-muted); line-height: 1.35; }
.plugin-lock {
  display: inline-block;
  margin-left: 0.25rem;
  padding: 0.05rem 0.35rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--primary-dark);
  background: var(--primary-soft);
}
.plugin-card-locked { cursor: default; opacity: 0.78; }
.feature-disabled { display: none !important; }

@media (max-width: 500px) {
  .settings-tabs { padding: 0 0.4rem; }
  .settings-tab { padding: 0.5rem 0.55rem; font-size: 0.75rem; }
  .settings-pane { padding: 0.7rem; }
  .settings-row { flex-direction: column; gap: 0; }
  .plugin-grid { grid-template-columns: 1fr; }
}

[data-theme="dark"] .settings-card { background: rgba(255,255,255,0.04); }

/* ========== SIDEBAR-SECTIONS (Ausklappfenster) ========== */
.sidebar-section {
  margin-top: 1rem;
  padding: 0.35rem;
  border-radius: var(--radius-lg);
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  box-shadow: none;
  overflow: hidden;
}
.sidebar-section:first-of-type { margin-top: 0.6rem; }
.sidebar-section > summary {
  list-style: none; cursor: pointer; user-select: none;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.5rem 0.6rem; border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--border-soft);
  transition: background var(--transition), border-color var(--transition), box-shadow var(--transition);
}
.sidebar-section > summary::-webkit-details-marker { display: none; }
.sidebar-section > summary:hover {
  background: var(--bg);
  border-color: var(--border);
  box-shadow: none;
}
.sidebar-section > summary > h3 {
  margin: 0 !important; padding: 0; font-size: 0.78rem;
  text-transform: uppercase; color: var(--text-muted);
  font-weight: 600; letter-spacing: 0.08em;
}
.sidebar-section > summary::after {
  content: "▸"; color: var(--text-muted); font-size: 0.8rem;
  transition: transform var(--transition);
}
.sidebar-section[open] > summary::after { transform: rotate(90deg); }
.sidebar-section[open] > summary > h3 { color: var(--primary); }
/* Inhalt mit etwas Padding/Top-Abstand zum Summary */
.sidebar-section > *:not(summary) { margin-top: 0.45rem; }
.sidebar-section .cb-row {
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--border-soft);
  margin-top: 0.35rem;
  box-shadow: none;
  transition: background var(--transition), border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}
.sidebar-section .cb-row:hover {
  background: var(--bg);
  border-color: var(--border);
  box-shadow: none;
  transform: translateY(-1px);
}
#sidebar .sidebar-section button {
  background: var(--card);
  border-color: var(--border-soft);
  box-shadow: none;
}
#sidebar .sidebar-section button:hover {
  background: var(--bg);
  border-color: var(--primary);
  color: var(--primary);
}
#sidebar .sidebar-section button.primary {
  background: linear-gradient(135deg, var(--primary), #4f9dea);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 8px 20px rgba(55,136,216,0.26);
}
#sidebar .sidebar-section button.primary:hover {
  background: linear-gradient(135deg, var(--primary-dark), #3f8edf);
  color: #fff;
}

/* ========== MULTI-TEAM-SHARING ========== */
.shared-team-list {
  margin-top: 0.5rem;
  padding: 0.5rem;
  background: var(--bg-soft);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-soft);
}
details > summary { outline: none; }
details[open] > summary { color: var(--primary); }

/* ========== ACTIVITY-FEED ========== */
.activity-row {
  padding: 0.6rem 0.8rem; margin-bottom: 0.4rem;
  background: var(--bg-soft); border-radius: var(--radius);
  border-left: 3px solid var(--primary);
}
.activity-label { font-weight: 600; font-size: 0.88rem; color: var(--text); }
.activity-summary { font-size: 0.92rem; color: var(--text); margin-top: 0.15rem; }
.activity-meta { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.25rem; }

/* ========== ANHANG-TAGS + DOC-LINKS ========== */
.attach-tag {
  display: inline-block; margin-left: 0.4rem;
  font-size: 0.72rem; padding: 0.1rem 0.45rem;
  background: rgba(245,158,11,0.15); color: #b45309;
  border-radius: 10px; border: 1px solid rgba(245,158,11,0.35);
}
.attach-doc-link {
  text-decoration: none !important; color: var(--primary);
  background: var(--primary-soft); padding: 0.3rem 0.65rem;
  border-radius: var(--radius-sm); display: inline-block;
}
.attach-doc-link:hover { background: var(--primary); color: white; }
.attach-search-row {
  display: flex; align-items: flex-start; gap: 0.6rem;
  padding: 0.7rem 0.4rem; border-bottom: 1px solid var(--border-soft);
}

/* ========== TODOLISTEN ========== */
.todo-list-card {
  background: var(--bg-soft); border-radius: var(--radius);
  padding: 0.9rem; margin-bottom: 0.9rem;
  border: 1px solid var(--border-soft);
}
.todo-list-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; }
.todo-items { display: flex; flex-direction: column; gap: 0.25rem; }
.todo-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.45rem 0.55rem; border-radius: var(--radius-sm);
  background: var(--card); border: 1px solid var(--border-soft);
}
.todo-item label { display: flex; align-items: center; gap: 0.5rem; flex: 1; cursor: pointer; margin: 0; }
.todo-item.done span { text-decoration: line-through; color: var(--text-muted); }
.todo-add-row { display: flex; gap: 0.4rem; margin-top: 0.55rem; }
.todo-add-row input { flex: 1; }

/* ========== LINK-BUTTONS in Notizen / Termin-Beschreibung ========== */
.text-link-btn {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.25rem 0.7rem;
  background: var(--primary-soft); color: var(--primary);
  border: 1px solid rgba(55,136,216,0.3); border-radius: var(--radius-sm);
  text-decoration: none !important; font-size: 0.85rem; font-weight: 500;
  margin: 0.15rem 0.2rem 0.15rem 0;
  transition: background var(--transition), transform 100ms ease;
  word-break: break-all;
}
.text-link-btn:hover { background: var(--primary); color: white; transform: translateY(-1px); }
.text-link-btn:active { transform: translateY(0); }

/* ========== VIEW-SWITCHER (Dropdown ueber Kalender) ========== */
.calendar-toolbar-extra {
  display: flex; justify-content: space-between; gap: 0.6rem; align-items: center;
  margin-bottom: 0.6rem;
  flex-wrap: nowrap;
}
.toolbar-btn-row {
  display: flex; gap: 0.5rem; align-items: center; flex-wrap: nowrap;
  flex: 0 0 auto;
}

/* Hover-Menü statt Dropdown für View-Wechsel */
.view-switcher-hover { position: relative; display: inline-block; }
.btn-view-switcher {
  padding: 0.3rem 0.7rem; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--card); cursor: pointer; font-size: 0.82rem; color: var(--text);
  white-space: nowrap;
}
.btn-view-switcher:hover { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.view-switcher-menu {
  display: none;
  position: absolute; top: 100%; right: 0; margin-top: 4px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 6px 20px rgba(0,0,0,0.15);
  min-width: 180px; z-index: 200;
  padding: 0.3rem;
}
.view-switcher-hover:hover .view-switcher-menu,
.view-switcher-hover.open .view-switcher-menu { display: block; }
.view-switcher-menu button {
  display: block; width: 100%; text-align: left;
  padding: 0.5rem 0.7rem; background: transparent; border: none;
  cursor: pointer; font-size: 0.88rem; color: var(--text); border-radius: 4px;
}
.view-switcher-menu button:hover { background: var(--primary-soft); color: var(--primary); }
.view-switcher-menu button.active { background: var(--primary); color: #fff; }
.back-to-month-btn {
  display: none;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  padding: 0.5rem 0.75rem;
  border: 1px solid rgba(55,136,216,0.35);
  border-radius: var(--radius);
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-weight: 800;
  white-space: nowrap;
}
#calendar-search {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0.5rem 0.8rem;
  font-size: 0.92rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
}
#view-switcher {
  width: auto; min-width: 140px; padding: 0.5rem 0.8rem;
  font-size: 0.92rem; font-weight: 500;
  border: 1.5px solid var(--border); border-radius: var(--radius);
  background: var(--card); cursor: pointer;
}
@media (max-width: 600px) {
  .calendar-toolbar-extra { flex-direction: row; align-items: center; }
  .back-to-month-btn { width: 100%; }
  #calendar-search { width: auto; min-width: 0; }
  #view-switcher { width: 100%; min-width: 0; }
  .toolbar-btn-row { width: auto; flex: 0 0 auto; }
  .toolbar-btn-row .btn-scan,
  .toolbar-btn-row .btn-adaptive { flex: 1; }
  .btn-view-switcher {
    max-width: 8.2rem;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

/* ========== AVATARE ========== */
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; flex-shrink: 0;
  background-size: cover; background-position: center;
  background-color: var(--primary, #3788d8);
  color: white; font-weight: 600; user-select: none;
  text-transform: uppercase;
}
.avatar.avatar-sm { width: 28px; height: 28px; font-size: 0.75rem; }
.avatar.avatar-md { width: 40px; height: 40px; font-size: 0.95rem; }
.avatar.avatar-lg { width: 72px; height: 72px; font-size: 1.6rem; }
.profile-avatar-row {
  display: flex; align-items: center; gap: 1rem; margin-bottom: 0.8rem;
}
.team-member-row {
  display: flex; align-items: center; gap: 0.6rem; padding: 0.3rem 0;
}

/* ========== SUBSCRIBE QR ========== */
.subscribe-qr {
  margin: 0.6rem 0 1rem;
  text-align: center;
}
.subscribe-qr img {
  max-width: 200px; height: auto;
  border: 1px solid var(--border, #e0e0e0);
  border-radius: 6px;
  background: white; padding: 6px;
}
.subscribe-team-row { margin-bottom: 1.2rem; }

/* ========== QUICK-INPUT ========== */
.quick-input-row {
  display: flex; gap: 0.3rem; margin-bottom: 0.3rem;
}
.quick-input-row input {
  flex: 1 1 auto; min-width: 0;   /* min-width:0 erlaubt Schrumpfen statt Default-200px */
  padding: 0.45rem 0.6rem; font-size: 0.85rem;
}
/* Override fuer #sidebar button{width:100%} - hoehere Spezifitaet noetig (#id schlaegt .class) */
#sidebar .quick-input-row button {
  flex: 0 0 auto; width: auto;
  margin-bottom: 0;
  padding: 0.45rem 0.8rem;
  text-align: center;
  min-width: 2.5rem;
}
/* Auf schmalen Bildschirmen: Eingabe gross, Button klein bleibt */
@media (max-width: 800px) {
  .quick-input-row { gap: 0.5rem; }
  .quick-input-row input { font-size: 1rem; padding: 0.6rem 0.7rem; }
}
.hint {
  color: var(--text-muted); font-size: 0.75rem;
  margin: 0.2rem 0 0.5rem; line-height: 1.4;
}

/* ========== TAGS ========== */
.tag-chip {
  display: inline-flex; align-items: center; gap: 0.25rem;
  padding: 0.15rem 0.5rem; background: rgba(111,66,193,0.1);
  border: 1px solid rgba(111,66,193,0.3); border-radius: 12px;
  font-size: 0.78rem; color: #6f42c1; cursor: pointer; user-select: none;
  margin-right: 0.25rem; margin-bottom: 0.25rem;
}
.tag-chip.active {
  background: #6f42c1; color: white; border-color: #6f42c1;
}
.tag-chip .remove {
  background: none; border: none; color: inherit;
  cursor: pointer; padding: 0; margin-left: 0.2rem; font-size: 1rem; line-height: 1;
}
#ev-tags-list, #note-tags-list { min-height: 1.5rem; margin-bottom: 0.4rem; }
.note-tags-compact {
  margin-top: 1.05rem;
}
.note-tags-compact h4 {
  margin: 0 0 0.55rem;
}
.note-tags-line {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}
.note-tags-line #note-tags-list {
  flex: 0 1 auto;
  min-width: 0;
  min-height: 0;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  overflow-x: auto;
  white-space: nowrap;
}
.note-tags-line .tag-chip {
  margin: 0;
  flex: 0 0 auto;
}
.note-tags-line #note-tag-input {
  flex: 1 1 11rem;
  min-width: 8rem;
}
.note-tags-line #note-tag-add {
  flex: 0 0 auto;
  min-width: 2.5rem;
}
#tag-filters, #author-filters { max-height: 200px; overflow-y: auto; }

/* ========== KONFLIKT-WARNUNG ========== */
.conflict-warning {
  background: #fff3cd; border: 1px solid #ffc107;
  border-radius: 6px; padding: 0.75rem; margin-top: 1rem;
  color: #856404;
}
.conflict-warning .conflict-item {
  font-size: 0.85rem; margin-top: 0.25rem;
}

/* ========== HOVER-QUICKVIEW ========== */
.hover-quickview {
  position: absolute; z-index: 100;
  background: #2d3748; color: white;
  padding: 0.5rem 0.75rem; border-radius: 6px;
  font-size: 0.85rem; max-width: 280px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  pointer-events: none; opacity: 0;
  transition: opacity 0.15s; line-height: 1.4;
}
.hover-quickview.show { opacity: 1; }
.hover-quickview .qv-title { font-weight: 600; margin-bottom: 0.15rem; }
.hover-quickview .qv-meta { color: #cbd5e0; font-size: 0.75rem; }

/* ========== WETTER-LEISTE ========== */
.weather-strip {
  display: flex; gap: 0.5rem; padding: 0.5rem;
  background: linear-gradient(90deg, #74b9ff 0%, #a29bfe 100%);
  color: white; border-radius: 6px; margin-bottom: 0.5rem;
  overflow-x: auto; font-size: 0.85rem;
}
.weather-day {
  flex: 1; min-width: 70px; text-align: center;
}
.weather-day .w-emoji { font-size: 1.5rem; }
.weather-day .w-temp { font-weight: 600; }
.weather-day .w-rain { font-size: 0.7rem; opacity: 0.8; }

/* ========== SCHULFERIEN: Tageszellen leicht grau hinterlegen ========== */
.fc .fc-daygrid-day.is-school-holiday .fc-daygrid-day-frame {
  background: rgba(15, 23, 42, 0.06) !important;
}
/* Toggle aus -> Klassen liegen vielleicht noch im DOM, aber Effekt aufheben */
body.school-holidays-off .fc-daygrid-day.is-school-holiday .fc-daygrid-day-frame {
  background: transparent !important;
}

/* ========== MONDPHASEN-OVERLAY (in Kalender-Tageszelle) ========== */
body.moonphases-off .moon-phase { display: none !important; }
.fc-daygrid-day-frame .moon-phase {
  position: absolute; bottom: 2px; left: 2px;
  font-size: 0.85rem; opacity: 0.7;
}
.fc-daygrid-day-frame .moon-phase.moon-new,
.fc-daygrid-day-frame .moon-phase.moon-full {
  display: inline-flex; align-items: center; gap: 0.15rem;
  max-width: calc(100% - 6px);
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  opacity: 1;
  box-shadow: 0 1px 5px rgba(15,23,42,0.18);
  z-index: 2;
}
.fc-daygrid-day-frame .moon-phase.moon-new {
  background-color: #111827;
  color: #f8fafc;
}
.fc-daygrid-day-frame .moon-phase.moon-full {
  background-color: #fff7cc;
  color: #7c4a03;
  border: 1px solid rgba(245,158,11,0.45);
}

/* ========== HINTERGRUND-THEMES ==========
   data-bg am <body> -> auswaehlbarer dekorativer Hintergrund.
   Ohne data-bg bleibt der bisherige --app-bg-Verlauf aktiv. */
/* Default-Wash: ueber jedes Hintergrund-Motiv kommt eine semi-transparente Schicht,
   damit die Optik blasser wird und Kalender-Inhalte besser lesbar sind.
   Wert kann pro Theme via --bg-fade ueberschrieben werden. */
body[data-bg] { --bg-fade: 0.45; }
body[data-bg="aquarell"] {
  background:
    linear-gradient(rgba(255,255,255,var(--bg-fade)), rgba(255,255,255,var(--bg-fade))) fixed,
    linear-gradient(135deg, #fde2e4 0%, #cfe1f2 45%, #d8d3ff 100%) fixed !important;
}
body[data-bg="sonnenaufgang"] {
  background:
    linear-gradient(rgba(255,255,255,var(--bg-fade)), rgba(255,255,255,var(--bg-fade))) fixed,
    linear-gradient(180deg, #ffd8a8 0%, #ffafbd 50%, #c08aff 100%) fixed !important;
}
body[data-bg="bergsee"] {
  background:
    linear-gradient(rgba(255,255,255,var(--bg-fade)), rgba(255,255,255,var(--bg-fade))) fixed,
    linear-gradient(180deg, #a1c4fd 0%, #c2e9fb 60%, #d4fc79 100%) fixed !important;
}
/* Dunkles Theme: kein Weiss-Wash, dafuer leichte Aufhellung */
body[data-bg="sterne"] { --bg-fade: 0.10; }
body[data-bg="sterne"] {
  background:
    linear-gradient(rgba(255,255,255,var(--bg-fade)), rgba(255,255,255,var(--bg-fade))) fixed,
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='400' height='400' viewBox='0 0 400 400'><g fill='%23ffffff' opacity='0.85'><circle cx='30' cy='40' r='1.2'/><circle cx='90' cy='150' r='0.9'/><circle cx='160' cy='80' r='1.6'/><circle cx='210' cy='220' r='1'/><circle cx='280' cy='60' r='1.3'/><circle cx='340' cy='180' r='1'/><circle cx='60' cy='280' r='1.4'/><circle cx='150' cy='340' r='0.9'/><circle cx='250' cy='310' r='1.2'/><circle cx='370' cy='340' r='1.5'/><circle cx='200' cy='30' r='0.8'/><circle cx='110' cy='200' r='0.7'/><circle cx='320' cy='260' r='0.8'/></g></svg>") fixed,
    radial-gradient(ellipse at 30% 20%, #1e3a8a 0%, #0c1738 60%, #050816 100%) fixed !important;
}
body[data-bg="wiese"] {
  background:
    linear-gradient(rgba(255,255,255,var(--bg-fade)), rgba(255,255,255,var(--bg-fade))) fixed,
    linear-gradient(180deg, #fef3c7 0%, #d9f99d 60%, #86efac 100%) fixed !important;
}
body[data-bg="konfetti"] { --bg-fade: 0.30; }
body[data-bg="konfetti"] {
  background:
    linear-gradient(rgba(255,255,255,var(--bg-fade)), rgba(255,255,255,var(--bg-fade))) fixed,
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180' viewBox='0 0 180 180'><circle cx='20' cy='30' r='3' fill='%23ec4899'/><circle cx='80' cy='15' r='2.5' fill='%2322d3ee'/><circle cx='140' cy='40' r='3.5' fill='%23facc15'/><circle cx='40' cy='90' r='2.5' fill='%2384cc16'/><circle cx='110' cy='80' r='3' fill='%23a855f7'/><circle cx='160' cy='110' r='2.5' fill='%23f97316'/><circle cx='30' cy='150' r='3' fill='%2322c55e'/><circle cx='100' cy='160' r='2.5' fill='%23ef4444'/></svg>") fixed,
    linear-gradient(180deg, #ffffff 0%, #f1f5f9 100%) fixed !important;
}
body[data-bg="wolken"] {
  background:
    linear-gradient(rgba(255,255,255,var(--bg-fade)), rgba(255,255,255,var(--bg-fade))) fixed,
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='600' height='300' viewBox='0 0 600 300'><g fill='%23ffffff' opacity='0.55'><ellipse cx='80' cy='80' rx='60' ry='22'/><ellipse cx='130' cy='75' rx='40' ry='18'/><ellipse cx='340' cy='190' rx='70' ry='25'/><ellipse cx='400' cy='185' rx='45' ry='20'/><ellipse cx='510' cy='90' rx='55' ry='22'/></g></svg>") fixed,
    linear-gradient(180deg, #93c5fd 0%, #bfdbfe 50%, #e0f2fe 100%) fixed !important;
}
body[data-bg="rose"] {
  background:
    linear-gradient(rgba(255,255,255,var(--bg-fade)), rgba(255,255,255,var(--bg-fade))) fixed,
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220' viewBox='0 0 220 220'><g fill='%23ec4899' opacity='0.18'><circle cx='40' cy='40' r='14'/><circle cx='30' cy='40' r='10'/><circle cx='50' cy='40' r='10'/><circle cx='40' cy='30' r='10'/><circle cx='40' cy='50' r='10'/></g><g fill='%23ec4899' opacity='0.18'><circle cx='160' cy='150' r='14'/><circle cx='150' cy='150' r='10'/><circle cx='170' cy='150' r='10'/><circle cx='160' cy='140' r='10'/><circle cx='160' cy='160' r='10'/></g></svg>") fixed,
    linear-gradient(180deg, #fff1f2 0%, #fce7f3 100%) fixed !important;
}
/* "Kein Hintergrund": flache neutrale Farbe, keine dekorative Ueberlagerung */
body[data-bg="kein"] {
  background: #f1f5f9 !important;
}
body[data-bg="kein"] #calendar-container,
body[data-bg="kein"] #sidebar {
  background: var(--card) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border-color: var(--border) !important;
  color: var(--text) !important;
}
body[data-bg="kein"] .fc-scrollgrid {
  background: var(--card) !important;
}
body[data-bg="kein"] .fc .fc-daygrid-day-frame {
  background: var(--card) !important;
}
body[data-bg="kein"] .fc .fc-daygrid-day.fc-day-other .fc-daygrid-day-frame {
  background: #b8c5d4 !important;
}
body[data-bg="kein"] .fc .fc-day-today .fc-daygrid-day-frame {
  background: linear-gradient(180deg, rgba(55,136,216,0.12), var(--card)) !important;
}
body[data-bg="kein"] .fc .fc-col-header-cell,
body[data-bg="kein"] .fc-daygrid-week-number,
body[data-bg="kein"] .fc .fc-week-number {
  background: var(--bg-soft) !important;
}

/* Bei aktivem Theme: Kalender-Container komplett transparent (Motiv darunter sichtbar),
   einzelne Tageskacheln bekommen einen ganz leichten Weiss-Wash fuer Lesbarkeit. */
body[data-bg] #calendar-container {
  background: transparent !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  box-shadow: none !important;
  border-color: rgba(255, 255, 255, 0.45) !important;
}
body[data-bg] .fc-scrollgrid {
  background: transparent !important;
}
body[data-bg] .fc .fc-daygrid-day-frame {
  background: rgba(255, 255, 255, 0.62) !important;
  /* KEIN backdrop-filter hier — sonst erzeugt jede Zelle einen eigenen
     Stacking-Context und Mehrtages-Event-Balken werden von Folgezellen ueberdeckt. */
}
body[data-bg] .fc .fc-daygrid-day.fc-day-other .fc-daygrid-day-frame {
  background: #b8c5d4 !important;
}
body[data-bg] .fc .fc-day-today .fc-daygrid-day-frame {
  background: linear-gradient(180deg, rgba(55,136,216,0.35), rgba(255,255,255,0.7)) !important;
}
body[data-bg] .fc .fc-col-header-cell {
  background: rgba(255, 255, 255, 0.62) !important;
}
body[data-bg] .fc-daygrid-week-number,
body[data-bg] .fc .fc-week-number {
  background: rgba(255, 255, 255, 0.55) !important;
}

/* Sidebar bleibt als Frosted-Glass-Karte fuer Kontrast (nicht voll transparent) */
body[data-bg] #sidebar {
  background: rgba(255, 255, 255, 0.74) !important;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-color: rgba(255, 255, 255, 0.5) !important;
}

/* Dark-Theme "sterne": dunkle Variante, sonst ueberdeckt's die Sterne */
body[data-bg="sterne"] .fc .fc-daygrid-day-frame {
  background: rgba(15, 23, 42, 0.55) !important;
  border-color: rgba(255, 255, 255, 0.10) !important;
}
body[data-bg="sterne"] .fc .fc-daygrid-day.fc-day-other .fc-daygrid-day-frame {
  background: rgba(15, 23, 42, 0.30) !important;
}
body[data-bg="sterne"] .fc .fc-day-today .fc-daygrid-day-frame {
  background: linear-gradient(180deg, rgba(55,136,216,0.40), rgba(15,23,42,0.7)) !important;
}
body[data-bg="sterne"] .fc .fc-col-header-cell,
body[data-bg="sterne"] .fc-daygrid-week-number,
body[data-bg="sterne"] .fc .fc-week-number,
body[data-bg="sterne"] #sidebar {
  background: rgba(15, 23, 42, 0.55) !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
  color: #f1f5f9 !important;
}
body[data-bg="sterne"] .fc .fc-toolbar-title,
body[data-bg="sterne"] .fc .fc-col-header-cell-cushion,
body[data-bg="sterne"] .fc .fc-daygrid-day-number,
body[data-bg="sterne"] #sidebar h3,
body[data-bg="sterne"] #sidebar p,
body[data-bg="sterne"] #sidebar label {
  color: #f1f5f9 !important;
}

/* Theme-Picker im Settings-Modal */
.bg-theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(86px, 1fr));
  gap: 0.55rem;
  margin-top: 0.5rem;
}
.bg-theme-option {
  position: relative;
  height: 64px;
  border-radius: 10px;
  border: 2px solid var(--border);
  cursor: pointer;
  padding: 0;
  overflow: hidden;
  background: var(--bg-preview, var(--bg-soft));
  font-size: 0;
  transition: transform 80ms ease, border-color 80ms ease;
}
.bg-theme-option::after {
  content: attr(data-label);
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 2px 4px;
  font-size: 0.7rem;
  font-weight: 600;
  color: #fff;
  background: rgba(15,23,42,0.55);
  text-align: center;
  letter-spacing: 0.01em;
}
.bg-theme-option:hover { transform: translateY(-1px); }
.bg-theme-option.is-active {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(55,136,216,0.18);
}

/* ========== Aufklappbare Gruppen im Einstellungs-Modal ========== */
details.settings-group {
  margin: 0 0 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-soft);
  overflow: hidden;
}
details.settings-group > summary {
  cursor: pointer;
  list-style: none;
  padding: 0.8rem 1rem;
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
  user-select: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
details.settings-group > summary::-webkit-details-marker { display: none; }
details.settings-group > summary::before {
  content: "▸";
  color: var(--text-muted);
  font-size: 0.9rem;
  transition: transform var(--transition);
}
details.settings-group[open] > summary::before { transform: rotate(90deg); }
details.settings-group[open] > summary { border-bottom: 1px solid var(--border); }
details.settings-group .settings-group-body {
  padding: 0.9rem 1rem 1.1rem;
  background: var(--card);
}
details.settings-group .settings-group-body .settings-section {
  margin-top: 0;
}

/* ========== Aufklappbare Bereiche im Event-Modal ========== */
details.event-section {
  margin: 0.85rem 0 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-soft);
}
details.event-section > summary {
  cursor: pointer;
  list-style: none;
  padding: 0.65rem 0.9rem;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
  user-select: none;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
details.event-section > summary::-webkit-details-marker { display: none; }
details.event-section > summary::before {
  content: "▸";
  color: var(--text-muted);
  font-size: 0.85rem;
  transition: transform var(--transition);
  display: inline-block;
}
details.event-section[open] > summary::before { transform: rotate(90deg); }
details.event-section[open] > summary {
  border-bottom: 1px solid var(--border);
}
details.event-section .event-section-body {
  padding: 0.8rem 0.9rem 0.95rem;
  background: var(--card);
  border-bottom-left-radius: var(--radius);
  border-bottom-right-radius: var(--radius);
}

/* ========== KONTAKTE (Telefon / E-Mail) ========== */
.contact-row {
  display: flex; gap: 0.5rem; align-items: center;
  padding: 0.35rem 0.1rem;
  border-bottom: 1px solid var(--border-soft);
}
.contact-row:last-child { border-bottom: none; }
.contact-row .contact-icon { flex: 0 0 auto; }
.contact-row .contact-value { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.contact-row .remove {
  background: transparent; border: none; color: var(--text-muted);
  font-size: 1.2rem; cursor: pointer; padding: 0 0.4rem;
}
.contact-row .remove:hover { color: var(--danger); }

/* ========== MUST-TODOS ========== */
.must-todo-row {
  display: flex; gap: 0.5rem; align-items: center;
  margin-bottom: 0.4rem;
}
.must-todo-row > input[type="checkbox"] { margin: 0; }
.must-todo-row > input[type="text"] { flex: 1; }
.must-todo-row .remove {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0 0.4rem;
}
.must-todo-row .remove:hover { color: var(--danger); }

/* Tageskachel rot, wenn der Tag einen Termin mit offenen Must-Todos im Warnfenster enthaelt */
.fc .fc-daygrid-day.has-pending-must-todos .fc-daygrid-day-frame {
  background:
    radial-gradient(circle at 50% 14%, rgba(255, 255, 255, 0.92) 0, rgba(254, 226, 226, 0.94) 34%, rgba(254, 202, 202, 0.90) 100%) !important;
  border-color: rgba(239, 68, 68, 0.86) !important;
  box-shadow:
    inset 0 4px 0 rgba(220, 38, 38, 0.78),
    inset 0 0 0 1px rgba(248, 113, 113, 0.65),
    0 0 0 2px rgba(248, 113, 113, 0.30),
    0 0 18px rgba(239, 68, 68, 0.65),
    0 0 34px rgba(239, 68, 68, 0.38) !important;
  animation: mustTodoDayGlow 1.8s ease-in-out infinite;
  z-index: 4;
}
body[data-bg]:not([data-bg="kein"]) .fc .fc-daygrid-day.has-pending-must-todos .fc-daygrid-day-frame {
  background:
    radial-gradient(circle at 50% 14%, rgba(255, 255, 255, 0.86) 0, rgba(254, 202, 202, 0.86) 36%, rgba(248, 113, 113, 0.70) 100%) !important;
}
.fc .fc-daygrid-day.has-pending-must-todos .fc-daygrid-day-number {
  color: #fff !important;
  background: #dc2626;
  border-radius: 999px;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.75), 0 0 12px rgba(220, 38, 38, 0.75);
}
@keyframes mustTodoDayGlow {
  0%, 100% {
    box-shadow:
      inset 0 4px 0 rgba(220, 38, 38, 0.72),
      inset 0 0 0 1px rgba(248, 113, 113, 0.58),
      0 0 0 2px rgba(248, 113, 113, 0.22),
      0 0 14px rgba(239, 68, 68, 0.48),
      0 0 26px rgba(239, 68, 68, 0.28);
  }
  50% {
    box-shadow:
      inset 0 4px 0 rgba(220, 38, 38, 0.95),
      inset 0 0 0 1px rgba(248, 113, 113, 0.90),
      0 0 0 3px rgba(248, 113, 113, 0.36),
      0 0 24px rgba(239, 68, 68, 0.78),
      0 0 46px rgba(239, 68, 68, 0.48);
  }
}
@media (prefers-reduced-motion: reduce) {
  .fc .fc-daygrid-day.has-pending-must-todos .fc-daygrid-day-frame {
    animation: none;
  }
}

/* ========== "Vergangene ausblenden": uebrig gebliebene Markierungen
   (Feiertage, Geburtstage) als hellgraue Andeutung darstellen ========== */
.fc-event.event-past-faded {
  background: #e2e8f0 !important;
  border-color: #cbd5e0 !important;
  color: #94a3b8 !important;
  filter: grayscale(85%);
  opacity: 0.7;
}
.fc-event.event-past-faded .fc-event-title,
.fc-event.event-past-faded .fc-event-title-container {
  color: #94a3b8 !important;
  font-weight: 500;
}

/* ========== Vergangene Tage abdunkeln ========== */
/* Vergangene Tage: per JS werden komplett vergangene Zeilen entfernt */

/* Nächster Monat (per JS markiert): roter Hintergrund */
.fc .fc-daygrid-day.day-next-month .fc-daygrid-day-frame {
  background: #fde2e2 !important;
}
.fc .fc-daygrid-day.day-next-month .fc-daygrid-day-number {
  opacity: 0.55;
  color: #b91c1c;
}

/* ========== Wochenenden farblich abheben ========== */
.fc .fc-day-sat .fc-daygrid-day-frame,
.fc .fc-day-sun .fc-daygrid-day-frame {
  background: rgba(55, 136, 216, 0.05) !important;
}
.fc .fc-day-sat .fc-daygrid-day-number,
.fc .fc-day-sun .fc-daygrid-day-number {
  color: var(--primary);
  font-weight: 700;
}
.fc .fc-col-header-cell.fc-day-sat,
.fc .fc-col-header-cell.fc-day-sun {
  background: rgba(55, 136, 216, 0.08) !important;
  color: var(--primary);
}
/* Themes-Modus: weisser Wash kann den Effekt schlucken, hier nachschaerfen */
body[data-bg]:not([data-bg="kein"]) .fc .fc-day-sat .fc-daygrid-day-frame,
body[data-bg]:not([data-bg="kein"]) .fc .fc-day-sun .fc-daygrid-day-frame {
  background: rgba(55, 136, 216, 0.14) !important;
}

/* ========== Countdown-Badge bei wichtigen Terminen ========== */
.countdown-badge {
  display: inline-block;
  margin-left: 0.4rem;
  padding: 0.05rem 0.45rem;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
  vertical-align: middle;
}
.countdown-badge.is-today { background: var(--warning); }
.countdown-badge.is-soon  { background: var(--danger); }
.countdown-badge.is-far   { background: var(--text-muted); }

/* ========== Beschreibung mit Markdown-Light gerendert ========== */
.rendered-desc {
  white-space: pre-wrap;
  word-break: break-word;
}
.rendered-desc strong { font-weight: 700; }
.rendered-desc em     { font-style: italic; }
.rendered-desc a      { color: var(--primary); text-decoration: underline; }

/* ========== TAGES-POPUP (Klick auf Tageszelle) ========== */
.day-popup-events {
  display: flex; flex-direction: column; gap: 0.4rem;
  margin-bottom: 0.4rem;
}
.day-popup-event {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.55rem 0.7rem;
  border-radius: var(--radius);
  border: 1px solid var(--border-soft);
  background: var(--card);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}
.day-popup-event:hover {
  background: var(--bg-soft);
  border-color: var(--border);
}
.day-popup-event .dp-bar {
  flex: 0 0 6px;
  align-self: stretch;
  border-radius: 3px;
  background: var(--dp-color, #3788d8);
}
.day-popup-event .dp-time {
  font-variant-numeric: tabular-nums;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
  min-width: 5.2em;
}
.day-popup-event .dp-title {
  flex: 1;
  font-weight: 600;
  color: var(--text);
  word-break: break-word;
}
.day-popup-event .dp-loc {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ========== Termin-Titel im Editor: farblich auffällig ========== */
#modal-event #ev-title {
  background: #fef3c7 !important;            /* helles Gelb */
  border: 2px solid var(--primary) !important;
  font-size: 1.15rem !important;
  font-weight: 700 !important;
  padding: 0.55rem 0.8rem !important;
  border-radius: var(--radius) !important;
  color: #1e293b !important;
  box-shadow: 0 1px 3px rgba(55,136,216,0.15);
}
#modal-event #ev-title:focus {
  outline: 3px solid rgba(55,136,216,0.3);
  outline-offset: 1px;
}

/* ========== EXTERNE KALENDER (iCal-Abos) ========== */
.ical-sub-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.8rem;
  margin-bottom: 0.6rem;
  box-shadow: var(--shadow-sm);
}
.ical-sub-card .ical-sub-head {
  display: flex; align-items: center; gap: 0.5rem;
  font-size: 1rem;
}
.ical-sub-card .ical-sub-head .swatch {
  width: 0.9rem; height: 0.9rem; border-radius: 50%;
  flex: 0 0 auto; display: inline-block;
}
.ical-sub-card .ical-ok  { color: var(--success); font-weight: 600; }
.ical-sub-card .ical-err { color: var(--danger);  font-weight: 600; }

/* Reminder-Tag-Checkboxen (in ical-Abo-Anlegen + Edit-Modal) */
.ical-reminder-days {
  display: flex; flex-wrap: wrap; gap: 0.4rem 0.8rem;
  margin: 0.3rem 0 0.2rem;
}
.ical-reminder-day {
  display: inline-flex; align-items: center; gap: 0.3rem;
  font-weight: normal; margin: 0;
}
.ical-reminder-day input { margin: 0; }

/* ========== TERMIN-UMFRAGEN ========== */
.poll-slot-row {
  display: flex; align-items: center; gap: 0.4rem;
  margin-bottom: 0.4rem;
}
.poll-slot-row > input[type="datetime-local"] { flex: 1; min-width: 0; }
.poll-slot-row .poll-slot-remove {
  background: transparent; border: none; color: var(--text-muted);
  font-size: 1.2rem; cursor: pointer; padding: 0 0.4rem;
}
.poll-slot-row .poll-slot-remove:hover { color: var(--danger); }
.poll-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem;
  margin-bottom: 0.6rem;
  box-shadow: var(--shadow-sm);
}
.poll-card h4 { margin: 0 0 0.4rem 0; font-size: 1rem; }
.poll-tally {
  width: 100%; border-collapse: collapse;
  font-size: 0.85rem; margin-top: 0.3rem;
}
.poll-tally td { padding: 0.25rem 0.4rem; border-bottom: 1px solid var(--border-soft); }
.poll-tally td:first-child { color: var(--text); font-weight: 500; }
.poll-tally td:nth-child(n+2) { width: 4em; text-align: center; font-weight: 600; }
.poll-tally .cnt-yes   { color: var(--success); }
.poll-tally .cnt-maybe { color: var(--warning); }
.poll-tally .cnt-no    { color: var(--danger);  }

/* ========== TEMPLATES-VERWALTUNG (Settings) ========== */
.template-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 0.5rem;
  align-items: center;
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid var(--border-soft);
}
.template-row:last-child { border-bottom: none; }
.template-row > span:first-child { font-weight: 600; }
.template-row > .hint { font-size: 0.8rem; }

/* ========== ACTIVITY-FEED ("Änderungen und Neues") ========== */
#view-activity #activity-list { display: flex; flex-direction: column; gap: 0.5rem; }
.activity-row {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.7rem 0.9rem;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}
.activity-row:hover,
.activity-row:focus-visible {
  border-color: var(--primary);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
  outline: none;
}
.activity-row .activity-meta {
  display: flex; align-items: center; gap: 0.5rem;
  font-size: 0.82rem; color: var(--text-muted);
  margin-bottom: 0.25rem;
  flex-wrap: wrap;
}
.activity-row .activity-meta .swatch {
  width: 0.7rem; height: 0.7rem; border-radius: 50%;
  display: inline-block; flex: 0 0 auto;
}
.activity-row .activity-team { font-weight: 600; color: var(--text); }
.activity-row .activity-action {
  background: var(--bg-soft);
  padding: 0.05rem 0.45rem;
  border-radius: 999px;
}
.activity-row .activity-summary {
  font-weight: 600; color: var(--text);
  word-break: break-word;
}
.activity-row .activity-when {
  font-size: 0.75rem; color: var(--text-muted);
  margin-top: 0.2rem;
}

/* ========== UNDO-TOAST ========== */
.undo-toast {
  position: fixed; bottom: 5rem; left: 50%; transform: translateX(-50%);
  background: #2d3748; color: white;
  padding: 0.6rem 1rem; border-radius: 8px;
  display: none; align-items: center; gap: 1rem;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  z-index: 200;
}
.undo-toast.show { display: flex; }
.undo-toast button {
  background: #3788d8; color: white; border: none;
  padding: 0.3rem 0.8rem; border-radius: 4px; cursor: pointer;
  font-size: 0.85rem;
}

/* ========== LIGHTBOX ========== */
#modal-lightbox { background: transparent; padding: 0; }
.lightbox-backdrop {
  position: absolute; inset: 0; background: rgba(0,0,0,0.92); cursor: pointer;
}
#lightbox-img {
  position: relative; max-width: 90vw; max-height: 90vh;
  z-index: 2; box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.lightbox-close, .lightbox-prev, .lightbox-next {
  position: fixed; z-index: 3; background: rgba(0,0,0,0.5);
  color: white; border: none; font-size: 2.5rem; cursor: pointer;
  width: 3rem; height: 3rem; border-radius: 50%; line-height: 1;
}
.lightbox-close { top: 1rem; right: 1rem; }
.lightbox-prev  { left: 1rem; top: 50%; transform: translateY(-50%); }
.lightbox-next  { right: 1rem; top: 50%; transform: translateY(-50%); }
#lightbox-counter {
  position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%);
  color: white; background: rgba(0,0,0,0.5); padding: 0.4rem 0.8rem;
  border-radius: 6px; z-index: 3;
}

/* ========== PAPIERKORB ========== */
.trash-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.5rem; border-bottom: 1px solid var(--border);
}
.trash-item .ti-info { flex: 1; }
.trash-item .ti-meta { color: var(--text-muted); font-size: 0.75rem; }

/* ========== SESSIONS ========== */
.session-row {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 0.5rem; border-bottom: 1px solid var(--border);
}
.session-row.current { background: rgba(40,167,69,0.05); }
.session-row .s-info { font-size: 0.85rem; flex: 1; }
.session-row .s-meta { color: var(--text-muted); font-size: 0.75rem; }
.session-row .badge-current {
  display: inline-block; background: #28a745; color: white;
  font-size: 0.7rem; padding: 0.1rem 0.4rem; border-radius: 3px;
  margin-left: 0.3rem;
}

/* ========== STATUS-FARBEN BEI EVENTS ========== */
.fc-event.status-tentative { opacity: 0.65; border-style: dashed; }
.fc-event.status-cancelled { opacity: 0.45; text-decoration: line-through; }

/* ========== QR-CODE ========== */
#qr-canvas-wrap img,
#qr-canvas-wrap canvas {
  max-width: 256px; height: auto; border: 8px solid white;
  background: white; border-radius: 8px;
}

/* ========== HINT/Code ========== */
code {
  font-family: ui-monospace, "SF Mono", Monaco, monospace;
  font-size: 0.85em; background: rgba(0,0,0,0.05);
  padding: 0.1em 0.3em; border-radius: 3px;
}

/* ========== MOBILE-KALENDER-FIX ========== */
@media (max-width: 640px) {
  #topbar {
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-areas:
      "avatar brand menu";
    gap: 0.45rem 0.55rem;
    /* Top-Padding: mind. 34px ODER Safe-Area der Android/iOS-Statusleiste,
       damit die Leiste nie hinter der Systemleiste verschwindet. */
    padding: max(34px, calc(0.55rem + env(safe-area-inset-top, 0px))) 0.65rem 0.6rem;
    align-items: center;
  }
  .brand {
    display: none;
  }
  .header-avatar-left {
    grid-area: avatar;
    min-width: 0;
  }
  #topbar nav {
    display: none;
  }
  .tab {
    min-width: 0;
    min-height: 2.25rem;
    padding: 0.45rem 0.35rem;
    font-size: 0.78rem;
    line-height: 1;
    flex: 1 1 0;
  }
  .user-menu {
    display: none;
  }
  .mobile-menu-btn {
    grid-area: menu;
    display: inline-flex;
    justify-self: end;
  }
  .mobile-menu-panel.show {
    display: flex;
    position: absolute;
    top: calc(100% + 0.35rem);
    right: 0.65rem;
    left: 0.65rem;
    flex-direction: column;
    z-index: 80;
  }
  #user-name { display: none; }
  #app-version {
    display: block;
    right: 5px;
    bottom: 4px;
    font-size: 0.6rem;
  }
  #settings-btn {
    width: 2.25rem;
    height: 2.25rem;
  }
  .btn-logout {
    width: 2.25rem;
    height: 2.25rem;
    padding: 0 !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  #header-avatar.avatar-sm {
    width: 25px;
    height: 25px;
    font-size: 0.68rem;
  }

  main {
    padding: 0.55rem 0;
    min-height: calc(100dvh - 5.9rem);
  }
  #view-calendar.active {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
  }
  #calendar-container {
    width: 100%;
    order: 1;
    padding: 0.45rem 0 calc(3.6rem + env(safe-area-inset-bottom, 0px));
    border-radius: 0;
    min-height: auto;
  }
  #sidebar {
    width: 100%;
    order: 2;
    padding: 0.75rem 0.55rem;
    border-radius: 12px;
  }
  #calendar {
    min-height: 0;
  }
  .calendar-toolbar-extra {
    margin-bottom: 0.45rem;
  }
  .sidebar-toggle {
    margin-bottom: calc(2.2rem + env(safe-area-inset-bottom, 0px));
  }
  #view-switcher {
    width: 100%;
    min-width: 0;
    padding: 0.52rem 0.65rem;
    font-size: 0.9rem;
  }

  .fc .fc-header-toolbar {
    display: flex !important;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem;
    margin-bottom: 0.55rem !important;
  }
  .fc .fc-toolbar-chunk {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
  }
  /* mittlerer Chunk = Titel: nimmt restliche Breite, bleibt zentriert */
  .fc .fc-toolbar-chunk:nth-child(2) {
    flex: 1 1 auto;
    justify-content: center;
    min-width: 0;
  }
  .fc .fc-toolbar-title {
    font-size: 1rem !important;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .fc .fc-button {
    padding: 0.42rem 0.58rem !important;
    font-size: 0.8rem !important;
    min-height: 2.1rem;
  }
  .fc-scrollgrid {
    border-radius: 10px;
  }
  .fc .fc-col-header-cell {
    background: var(--bg-soft) !important;
  }
  .fc .fc-col-header-cell-cushion {
    font-size: 0.82rem;
    font-weight: 700;
  }
  .short-month-notice {
    justify-content: space-between;
    gap: 0.5rem;
    min-height: 2.7rem;
    padding: 0.45rem 0.5rem;
    font-size: 0.78rem;
  }
  .short-month-toggle {
    flex: 0 0 auto;
    font-size: 0.76rem;
    padding: 0.38rem 0.48rem;
  }
  .fc th {
    font-size: 0.78rem !important;
    padding: 0.42rem 0 !important;
  }
  .fc .fc-daygrid-day-frame {
    min-height: 5.4rem;
    margin: 2px;
  }
  .fc .fc-daygrid-day-number {
    font-size: 0.95rem;
    font-weight: 700;
    padding: 0.24rem 0.35rem !important;
  }
  .fc-day-today .fc-daygrid-day-number {
    width: 1.45rem;
    height: 1.45rem;
    margin: 0.12rem;
  }
  .fc-event {
    font-size: 0.78rem !important;
    line-height: 1.22 !important;
    padding: 2px 5px !important;
    border-radius: 5px !important;
    text-shadow: none;
  }
  .fc .fc-daygrid-event {
    margin-top: 2px !important;
  }
  .fc .fc-daygrid-more-link {
    display: inline-block;
    margin-top: 2px;
    padding: 1px 5px;
    border-radius: 999px;
    background: var(--bg-soft);
    border: 1px solid var(--border-soft);
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 700;
  }
  .fc-event.event-birthday {
    padding-right: 1.45rem !important;
  }
  .fc-event.event-birthday::after {
    right: 0.3rem;
    font-size: 0.78rem;
  }
  .fc-event.event-shared-stripe {
    box-shadow: inset 2px 0 0 var(--shared-origin-color, #0ea5e9) !important;
  }
  .fc-event.event-shared-badge .fc-event-title::before {
    width: 1.1em;
    height: 1.1em;
    margin-right: 0.15em;
  }
  .fc-event.event-shared-pattern {
    background-image:
      repeating-linear-gradient(135deg, rgba(255,255,255,0.20) 0 2px, rgba(255,255,255,0) 2px 5px) !important;
  }
  .fc-daygrid-day-frame .moon-phase.moon-new,
  .fc-daygrid-day-frame .moon-phase.moon-full {
    font-size: 0.62rem;
    padding: 0.05rem 0.28rem;
  }
  .sidebar-section {
    margin-top: 0.75rem;
  }
  .sidebar-section > summary {
    padding: 0.5rem 0.55rem;
  }
  .sidebar-section .cb-row,
  .team-filter,
  .team-shared-marker-options .cb-row,
  #sidebar button {
    font-size: 0.9rem;
  }
  .team-shared-marker-options {
    grid-template-columns: 1fr;
  }
  .quick-input-row {
    gap: 0.4rem;
  }
  .quick-input-row input {
    min-width: 0;
    font-size: 0.92rem;
    padding: 0.55rem 0.6rem;
  }
}

@media (max-width: 380px) {
  .tab {
    font-size: 0.72rem;
    padding-left: 0.22rem;
    padding-right: 0.22rem;
  }
  .fc-event {
    font-size: 0.72rem !important;
  }
  .fc .fc-daygrid-day-number {
    font-size: 0.9rem;
  }
}

/* Countdown-Widget */
#event-countdown {
  padding: 0.5rem 0.8rem; margin-bottom: 0.5rem;
  background: var(--surface); border-radius: var(--radius);
  font-size: 0.85rem; color: var(--text);
  display: flex; gap: 1rem; flex-wrap: wrap; align-items: center;
}
#event-countdown .cd-item {
  display: flex; align-items: center; gap: 0.3rem;
}
#event-countdown .cd-days {
  font-weight: 700; color: var(--primary);
}

/* Such-Dropdown */
.search-dropdown {
  position: absolute; z-index: 300; left: 0; right: 0;
  max-height: 320px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.search-dropdown .sr-item {
  padding: 0.5rem 0.8rem; cursor: pointer; border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}
.search-dropdown .sr-item:hover { background: var(--hover); }
.search-dropdown .sr-title { font-weight: 600; }
.search-dropdown .sr-meta { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.15rem; }
.search-dropdown .sr-empty { padding: 0.8rem; text-align: center; color: var(--text-muted); font-size: 0.85rem; }

/* ========== TAGE-SCAN (Vergrößerung) ========== */
.btn-scan {
  padding: 0.3rem 0.7rem; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--card); cursor: pointer; font-size: 0.82rem; color: var(--text);
  white-space: nowrap; transition: background 0.15s, border-color 0.15s;
}
.btn-scan:hover { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.btn-scan.scanning { background: #dc3545; color: #fff; border-color: #dc3545; }

.fc-daygrid-day { transition: none; }

.scan-active .fc-daygrid-day { opacity: 0.35; transition: opacity 0.4s ease; }
.scan-active .fc-daygrid-day.scan-focus {
  opacity: 1; position: relative; z-index: 50;
  box-shadow: 0 0 0 3px var(--primary), 0 12px 40px rgba(0,0,0,0.35);
  transform: scale(2.0);
  transform-origin: center center;
  transition: opacity 0.3s ease, transform 0.4s ease, box-shadow 0.4s ease;
  border-radius: 4px;
  background: var(--card);
}
.scan-active .fc-daygrid-day.scan-focus .fc-daygrid-day-events {
  font-size: 1.6em;
}
.scan-active .fc-daygrid-day.scan-focus .fc-event {
  white-space: normal; overflow: visible;
  text-overflow: unset; line-height: 1.3;
  max-height: none; padding: 2px 4px;
}
.scan-active .fc-daygrid-day.scan-focus .fc-event-title {
  white-space: normal; overflow: visible; text-overflow: unset;
}
.scan-active .fc-col-header-cell { transition: opacity 0.3s ease; opacity: 0.4; }
.scan-active .fc-col-header-cell.scan-header-focus { opacity: 1; font-weight: 700; }

/* ========== ADAPTIVE SPALTENBREITE ========== */
.btn-adaptive {
  display: none !important;
  padding: 0.3rem 0.7rem; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--card); cursor: pointer; font-size: 0.82rem; color: var(--text);
  white-space: nowrap; transition: background 0.15s, border-color 0.15s;
}
.btn-adaptive:hover { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.btn-adaptive.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.adaptive-cols .fc-col-header,
.adaptive-cols .fc-daygrid-body,
.adaptive-cols .fc-scrollgrid-sync-table { table-layout: fixed; }

.adaptive-cols .fc-daygrid-day .fc-event {
  white-space: normal; overflow: visible; text-overflow: unset; line-height: 1.25;
}
.adaptive-cols .fc-daygrid-day-empty .fc-event { white-space: nowrap; }

.adaptive-cols col { transition: width 0.4s ease; }

/* ========== OFFLINE-BANNER ========== */
.offline-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 9999;
  background: #f59e0b; color: #1a1a1a; text-align: center;
  padding: 0.5rem 1rem; font-size: 0.85rem; font-weight: 600;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  animation: offlinePulse 3s ease-in-out infinite;
}
.offline-banner.syncing { background: #3b82f6; color: #fff; animation: none; }
@keyframes offlinePulse {
  0%, 100% { opacity: 1; } 50% { opacity: 0.8; }
}
body.is-offline #topbar { margin-top: 36px; }

/* Kommentare */
.comment-item {
  padding: 0.4rem 0; border-bottom: 1px solid var(--border); font-size: 0.85rem;
}
.comment-item:last-child { border-bottom: none; }
.comment-meta { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.15rem; }

/* History */
.history-item {
  padding: 0.3rem 0; border-bottom: 1px solid var(--border);
}
.history-item:last-child { border-bottom: none; }

/* Finale Fremdmonat-Schraffur: ganz am Dateiende, damit Theme-Regeln sie nicht ueberschreiben. */
body .fc .fc-daygrid-day.fc-day-other .fc-daygrid-day-frame,
body[data-bg] .fc .fc-daygrid-day.fc-day-other .fc-daygrid-day-frame,
body[data-bg="kein"] .fc .fc-daygrid-day.fc-day-other .fc-daygrid-day-frame {
  background:
    repeating-linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.60) 0,
      rgba(255, 255, 255, 0.60) 7px,
      rgba(244, 114, 182, 0.18) 7px,
      rgba(244, 114, 182, 0.18) 14px
    ) !important;
  border-color: rgba(244, 114, 182, 0.24) !important;
}

body[data-bg="sterne"] .fc .fc-daygrid-day.fc-day-other .fc-daygrid-day-frame {
  background:
    repeating-linear-gradient(
      135deg,
      rgba(15, 23, 42, 0.28) 0,
      rgba(15, 23, 42, 0.28) 7px,
      rgba(244, 114, 182, 0.18) 7px,
      rgba(244, 114, 182, 0.18) 14px
    ) !important;
}

/* Robuste Heute-Markierung nach dem Ausblenden vergangener Wochen. */
body .fc .fc-daygrid-day.manual-today .fc-daygrid-day-frame {
  background: linear-gradient(180deg, rgba(55,136,216,0.14), var(--card)) !important;
  border-color: rgba(55,136,216,0.32) !important;
  box-shadow: inset 0 3px 0 var(--primary) !important;
}
body .fc .fc-daygrid-day.manual-today .fc-daygrid-day-number {
  color: white !important;
  font-weight: 700;
  background: var(--primary);
  border-radius: 50%;
  width: 1.8rem;
  height: 1.8rem;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  margin: 0.25rem;
  box-shadow: 0 1px 3px rgba(55,136,216,0.4);
}

#btn-scan,
.btn-scan {
  display: none !important;
}
