/* ============================================================
   Clu To-Do — Premium Design „Matte Black / Bright Red"
   Themes: dark (Flagship) | light | colorful
   ============================================================ */

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

:root {
  --on-accent: #ffffff;
  /* Helle Platte hinter Firmenlogos — viele Logos sind dunkle Zeichnungen
     auf transparentem Grund und brauchen einen hellen Untergrund. */
  --logo-plate: #ffffff;
  --logo-plate-border: rgba(0, 0, 0, 0.10);
  --accent: #ff2b2b;
  --font: 'Segoe UI', 'Inter', system-ui, -apple-system, sans-serif;
}

html { font-size: 16px; }

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ---------- Theme: DARK (Flagship „Matte Black / Bright Red") ---------- */
[data-theme='dark'] {
  /* Schriftfarbe auf Akzentflaechen — muss zum Akzent passen. */
  --on-accent: #ffffff;
  /* Helle Platte hinter Firmenlogos — viele Logos sind dunkle Zeichnungen
     auf transparentem Grund und brauchen einen hellen Untergrund. */
  --logo-plate: #f4f6f8;
  --logo-plate-border: rgba(0, 0, 0, 0.18);
  --bg0: #060606;
  --bg1: #0b0b0b;
  --surface: #121212;
  --surface2: #1a1a1a;
  --surface3: #262626;
  --border: rgba(255, 43, 43, 0.22);
  --border-soft: rgba(255, 255, 255, 0.07);
  --text: #f1f1f1;
  --muted: #9c9c9c;
  --gold: #ffb347;
  --danger: #ff4d4d;
  --ok: #00e07a;
  --info: #4da6ff;
  --accent: #ff2b2b;
  --bg: radial-gradient(1000px 520px at 50% 0%, rgba(255, 43, 43, 0.06), transparent 62%) fixed, #060606 fixed;
  --glass: rgba(10, 10, 10, 0.82);
  --card: rgba(16, 16, 16, 0.92);
  --shadow: 0 12px 34px rgba(0, 0, 0, 0.55);
  --glow: 0 0 0 1px rgba(255, 43, 43, 0.35), 0 8px 26px rgba(255, 43, 43, 0.14);
  --scroll: #2e2e2e;
  --chat-mine-text: #ffffff;
  --hover: rgba(255, 255, 255, 0.08);
  --accent-bg: rgba(255, 43, 43, 0.12);
  --accent-hover: #ff4444;
  --success: #00e07a;
}

/* ---------- Theme: LIGHT ---------- */
[data-theme='light'] {
  /* Schriftfarbe auf Akzentflaechen — muss zum Akzent passen. */
  --on-accent: #ffffff;
  /* Helle Platte hinter Firmenlogos — viele Logos sind dunkle Zeichnungen
     auf transparentem Grund und brauchen einen hellen Untergrund. */
  --logo-plate: #ffffff;
  --logo-plate-border: rgba(0, 0, 0, 0.10);
  --bg0: #f5f5f5;
  --bg1: #ffffff;
  --surface: #ffffff;
  --surface2: #f5f5f5;
  --surface3: #e9e9e9;
  --border: rgba(180, 40, 40, 0.18);
  --border-soft: rgba(0, 0, 0, 0.08);
  --text: #1d1d1d;
  --muted: #717171;
  --gold: #b26a00;
  --danger: #dc2626;
  --ok: #16a34a;
  --info: #2563eb;
  --accent: #e02626;
  --bg: linear-gradient(160deg, var(--bg0) 0%, var(--bg1) 60%) fixed;
  --glass: rgba(255, 255, 255, 0.85);
  --card: rgba(255, 255, 255, 0.95);
  --shadow: 0 12px 30px rgba(80, 30, 30, 0.12);
  --glow: 0 0 0 1px rgba(224, 38, 38, 0.22), 0 8px 22px rgba(224, 38, 38, 0.10);
  --scroll: #d6d6d6;
  --chat-mine-text: #ffffff;
  --hover: rgba(0, 0, 0, 0.06);
  --accent-bg: rgba(224, 38, 38, 0.08);
  --accent-hover: #c41e1e;
  --success: #16a34a;
}

/* ---------- Theme: COLORFUL ---------- */
[data-theme='colorful'] {
  /* Schriftfarbe auf Akzentflaechen — muss zum Akzent passen. */
  --on-accent: #ffffff;
  /* Helle Platte hinter Firmenlogos — viele Logos sind dunkle Zeichnungen
     auf transparentem Grund und brauchen einen hellen Untergrund. */
  --logo-plate: #f6f3f8;
  --logo-plate-border: rgba(0, 0, 0, 0.18);
  --bg0: #120b18;
  --bg1: #1b1030;
  --surface: #221938;
  --surface2: #2c1f49;
  --surface3: #3a2a5e;
  --border: rgba(179, 91, 255, 0.25);
  --border-soft: rgba(255, 255, 255, 0.10);
  --text: #f6f1ff;
  --muted: #b3a5cc;
  --gold: #ffd166;
  --danger: #ff5470;
  --ok: #06d6a0;
  --info: #4cc9f0;
  --accent: #b35bff;
  --bg: linear-gradient(150deg, var(--bg0) 0%, var(--bg1) 40%, #2a0d3a 78%, #0e3a3c 100%) fixed;
  --glass: rgba(30, 20, 52, 0.82);
  --card: rgba(34, 25, 56, 0.90);
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  --glow: 0 0 0 1px rgba(179, 91, 255, 0.32), 0 8px 24px rgba(179, 91, 255, 0.18);
  --scroll: #4a3a6e;
  --chat-mine-text: #ffffff;
  --hover: rgba(255, 255, 255, 0.08);
  --accent-bg: rgba(179, 91, 255, 0.15);
  --accent-hover: #c77dff;
  --success: #06d6a0;
}

/* ============================================================
   Theme: Jet d'eau  (hell)
   ============================================================
   Anlehnung an die Genfer Wasserfontaene: helles Wasserblau als
   Grund, tiefes Cyan als Akzent, fliessende Verlaeufe.
   Kontraste geprueft (WCAG): Text 14.7:1, Sekundaertext 5.2:1,
   Akzent 6.2:1 auf Weiss — alles mindestens AA.
   ============================================================ */
[data-theme='jetdeau'] {
  /* Schriftfarbe auf Akzentflaechen — muss zum Akzent passen. */
  --on-accent: #ffffff;
  /* Helle Platte hinter Firmenlogos — viele Logos sind dunkle Zeichnungen
     auf transparentem Grund und brauchen einen hellen Untergrund. */
  --logo-plate: #ffffff;
  --logo-plate-border: rgba(13, 43, 62, 0.14);
  --bg0: #eef6fb;
  --bg1: #ffffff;
  --surface: #ffffff;
  --surface2: #e9f3fa;
  --surface3: #dbeaf5;
  --border: rgba(1, 106, 133, 0.22);
  --border-soft: rgba(13, 43, 62, 0.10);
  --text: #0d2b3e;
  --muted: #4a6b80;
  --gold: #9a6a00;
  --danger: #b3261e;
  --ok: #0f7a4f;
  --info: #1565a8;
  --accent: #016a85;
  /* Zwei ineinanderlaufende Verlaeufe: der obere Bogen wie die aufsteigende
     Fontaene, der untere wie die Wasserflaeche darunter. */
  --bg: radial-gradient(1200px 620px at 50% -10%, rgba(1, 106, 133, 0.14), transparent 60%) fixed,
        linear-gradient(180deg, #f6fbfe 0%, #e6f2fa 100%) fixed;
  --glass: rgba(255, 255, 255, 0.88);
  --card: rgba(255, 255, 255, 0.96);
  --shadow: 0 12px 30px rgba(13, 43, 62, 0.10);
  --glow: 0 0 0 1px rgba(1, 106, 133, 0.28), 0 8px 24px rgba(1, 106, 133, 0.14);
  --scroll: #b9d5e6;
  --chat-mine-text: #ffffff;
  --hover: rgba(1, 106, 133, 0.08);
  --accent-bg: rgba(1, 106, 133, 0.10);
  --accent-hover: #01526a;
  --success: #0f7a4f;
}
[data-theme='jetdeau'] .company-logo {
  background: #ffffff;
  border: 1px solid rgba(13, 43, 62, 0.12);
  box-shadow: 0 2px 10px rgba(13, 43, 62, 0.10);
}
[data-theme='jetdeau'] .avatar, [data-theme='jetdeau'] .ch-avatar {
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.9), 0 2px 6px rgba(13, 43, 62, 0.18);
}

/* ============================================================
   Theme: Gotthardtunnel  (dunkel)
   ============================================================
   Anlehnung an den Gotthard-Basistunnel: dunkles Braun wie Fels
   und Beton, dazu ein kuehles Cyan als Komplementaerfarbe — die
   Farbe der Tunnelbeleuchtung und Signaltechnik.
   Kontraste geprueft (WCAG): Text 14.1:1, Sekundaertext 7.0:1,
   Akzent 8.2:1 — durchgehend AA, ueberwiegend AAA.
   ============================================================ */
[data-theme='gotthard'] {
  /* Schriftfarbe auf Akzentflaechen — muss zum Akzent passen. */
  --on-accent: #10242a;
  /* Helle Platte hinter Firmenlogos — viele Logos sind dunkle Zeichnungen
     auf transparentem Grund und brauchen einen hellen Untergrund. */
  --logo-plate: #f2ece6;
  --logo-plate-border: rgba(0, 0, 0, 0.30);
  --bg0: #17110d;
  --bg1: #1d1610;
  --surface: #241a13;
  --surface2: #2f2219;
  --surface3: #3b2c20;
  --border: rgba(79, 195, 217, 0.22);
  --border-soft: rgba(242, 232, 223, 0.09);
  --text: #f2e8df;
  --muted: #b09a86;
  --gold: #e0a83c;
  --danger: #ff6b5e;
  --ok: #5fd39a;
  --info: #7ab8e8;
  --accent: #4fc3d9;
  /* Lichtschein am Tunnelende, sonst Fels. */
  --bg: radial-gradient(900px 480px at 50% 0%, rgba(79, 195, 217, 0.07), transparent 64%) fixed,
        linear-gradient(180deg, #1a130e 0%, #120d09 100%) fixed;
  --glass: rgba(23, 17, 13, 0.86);
  --card: rgba(36, 26, 19, 0.94);
  --shadow: 0 12px 34px rgba(0, 0, 0, 0.62);
  --glow: 0 0 0 1px rgba(79, 195, 217, 0.30), 0 8px 26px rgba(79, 195, 217, 0.12);
  --scroll: #4a382a;
  /* Auf dem hellen Cyan braucht eigene Schrift einen dunklen Ton (7.8:1). */
  --chat-mine-text: #10242a;
  --hover: rgba(242, 232, 223, 0.07);
  --accent-bg: rgba(79, 195, 217, 0.13);
  --accent-hover: #6fd3e6;
  --success: #5fd39a;
}
[data-theme='gotthard'] .company-logo {
  background: rgba(242, 232, 223, 0.08);
  border: 1px solid rgba(242, 232, 223, 0.16);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5), 0 8px 22px rgba(0, 0, 0, 0.55);
}
[data-theme='gotthard'] .avatar, [data-theme='gotthard'] .ch-avatar {
  box-shadow: 0 0 0 2px rgba(242, 232, 223, 0.14), 0 2px 6px rgba(0, 0, 0, 0.55);
}


/* ---------- Scrollbars ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--scroll); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

.hidden { display: none !important; }
.hint { font-size: 0.82rem; color: var(--muted); margin-top: 8px; }
.link-btn { background: none; border: none; color: var(--accent); cursor: pointer; font-size: 0.85rem; padding: 0; }
.row { display: flex; align-items: center; gap: 12px; }
.row.gap { gap: 8px; }
.col { display: flex; flex-direction: column; gap: 8px; }
.empty-note { color: var(--muted); font-size: 0.9rem; text-align: center; padding: 18px 8px; }

.screen { min-height: 100vh; }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  background: var(--surface2);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); border-color: var(--border); background: var(--surface3); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), rgba(0, 0, 0, 0.25) 140%);
  border-color: transparent;
  color: #fff;
}
.btn-primary:hover { box-shadow: var(--glow); }

.btn-danger { background: rgba(239, 68, 68, 0.12); border-color: rgba(239, 68, 68, 0.45); color: var(--danger); }
.btn-danger:hover { background: rgba(239, 68, 68, 0.2); box-shadow: 0 8px 20px rgba(239, 68, 68, 0.18); }

.btn-icon {
  padding: 0;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--border-soft);
  background: var(--surface);
  color: var(--muted);
}
.btn-icon:hover { color: var(--accent); border-color: var(--accent); box-shadow: var(--glow); }
.btn-icon svg { width: 20px; height: 20px; }

.btn-sm { padding: 6px 12px; font-size: 0.82rem; border-radius: 10px; }
.btn-block { width: 100%; }
.btn-add {
  width: 100%;
  border: 1.5px dashed var(--border-soft);
  background: transparent;
  color: var(--muted);
  padding: 12px;
  font-size: 0.88rem;
}
/* Das Inline-SVG traegt viewBox="0 0 24 24", aber kein width/height. Ohne feste
   Groesse skaliert es auf die volle Containerbreite — das Plus fuellte dadurch
   die gesamte Spalte. Bestand schon in V1. */
.btn-add svg { width: 16px; height: 16px; flex: 0 0 auto; }
.btn-add:hover { color: var(--accent); border-color: var(--accent); background: rgba(255, 43, 43, 0.06); }

/* ============================================================
   Forms
   ============================================================ */
.field { margin-bottom: 16px; }
.f-label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--muted); margin-bottom: 6px; letter-spacing: 0.02em; }
input[type='text'], input[type='search'], input[type='password'], input[type='email'], input[type='color'],
textarea, select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.92rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: var(--glow); }
select { cursor: pointer; }
input[disabled] { opacity: 0.6; cursor: not-allowed; }

input[type='color'] { padding: 4px; height: 40px; width: 60px; cursor: pointer; }

.error { color: var(--danger); font-size: 0.85rem; margin-top: 8px; }
.pw-required {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: var(--danger);
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 0.88rem;
  margin-bottom: 14px;
}

input[type='range'] {
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 6px;
  background: var(--surface3);
  border: none;
  padding: 0;
}
input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--surface);
  box-shadow: 0 0 0 1px var(--accent), 0 2px 8px rgba(0, 0, 0, 0.3);
  cursor: pointer;
}

/* ============================================================
   Login
   ============================================================ */
#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: 24px;
  padding: 40px 36px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  text-align: center;
  animation: rise 0.4s ease;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
/* .login-logo und .login-card h1 sind entfallen: die Anmeldekarte traegt jetzt
   die inline eingebettete Wortmarke, der Schriftzug „Clu To-Do" darunter ist
   weggefallen. Die Regeln fuer .login-tag stehen weiter unten beim Rest der
   Wortmarken-Gestaltung. */
.login-card .field { text-align: start; }
.login-card .field label { font-size: 0.82rem; color: var(--muted); font-weight: 600; display: block; margin-bottom: 6px; }

/* ============================================================
   Topbar
   ============================================================ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 20px;
  background: var(--glass);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border-soft);
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
/* Fruehere Fassung war fuer ein <img> gedacht und legte einen roten Verlauf
   als Hintergrund darunter. Das neue Zeichen ist ein freigestelltes SVG —
   der Hintergrund haette es zu einem roten Block gemacht. */
.brand {
  width: 38px;
  height: 38px;
}

.tabs { display: flex; gap: 4px; margin: 0 auto; background: var(--surface); padding: 4px; border-radius: 14px; border: 1px solid var(--border-soft); }
.tab {
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 8px 18px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.tab:hover { color: var(--text); }
.tab.active { background: var(--accent); color: var(--on-accent); box-shadow: var(--glow); }

.topbar-right { display: flex; align-items: center; gap: 12px; margin-inline-start: auto; }

/* Topbar quick controls (Theme / Sprache / Schrift) */
.topbar-controls { display: flex; align-items: center; gap: 8px; }
.top-select {
  width: auto;
  padding: 7px 10px;
  font-size: 0.82rem;
  font-weight: 700;
  border-radius: 10px;
  cursor: pointer;
}
.font-ctrl {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 2px;
}
.font-ctrl .btn-icon { width: 30px; height: 30px; border: none; background: transparent; border-radius: 9px; font-size: 0.85rem; font-weight: 700; }
.font-val { min-width: 28px; text-align: center; font-size: 0.82rem; font-weight: 700; color: var(--muted); }

.user-chip { display: flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; background: var(--surface); border: 1px solid var(--border-soft); border-radius: 999px; }
.chip-name { font-weight: 600; font-size: 0.88rem; }

/* ---------- Bell / Notifications ---------- */
.bell-wrap { position: relative; }
.btn-bell svg { width: 22px; height: 22px; }
.notif-badge {
  position: absolute;
  top: -6px;
  inset-inline-end: -6px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ff4d4d, var(--accent));
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg1);
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
}
.notif-panel {
  position: absolute;
  top: calc(100% + 12px);
  inset-inline-end: 0;
  width: 360px;
  max-width: 86vw;
  background: var(--glass);
  backdrop-filter: blur(18px);
  border: 1px solid var(--border-soft);
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
  z-index: 100;
  animation: rise 0.2s ease;
}
.notif-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-soft);
  font-weight: 700;
}
.notif-list { max-height: 420px; overflow-y: auto; }
.notif-item {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background 0.15s ease;
  border-inline-start: 3px solid transparent;
}
.notif-item:hover { background: var(--surface2); }
.notif-item.unread { border-inline-start-color: var(--accent); background: rgba(255, 43, 43, 0.07); }
.notif-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface2);
  color: var(--accent);
}
.notif-icon svg { width: 18px; height: 18px; }
.notif-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; position: relative; }
.notif-text { font-size: 0.88rem; line-height: 1.35; }
.notif-meta { font-size: 0.74rem; color: var(--muted); }
.unread-dot {
  position: absolute;
  top: 2px;
  inset-inline-end: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent);
}

/* ============================================================
   Board
   ============================================================ */
main { padding: 24px; max-width: 1480px; margin: 0 auto; width: 100%; }

.board { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; align-items: start; }

.column {
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: 20px;
  padding: 14px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 220px;
}
.column-header { display: flex; align-items: center; justify-content: space-between; padding: 4px 8px 8px; border-bottom: 1px solid var(--border-soft); }
.column-header h3 { font-size: 0.95rem; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; }
.column:nth-child(1) .column-header h3 { color: var(--info); }
.column:nth-child(2) .column-header h3 { color: var(--gold); }
.column:nth-child(3) .column-header h3 { color: var(--ok); }
.count {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--surface2);
  color: var(--muted);
}
.column-body { display: flex; flex-direction: column; gap: 12px; min-height: 60px; }
.column-empty {
  border: 1.5px dashed var(--border-soft);
  border-radius: 14px;
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
  padding: 22px 10px;
}
.column-body.drag-over { outline: 2px dashed var(--accent); outline-offset: -6px; border-radius: 14px; background: rgba(255, 43, 43, 0.06); }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  padding: 14px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  position: relative;
  overflow: hidden;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border); }
.card::before {
  content: '';
  position: absolute;
  inset-inline-start: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--prio);
}
.card.prio-low { --prio: var(--ok); }
.card.prio-medium { --prio: var(--info); }
.card.prio-high { --prio: var(--danger); }
.card.prio-high { box-shadow: 0 4px 18px rgba(255, 77, 77, 0.15); }
.card.dragging { opacity: 0.5; transform: rotate(1.5deg) scale(0.98); }

.card-top { display: flex; align-items: center; margin-bottom: 8px; }
.badge {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 10px;
  border-radius: 999px;
}
.badge.prio-low { background: rgba(0, 224, 122, 0.14); color: var(--ok); }
.badge.prio-medium { background: rgba(77, 166, 255, 0.16); color: var(--info); }
.badge.prio-high { background: rgba(255, 77, 77, 0.16); color: var(--danger); }

.card-title { font-size: 0.98rem; font-weight: 700; line-height: 1.3; margin-bottom: 6px; }
.card-desc {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.4;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-meta { display: flex; gap: 12px; margin-bottom: 10px; }
.meta-icon { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 0.78rem; }
.meta-icon svg { width: 15px; height: 15px; }
.meta-icon em { font-style: normal; font-weight: 700; }
.card-footer { display: flex; align-items: center; }
.card-footer .avatar { margin-inline-end: -6px; box-shadow: 0 0 0 2px var(--surface); }

/* Admin-Übersicht: wer macht was */
.card.admin { background: linear-gradient(160deg, var(--surface), var(--surface2)); }
.card.admin .card-title { font-size: 1.02rem; }
.card-users { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 10px; }
.card-user { display: flex; align-items: center; gap: 8px; }
.card-user .avatar { box-shadow: 0 0 0 2px var(--surface); }
.card-user.none .cu-name { color: var(--muted); font-style: italic; }
.cu-text { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.cu-label { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); flex-shrink: 0; }
.cu-name { font-size: 0.86rem; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Avatars ---------- */
.avatar {
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  overflow: hidden;
  flex-shrink: 0;
  user-select: none;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-big { width: 128px; height: 128px; font-size: 52px; border-radius: 34px; box-shadow: var(--glow); }

/* ============================================================
   Settings & Users pages
   ============================================================ */
.page-title { font-size: 1.5rem; font-weight: 800; margin-bottom: 20px; }

.card {
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: 20px;
  padding: 22px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.card h2 { font-size: 1.02rem; font-weight: 800; margin-bottom: 16px; color: var(--gold); }

.profile-row { display: flex; align-items: center; gap: 18px; }

.theme-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(158px, 1fr)); gap: 12px; }
.theme-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.18s ease;
  background: var(--surface);
}
.theme-option:hover { border-color: var(--border); }
/* Fruehere Fassung toente den Hintergrund fest rot — im Jet-d'eau- und
   Gotthard-Theme wirkte das wie ein Fremdkoerper. Jetzt aus dem Akzent
   abgeleitet, damit die Markierung in jedem Theme stimmig ist. */
.theme-option.active,
.theme-option:has(input:checked) {
  border-color: var(--accent);
  box-shadow: var(--glow);
  background: color-mix(in srgb, var(--accent) 9%, transparent);
}
.theme-option input { accent-color: var(--accent); }

.accent-options { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.swatch {
  --sw: var(--accent);
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--sw);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
  border: 2px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.swatch:hover { transform: scale(1.08); }
.swatch.active { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); transform: scale(1.05); }
.swatch input { position: absolute; opacity: 0; }
.swatch-label { color: var(--muted); font-size: 0.7rem; font-weight: 700; background: var(--surface); padding: 2px 6px; border-radius: 6px; }

.accent-custom { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.accent-custom .f-label { margin: 0; }

.font-slider { display: flex; align-items: center; gap: 14px; }
.font-slider input[type='range'] { flex: 1; }
.font-min { font-size: 0.75rem; color: var(--muted); }

.switch { position: relative; display: inline-block; width: 48px; height: 26px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute;
  inset: 0;
  background: var(--surface3);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s ease;
}
.switch .slider::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s ease;
}
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(22px); }

/* ---------- Admin / Users ---------- */
.add-user { display: flex; gap: 10px; margin-bottom: 8px; }
.add-user input { flex: 1; }
.add-user select { width: auto; }
.add-company { display: flex; margin-bottom: 8px; }

.user-table { width: 100%; border-collapse: collapse; margin-top: 12px; }
.user-table th {
  text-align: start;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding: 10px 8px;
  border-bottom: 1px solid var(--border-soft);
}
.user-table td { padding: 12px 8px; border-bottom: 1px solid var(--border-soft); font-size: 0.9rem; }
.user-cell { display: flex; align-items: center; gap: 10px; }
.role-pill {
  font-size: 0.74rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.role-pill.admin { background: linear-gradient(135deg, var(--accent), #7a0d0d); color: #fff; }
.role-pill.user { background: var(--surface3); color: var(--muted); }
.role-pill.supermod { background: linear-gradient(135deg, #6a4c93, #3b82f6); color: #fff; }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-inline-end: 7px; }
.status-dot.active { background: var(--ok); box-shadow: 0 0 6px var(--ok); }
.status-dot.inactive { background: var(--muted); }

/* ============================================================
   Modal
   ============================================================ */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 4, 4, 0.65);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 200;
  animation: fade 0.2s ease;
}
.modal {
  width: 100%;
  max-width: 620px;
  max-height: 88vh;
  overflow-y: auto;
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: 22px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
  padding: 24px;
  animation: rise 0.25s ease;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.modal-head h3 { font-size: 1.15rem; font-weight: 800; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.modal-actions.spread { justify-content: space-between; }

/* Task modal tabs */
.tm-tabs { display: flex; gap: 4px; background: var(--surface); padding: 4px; border-radius: 14px; margin-bottom: 18px; border: 1px solid var(--border-soft); }
.tm-tab {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: var(--font);
  font-size: 0.86rem;
  font-weight: 700;
  padding: 9px 10px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.18s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.tm-tab em { font-style: normal; font-size: 0.72rem; background: var(--surface3); padding: 1px 8px; border-radius: 999px; }
.tm-tab.active { background: var(--accent); color: var(--on-accent); box-shadow: var(--glow); }
.tm-tab.active em { background: rgba(255, 255, 255, 0.25); }
.tm-tab.hidden { display: none; }

.prio-options { display: flex; gap: 10px; }
.prio-option {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  cursor: pointer;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--muted);
  transition: all 0.15s ease;
  background: var(--surface);
}
.prio-option:hover { border-color: var(--border); }
.prio-option.low input { accent-color: var(--ok); }
.prio-option.medium input { accent-color: var(--info); }
.prio-option.high input { accent-color: var(--danger); }
.prio-option:has(input:checked).low { border-color: var(--ok); color: var(--ok); background: rgba(0, 224, 122, 0.1); }
.prio-option:has(input:checked).medium { border-color: var(--info); color: var(--info); background: rgba(77, 166, 255, 0.1); }
.prio-option:has(input:checked).high { border-color: var(--danger); color: var(--danger); background: rgba(255, 77, 77, 0.1); }

/* ============================================================
   Chat (task messages)
   ============================================================ */
.chat { display: flex; flex-direction: column; gap: 12px; }
.chat-list {
  max-height: 320px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-inline-end: 4px;
}
.chat-item { display: flex; gap: 10px; align-items: flex-start; }
.chat-item.mine { flex-direction: row-reverse; }
.chat-body { display: flex; flex-direction: column; max-width: 78%; }
.chat-meta { display: flex; align-items: baseline; gap: 8px; margin-bottom: 3px; }
.chat-item.mine .chat-meta { flex-direction: row-reverse; }
.chat-meta strong { font-size: 0.82rem; color: var(--text); }
.chat-meta span { font-size: 0.72rem; color: var(--muted); }
.msg-del-btn { background: none; border: none; cursor: pointer; color: var(--muted); font-size: 0.75rem; padding: 2px; opacity: 0.6; transition: opacity 0.2s; }
.msg-del-btn svg { width: 14px; height: 14px; display: block; }
.chat-item:hover .msg-del-btn, .msg-del-btn:focus-visible { opacity: 1; }
.msg-del-btn:hover { color: var(--danger, #e53e3e); opacity: 1; }
@media (hover: none) { .msg-del-btn { opacity: 1; } }
.msg-edited { font-size: 0.7rem; color: var(--muted, #888); font-style: italic; }
.chat-bubble {
  background: var(--surface2);
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  border-top-left-radius: 4px;
  padding: 9px 13px;
  font-size: 0.88rem;
  line-height: 1.4;
  word-break: break-word;
  /* V6: Zeilenumbrueche aus der Eingabe (Umschalt+Enter) erhalten. Ohne das
     fasste der Browser jeden Umbruch zu einem Leerzeichen zusammen. */
  white-space: pre-wrap;
  color: var(--text);
}
.chat-item.mine .chat-bubble {
  background: linear-gradient(135deg, var(--accent), rgba(0, 0, 0, 0.28) 150%);
  color: var(--chat-mine-text);
  border-color: transparent;
  border-top-left-radius: 14px;
  border-top-right-radius: 4px;
}
.chat-input { display: flex; gap: 10px; align-items: flex-end; }
.chat-input textarea {
  flex: 1;
  resize: none;
  min-height: 36px;
  max-height: 150px;
  padding: 7px 10px;
  border: 1px solid var(--border-soft, rgba(0,0,0,.12));
  border-radius: 8px;
  background: var(--card, #fff);
  color: var(--text, #1a1a2e);
  font-family: inherit;
  font-size: inherit;
  line-height: 1.4;
  overflow-y: auto;
}
.chat-input textarea:focus { outline: none; border-color: var(--accent); }

/* ============================================================
   Attachments
   ============================================================ */
.att { display: flex; flex-direction: column; gap: 14px; }
.att-actions { display: flex; }
.att-list { display: flex; flex-direction: column; gap: 10px; max-height: 320px; overflow-y: auto; }
.att-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 14px;
}
.att-icon {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--surface2);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.att-icon svg { width: 20px; height: 20px; }
.att-icon img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; }
.att-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.att-name { font-size: 0.9rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-sub { font-size: 0.76rem; color: var(--muted); }
.att-actions2 { display: flex; gap: 6px; }

/* ============================================================
   Toast
   ============================================================ */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--glass);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-soft);
  border-inline-start: 4px solid var(--ok);
  color: var(--text);
  padding: 13px 22px;
  border-radius: 14px;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: var(--shadow);
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.success { border-inline-start-color: var(--ok); }
.toast.error { border-inline-start-color: var(--danger); }
.toast.info { border-inline-start-color: var(--info); }

/* ---------- Globaler Upload-Fortschrittsbalken ---------- */
.upload-progress {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  width: min(420px, 90vw);
  background: var(--glass);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  padding: 12px 16px;
  box-shadow: var(--shadow);
  z-index: 310;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.upload-progress-text {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.upload-progress-track {
  height: 8px;
  border-radius: 999px;
  background: var(--border-soft);
  overflow: hidden;
}
.upload-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--info), var(--ok));
  transition: width .15s ease;
}

/* ---------- Undo-Leiste (Aufgabe fertig -> Rückgängig) ---------- */
.undo-bar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--glass);
  backdrop-filter: blur(16px);
  border: 1px solid var(--accent);
  border-inline-start: 4px solid var(--accent);
  color: var(--text);
  padding: 10px 12px 10px 16px;
  border-radius: 14px;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: var(--shadow), var(--glow);
  z-index: 320;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  max-width: 94vw;
}
.undo-bar.show { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }
.undo-icon { display: inline-flex; color: var(--ok); }
.undo-icon svg { width: 20px; height: 20px; }
.undo-msg { line-height: 1.3; }
.undo-count {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--accent);
  background: rgba(255, 43, 43, 0.1);
  border-radius: 999px;
  padding: 3px 9px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   View-Toolbar / Unternehmen / Archiv
   ============================================================ */
.view-toolbar { display: flex; align-items: center; gap: 18px; margin-bottom: 18px; flex-wrap: wrap; }
.board-search-group { flex: 1; min-width: 200px; }
.board-search-group input[type='search'] { width: 100%; }
.board-search-empty { text-align: center; padding: 32px; color: var(--muted); font-size: 0.95rem; }
.toolbar-group { display: flex; align-items: center; gap: 10px; }
.f-label.inline { margin: 0; }
.toolbar-group select { width: auto; min-width: 200px; }
.check-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}
.check-label input { accent-color: var(--accent); width: 16px; height: 16px; cursor: pointer; }

.static-value {
  padding: 10px 14px;
  border: 1px dashed var(--border-soft);
  border-radius: 12px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.92rem;
}
.company-checks { display: flex; flex-wrap: wrap; gap: 28px; }
/* V6: Kachel + Rollenauswahl als eine Einheit. Die Auswahl sitzt direkt
   unter ihrer Kachel und ist genauso breit. */
.um-company-item { display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.um-company-role-wrap {
  flex-direction: column;
  gap: 4px;
  padding: 0 4px;
}
.um-role-label { font-size: 11px; color: var(--muted); font-weight: 600; letter-spacing: .03em; text-transform: uppercase; }
/* Vorher background: var(--bg) — das ist in mehreren Themes ein Farbverlauf.
   Die ausgeklappte Liste fiel dann auf Weiss zurueck, die Schrift blieb hell
   und war nicht mehr lesbar. Jetzt eine deckende Flaechenfarbe. */
.um-company-role {
  width: 100%;
  font-size: 13px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background-color: var(--surface);
  color: var(--text);
}

.company-box {
  position: relative;
  display: inline-flex;
  cursor: pointer;
  user-select: none;
}
.company-box input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}
.company-box-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: 180px;
  padding: 18px 14px;
  background: var(--card);
  border: 2px solid var(--border-soft);
  border-radius: 18px;
  transition: all 0.15s ease;
  box-shadow: var(--shadow);
}
.company-box:hover .company-box-inner { border-color: var(--border); }
.company-box:has(input:checked) .company-box-inner {
  border-color: var(--ccolor);
  background: color-mix(in srgb, var(--ccolor) 10%, var(--card));
  box-shadow: 0 0 0 1px var(--ccolor);
}
.company-box-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  text-align: center;
  line-height: 1.3;
  min-height: 2.6em;
  display: flex;
  align-items: center;
  justify-content: center;
}
.company-add-tile {
  background: transparent;
  border: none;
  font-family: var(--font);
  color: var(--muted);
  cursor: pointer;
}
.company-add-inner {
  border: 2px dashed var(--border-soft);
  background: transparent;
  box-shadow: none;
  color: var(--muted);
  gap: 12px;
  min-height: 100%;
}
.company-add-tile:hover .company-add-inner,
.company-add-tile:focus-visible .company-add-inner {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(255, 43, 43, 0.06);
  box-shadow: var(--glow);
}
.company-add-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}
.company-add-icon svg { width: 34px; height: 34px; }
.company-add-tile .company-box-name { color: inherit; }
.company-logo,
.company-logo-ph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  overflow: hidden;
  flex-shrink: 0;
}
.company-logo { padding: 8px; }
.company-logo img { width: 100%; height: 100%; object-fit: contain; }
.company-logo-ph {
  color: #fff;
  font-weight: 800;
  border: 1px solid rgba(255, 255, 255, 0.3);
}
.company-logo.logo-missing { display: none; }
.ov-company > .company-logo,
.ov-company > .company-logo-ph { align-self: center; margin-top: 4px; }

/* Logo-Sichtbarkeit: helle Platte + Umrandung je nach Theme */
[data-theme='dark'] .company-logo {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.55), 0 8px 22px rgba(0, 0, 0, 0.55);
}
[data-theme='light'] .company-logo {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 3px 10px rgba(80, 30, 30, 0.12);
}
[data-theme='colorful'] .company-logo {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.45), 0 8px 22px rgba(0, 0, 0, 0.5);
}

[data-theme='dark'] .avatar, [data-theme='dark'] .ch-avatar {
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.12), 0 2px 6px rgba(0, 0, 0, 0.5);
}
[data-theme='light'] .avatar, [data-theme='light'] .ch-avatar {
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.9), 0 2px 6px rgba(0, 0, 0, 0.12);
}
[data-theme='colorful'] .avatar, [data-theme='colorful'] .ch-avatar {
  box-shadow: 0 0 0 2px rgba(179, 91, 255, 0.25), 0 2px 6px rgba(0, 0, 0, 0.5);
}
.companies-cell { font-size: 0.82rem; color: var(--muted); max-width: 260px; }

/* ---------- Moderatorrechte (Benutzerverwaltung) ---------- */
.rights-block { margin-top: 4px; }
.rights-intro { margin: -2px 0 10px; }
.moderator-rights-field {
  margin-top: 14px;
  padding-top: 16px;
  border-top: 1px solid var(--border-soft);
}
.moderator-company-rights {
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  background: var(--surface);
}
.moderator-company-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-soft);
}
.moderator-company-head .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--ccolor, var(--muted));
  flex: none;
}
.moderator-company-head strong {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text);
}
.rights-mode {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 10px 0 14px;
}
.rights-mode-option {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 10px;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  background: var(--surface);
  cursor: pointer;
}
.rights-mode-option:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.rights-mode-option.extended:has(input:checked) { border-color: #b35bff; box-shadow: 0 0 0 1px #b35bff; }
.rights-mode-option input { margin-top: 2px; accent-color: var(--accent); }
.rights-mode-option span { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.rights-mode-option strong { font-size: 0.88rem; color: var(--text); }
.rights-mode-option.extended strong { color: #b35bff; }
.rights-mode-option small { color: var(--muted); font-size: 0.75rem; line-height: 1.35; }
.rights-block .right-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--border-soft);
}
.rights-block .right-item:last-child { border-bottom: 0; }
.rights-block .right-item .check-label { color: var(--text); font-size: 0.9rem; }
.rights-block .right-item .hint { margin: 0 0 0 23px; }
.rights-block .right-item.extended {
  background: rgba(179, 91, 255, 0.07);
  border: 1px solid rgba(179, 91, 255, 0.25);
  border-bottom: 1px solid rgba(179, 91, 255, 0.25);
  border-radius: 10px;
  padding: 8px 10px;
  margin-top: 6px;
}
.rights-block .right-item.extended .check-label { color: #b35bff; }
.rights-block .right-item.readonly .check-label { cursor: default; }
.rights-block .right-item.readonly input { cursor: default; }
.right-state { font-size: 0.78rem; }
.right-state.active { color: var(--ok); }
.right-state.inactive { color: var(--muted); }
.extended-rights-info {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(179, 91, 255, 0.25);
  border-radius: 10px;
  background: rgba(179, 91, 255, 0.07);
}
.extended-rights-info p { margin: 0; font-size: 0.76rem; line-height: 1.45; color: var(--muted); }
.extended-rights-info p + p { margin-top: 6px; }
.extended-rights-info strong { color: var(--text); }

/* ---------- Firmenverwaltung ---------- */
.company-admin-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-soft);
}
.company-admin-item:last-child { border-bottom: 0; }
.company-admin-item.inactive { opacity: 0.65; }
.company-admin-logo { flex: 0 0 auto; }
.company-admin-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.company-admin-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: var(--text);
}
.company-admin-name i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ccolor, #64748b);
  flex: 0 0 auto;
}
.company-admin-meta { font-size: 0.76rem; color: var(--muted); }
.company-admin-desc {
  font-size: 0.8rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.company-admin-actions { display: flex; gap: 8px; flex: 0 0 auto; }
#company-admin-card .hint { margin-bottom: 18px; }
.company-logo-ctrl { align-items: center; }
#cm-logo-preview { display: flex; align-items: center; }

/* ---------- Unternehmens-Tag ---------- */
.company-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px 2px 6px;
  border-radius: 999px;
  color: var(--ccolor);
  background: rgba(128, 128, 128, 0.12);
  background: color-mix(in srgb, var(--ccolor) 12%, transparent);
  border: 1px solid rgba(128, 128, 128, 0.25);
  border: 1px solid color-mix(in srgb, var(--ccolor) 30%, transparent);
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.company-tag i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ccolor);
  flex-shrink: 0;
  box-shadow: 0 0 6px var(--ccolor);
}

/* ---------- Fälligkeit ---------- */
.due { display: inline-flex; align-items: center; gap: 5px; font-size: 0.76rem; font-weight: 700; color: var(--muted); }
.due svg { width: 14px; height: 14px; }
.due em { font-style: normal; }
.due-overdue { color: var(--danger); }
.due-done { color: var(--ok); text-decoration: line-through; }

.badge.archived-badge { background: var(--surface3); color: var(--muted); }
.card.archived { opacity: 0.62; }
.card.archived .card-title { text-decoration: line-through; }

/* ============================================================
   Segmented Control
   ============================================================ */
.seg { display: inline-flex; gap: 2px; background: var(--surface); border: 1px solid var(--border-soft); padding: 3px; border-radius: 12px; }
.seg-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 7px 14px;
  border-radius: 9px;
  cursor: pointer;
  transition: all 0.18s ease;
}
.seg-btn:hover { color: var(--text); }
.seg-btn.active { background: var(--accent); color: var(--on-accent); box-shadow: var(--glow); }
.seg-btn.hidden { display: none; }

/* ============================================================
   Kalender
   ============================================================ */
#calendar-grid.card, .ov-toolbar-card { cursor: default; }
.cal-day-jump { width: auto; min-width: 96px; }
.cal { display: grid; }
.cal-month { grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-dow {
  font-size: 0.72rem;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--muted);
  padding: 4px 6px;
  text-align: end;
}
.cal-cell {
  min-height: 96px;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 6px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.cal-cell:hover { border-color: var(--border); background: var(--surface2); }
.cal-cell.out { opacity: 0.45; }
.cal-cell.today { box-shadow: 0 0 0 1px var(--accent) inset; background: rgba(255, 43, 43, 0.05); }
.cal-daynum {
  border: 0;
  background: transparent;
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--muted);
  text-align: end;
  cursor: pointer;
  border-radius: 8px;
  padding: 2px 5px;
  align-self: flex-end;
  line-height: 1.2;
  transition: color 0.15s ease, background 0.15s ease;
}
.cal-daynum:hover { color: var(--text); background: var(--surface3); }
.cal-cell.today .cal-daynum { color: var(--accent); }
.cal-tasks { display: flex; flex-direction: column; gap: 3px; overflow: hidden; }
.cal-more { font-size: 0.68rem; color: var(--muted); font-weight: 700; }

.cal-task {
  border: 1px solid var(--border-soft);
  background: var(--surface2);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.74rem;
  font-weight: 600;
  text-align: start;
  padding: 4px 8px;
  border-radius: 8px;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: transform 0.12s ease, border-color 0.2s ease;
}
.cal-task:hover { transform: translateY(-1px); border-color: var(--accent); }
.cal-task.done { text-decoration: line-through; opacity: 0.7; }
.cal-task.archived { opacity: 0.5; }
.cal-task.prio-low { border-inline-start: 3px solid var(--ok); }
.cal-task.prio-medium { border-inline-start: 3px solid var(--info); }
.cal-task.prio-high { border-inline-start: 3px solid var(--danger); }

.cal-entry {
  border: 1px solid color-mix(in srgb, var(--ecolor) 55%, var(--border-soft));
  background: color-mix(in srgb, var(--ecolor) 16%, var(--surface2));
  color: var(--text);
  font-family: var(--font);
  font-size: 0.74rem;
  font-weight: 700;
  text-align: start;
  padding: 4px 8px 4px 6px;
  border-radius: 8px;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: transform 0.12s ease, filter 0.2s ease;
}
.cal-entry:hover { transform: translateY(-1px); filter: brightness(1.12); }
.cal-entry i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ecolor);
  box-shadow: 0 0 6px var(--ecolor);
  flex-shrink: 0;
}
.cal-entry b { color: var(--ecolor); font-weight: 800; flex-shrink: 0; }
.cal-entry.rec { border-style: dashed; }
.cal-entry.invited i { box-shadow: 0 0 0 0 var(--ecolor); animation: cal-inv-pulse 1.6s infinite; }
.cal-entry em {
  margin-inline-start: auto;
  flex-shrink: 0;
  font-style: normal;
  font-weight: 600;
  font-size: 0.62rem;
  padding: 1px 5px;
  border-radius: 5px;
  background: color-mix(in srgb, var(--ecolor) 22%, transparent);
  color: color-mix(in srgb, var(--ecolor) 65%, var(--text));
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 90px;
  white-space: nowrap;
}
@keyframes cal-inv-pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ecolor) 70%, transparent); }
  70% { box-shadow: 0 0 0 7px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* Klick-Aktion: Neues Element (Aufgabe / Termin) */
.day-add-date { font-weight: 700; color: var(--muted); margin: 2px 0 14px; }
.day-add-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.day-add-opt {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 22px 12px;
  background: var(--card);
  border: 2px solid var(--border-soft);
  border-radius: 16px;
  cursor: pointer;
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text);
  transition: all 0.15s ease;
}
.day-add-opt svg { width: 30px; height: 30px; color: var(--accent); }
.day-add-opt:hover { border-color: var(--accent); box-shadow: var(--glow); transform: translateY(-1px); }
@media (max-width: 720px) { .day-add-grid { grid-template-columns: 1fr; } }

/* Termin-Modal */
.ce-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 720px) { .ce-grid-2 { grid-template-columns: 1fr; } }
.ce-colors { display: flex; flex-wrap: wrap; gap: 10px; }
.ce-color { position: relative; cursor: pointer; }
.ce-color input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}
.ce-color i {
  display: inline-block;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid var(--border-soft);
  transition: transform 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}
.ce-color:hover i { transform: scale(1.1); }
.ce-color:has(input:checked) i {
  border-color: var(--text);
  box-shadow: 0 0 0 2px var(--accent);
  transform: scale(1.12);
}
.ce-color i.ce-auto {
  background: conic-gradient(#ff2b2b, #ffb347, #00e07a, #4da6ff, #8a5cf6, #ff2b2b);
  position: relative;
}
.ce-color i.ce-auto::after {
  content: '';
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background: var(--surface);
}

/* Serien-Wiederholung & Einladungen im Termin-/Aufgaben-Modal */
.ce-rec { margin-top: 2px; }
.ce-rec.locked, .tm-rec.locked { opacity: 0.55; pointer-events: none; }
.tm-next-dates { margin-top: 10px; padding: 8px 12px; border-radius: 8px; background: var(--card, #f9f9fb); border: 1px solid var(--border-soft, rgba(0,0,0,.08)); }
.tm-next-label { font-size: .82em; font-weight: 600; margin-bottom: 6px; opacity: .85; }
.tm-next-row { display: flex; gap: 10px; align-items: center; font-size: .85em; padding: 3px 0; }
.tm-next-idx { font-weight: 700; color: var(--accent, #4da6ff); min-width: 28px; }
.tm-next-due { font-weight: 500; }
.tm-next-planned { opacity: .65; font-size: .92em; }
.ce-invite-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.ce-invite {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 600;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.ce-invite:hover { border-color: var(--accent); }
.ce-invite.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--surface)); }
.ce-invite input { accent-color: var(--accent); }
.ce-respond {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 12px;
  margin-bottom: 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border-soft));
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  border-radius: 12px;
  font-size: 0.84rem;
  font-weight: 700;
}
.ce-respond span { flex: 1; }

.cal-week { grid-template-columns: repeat(7, 1fr); gap: 8px; }
.cal-weekcol { border: 1px solid var(--border-soft); border-radius: 12px; background: var(--surface); min-height: 200px; padding: 8px; }
.cal-weekcol.today { box-shadow: 0 0 0 1px var(--accent) inset; }
.cal-weekhead {
  border: 0;
  background: transparent;
  width: 100%;
  font-family: var(--font);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin-bottom: 6px;
  padding: 4px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.cal-weekhead:hover { background: var(--surface3); color: var(--text); }
.cal-weekhead em { font-style: normal; font-size: 1.1rem; color: var(--text); }
.cal-weekcol.today .cal-weekhead { color: var(--accent); }
.cal-weekcol.today .cal-weekhead em { color: var(--accent); }
.cal-weektasks { display: flex; flex-direction: column; gap: 4px; }
.cal-empty { min-height: 40px; display: block; }

.cal-day { display: flex; flex-direction: column; gap: 10px; }
.cal-dayhead { font-size: 1.05rem; font-weight: 800; }
.cal-daytasks { display: flex; flex-direction: column; gap: 8px; max-width: 640px; }
.cal-empty-note { color: var(--muted); font-size: 0.9rem; }

.cal-nav { display: flex; align-items: center; gap: 8px; margin-inline-start: auto; }
.cal-title { font-weight: 800; font-size: 1.05rem; min-width: 150px; text-align: center; text-transform: capitalize; }

/* ============================================================
   Gesamtübersicht (Admin)
   ============================================================ */
.overview-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin-bottom: 18px; }
.ov-card {
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
  box-shadow: var(--shadow);
}
.ov-card:hover { transform: translateY(-2px); box-shadow: var(--glow); }
.ov-card-n { font-size: 1.6rem; font-weight: 800; }
.ov-card-l { font-size: 0.74rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.ov-card.st-todo .ov-card-n { color: var(--info); }
.ov-card.st-progress .ov-card-n { color: var(--gold); }
.ov-card.st-done .ov-card-n { color: var(--ok); }
.ov-card.st-high .ov-card-n { color: var(--danger); }
.ov-card.st-medium .ov-card-n { color: var(--info); }
.ov-card.st-low .ov-card-n { color: var(--ok); }
.ov-card.st-overdue .ov-card-n { color: var(--danger); }
.ov-card.st-duetoday .ov-card-n { color: var(--gold); }

.ov-sub { font-size: 0.95rem; font-weight: 800; color: var(--gold); margin: 8px 0 12px; }
.ov-company-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 24px; margin-bottom: 20px; }
.ov-company {
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: start;
  padding: 18px;
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: 18px;
  cursor: pointer;
  font-family: var(--font);
  color: var(--text);
  transition: all 0.15s ease;
  box-shadow: var(--shadow);
}
.ov-company:hover { transform: translateY(-1px); border-color: var(--border); }
.ov-company-name { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.0rem; }
.ov-company-name i { width: 9px; height: 9px; border-radius: 50%; background: var(--ccolor); box-shadow: 0 0 6px var(--ccolor); flex-shrink: 0; }
.ov-company-nums { font-size: 0.78rem; color: var(--muted); font-weight: 700; }
.ov-company-bar { height: 6px; border-radius: 6px; background: var(--surface3); overflow: hidden; }
.ov-company-bar span { display: block; height: 100%; background: var(--ccolor); border-radius: 6px; }

.ov-assignees { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.ov-assignee {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 6px;
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  cursor: pointer;
  font-family: var(--font);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.15s ease;
}
.ov-assignee:hover { border-color: var(--accent); }
.ov-assignee em { font-style: normal; font-weight: 800; color: var(--muted); }

.ov-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.ov-toolbar select { width: auto; }
.ov-toolbar input[type='search'] { flex: 1; min-width: 160px; }
.ov-toolbar-2 { margin-top: 12px; }
.ov-cols { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.ov-saved { display: flex; gap: 6px; align-items: center; }
.ov-saved select { width: auto; max-width: 180px; }

.ov-table { width: 100%; border-collapse: collapse; }
.ov-table th { text-align: start; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); padding: 8px; border-bottom: 1px solid var(--border-soft); }
.ov-table td { padding: 10px 8px; border-bottom: 1px solid var(--border-soft); font-size: 0.88rem; }
.ov-row { cursor: pointer; transition: background 0.12s ease; }
.ov-row:hover { background: var(--surface2); }
.ov-row.archived { opacity: 0.55; }
.ov-title { font-weight: 600; }
.ov-title-text { margin-inline-start: 6px; }
.ov-sort { border: none; background: none; color: var(--muted); font-family: var(--font); font-size: inherit; font-weight: inherit; text-transform: inherit; letter-spacing: inherit; cursor: pointer; padding: 0; }
.ov-sort:hover { color: var(--text); }
.ov-sort.active { color: var(--accent); }

.pill { font-size: 0.7rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; text-transform: uppercase; letter-spacing: 0.04em; }
.pill-todo { background: rgba(77, 166, 255, 0.16); color: var(--info); }
.pill-progress { background: rgba(255, 179, 71, 0.16); color: var(--gold); }
.pill-done { background: rgba(0, 224, 122, 0.14); color: var(--ok); }

.ov-group { margin-bottom: 14px; }
.ov-group-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--surface2); border-radius: 12px; margin-bottom: 8px; }
.ov-group-head strong { font-size: 0.9rem; }
.ov-group-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: start;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  cursor: pointer;
  font-family: var(--font);
  color: var(--text);
  font-size: 0.88rem;
  margin-bottom: 6px;
  transition: border-color 0.15s ease;
}
.ov-group-row:hover { border-color: var(--accent); }
.ov-group-row.archived { opacity: 0.55; }
.ov-group-row em { margin-inline-start: auto; font-style: normal; font-size: 0.76rem; color: var(--muted); font-weight: 600; }

.ov-pagination { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 16px; }
.ov-pageinfo { font-size: 0.82rem; color: var(--muted); font-weight: 700; }
.ov-board .column-body { min-height: 120px; }

.role-pill.moderator { background: rgba(179, 91, 255, 0.18); color: #b35bff; }
.field.half { flex: 1; min-width: 0; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 980px) {
  .board { grid-template-columns: 1fr; }
  .topbar { flex-wrap: wrap; gap: 10px; }
  .tabs { order: 3; width: 100%; margin: 0; }
  .tab { flex: 1; }
  main { padding: 16px; }
}
@media (max-width: 720px) {
  .rights-mode { grid-template-columns: 1fr; }
  .topbar-right { gap: 6px; }
  .topbar-controls { gap: 4px; }
  .chip-name { display: none; }
  .brand-name { display: none; }
  .notif-panel { width: 92vw; }
  .cal-month { gap: 3px; }
  .cal-cell { min-height: 58px; padding: 3px; }
  .cal-daynum { font-size: 0.7rem; }
  .cal-nav { margin-inline-start: 0; width: 100%; justify-content: space-between; }
  .cal-title { min-width: 0; }
  .overview-cards { grid-template-columns: repeat(3, 1fr); }
  .cal-week { grid-template-columns: 1fr; }
  .cal-weekcol { min-height: 0; }
  .company-checks { gap: 16px; }
  .company-box-inner { width: 150px; padding: 14px 10px; }
  .ov-company-grid { gap: 16px; }
}

/* ============================================================
   Firmenflaechen: Theme-treu statt fest weiss
   ------------------------------------------------------------
   Vorher waren diese Flaechen in JEDEM Theme #ffffff mit fest
   verdrahteter dunkler Schrift. Im dunklen Theme standen sie
   dadurch als grelle Bloecke im Layout.
   Jetzt folgt die Karte dem Theme; hell bleibt nur die Platte
   direkt hinter dem Logo — viele Firmenlogos sind dunkle
   Zeichnungen auf transparentem Grund und waeren sonst
   unsichtbar. Die Plattenfarbe kommt aus --logo-plate und ist
   pro Theme abgestimmt.
   ============================================================ */
.company-box-inner:not(.company-add-inner),
.ov-company,
.company-admin-item {
  background: var(--card);
  border-color: var(--border-soft);
}
.company-box-inner:not(.company-add-inner) {
  box-shadow: var(--shadow, 0 6px 18px rgba(0, 0, 0, 0.18));
}
.company-box:hover .company-box-inner:not(.company-add-inner) {
  border-color: var(--border);
}
.company-box:has(input:checked) .company-box-inner:not(.company-add-inner) {
  background: color-mix(in srgb, var(--ccolor) 12%, var(--card));
  border-color: var(--ccolor);
  box-shadow: 0 0 0 1px var(--ccolor);
}

.company-box-name,
.ov-company-name,
.company-admin-name {
  color: var(--text);
}
.ov-company-nums,
.company-admin-meta,
.company-admin-desc {
  color: var(--muted);
}
.ov-company-bar {
  background: color-mix(in srgb, var(--text) 14%, transparent);
}

/* Logo-Platte: bewusst hell, damit dunkle Logos lesbar bleiben.
   Der Rahmen setzt sie sichtbar vom Kartenhintergrund ab. */
.ov-company .company-logo,
.ov-company .company-logo-ph,
.company-box-inner:not(.company-add-inner) .company-logo,
.company-box-inner:not(.company-add-inner) .company-logo-ph,
.company-admin-item .company-logo,
.company-admin-item .company-logo-ph {
  background: var(--logo-plate, #ffffff);
  border: 1px solid var(--logo-plate-border, rgba(0, 0, 0, 0.12));
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
}

/* Firmenverwaltung: jeder Eintrag als eigene Flaeche */
.company-admin-item {
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 10px;
}
.company-admin-item:last-child { margin-bottom: 0; }
.company-admin-item.inactive { opacity: 0.65; }

/* Add-Kachel (Firma hinzufügen) unverändert lassen */
.company-add-inner {
  background: transparent;
  border: 2px dashed var(--border-soft);
  box-shadow: none;
  color: var(--muted);
}
.company-add-tile:hover .company-add-inner,
.company-add-tile:focus-visible .company-add-inner {
  background: rgba(255, 43, 43, 0.06);
  color: var(--accent);
}

/* ============================================================
   V2 — Mehrfach-Zuweisung
   ============================================================ */

/* Auswahlliste im Aufgaben-Dialog */
.assignee-picker {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 168px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  background: var(--surface2);
}
.assignee-opt {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 8px;
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.assignee-opt:hover { background: var(--surface3); }
.assignee-opt.on { background: rgba(255, 43, 43, 0.08); }
.assignee-opt.locked { opacity: 0.55; cursor: not-allowed; }
.assignee-opt input { width: 15px; height: 15px; accent-color: var(--accent); flex: 0 0 auto; }
.assignee-name { font-size: 0.88rem; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.assignee-hint { font-size: 0.82rem; color: var(--muted); padding: 6px 8px; }

/* Gestapelte Avatare auf der Karte */
.avatar-stack { display: inline-flex; align-items: center; }
.avatar-stack > * { margin-inline-start: -7px; box-shadow: 0 0 0 2px var(--card); border-radius: 50%; }
.avatar-stack > *:first-child { margin-inline-start: 0; }
.avatar-more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  font-size: 0.66rem;
  font-weight: 700;
  color: var(--text);
  background: var(--surface3);
}

/* ============================================================
   V2 — Auto-Logout-Warnung
   ============================================================ */
.al-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(3px);
}
.al-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 26px 28px;
  max-width: 420px;
  width: calc(100% - 40px);
  text-align: center;
}
.al-box h3 { font-size: 1.05rem; color: var(--text); margin-bottom: 8px; }
.al-box p { font-size: 0.88rem; color: var(--muted); }
.al-count { margin: 14px 0 18px; font-size: 1.7rem; font-weight: 700; color: var(--accent); }
.al-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ===== Audit-Log ===== */
.audit-toolbar { display: flex; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.audit-toolbar select {
  padding: 5px 8px;
  border: 1px solid var(--border-soft, rgba(0,0,0,.12));
  border-radius: 6px;
  background: var(--card, #fff);
  color: var(--text, #1a1a2e);
  font-size: 0.85rem;
}
.audit-total { font-size: 0.82rem; color: var(--muted, #888); margin-bottom: 8px; }
.audit-list { max-height: 500px; overflow-y: auto; }
.files-toolbar { display: flex; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.files-toolbar input, .files-toolbar select { padding: 6px 10px; border: 1px solid var(--border-soft, #ddd); border-radius: 6px; background: var(--surface, #fff); color: var(--text, #222); font-size: 13px; }
.files-toolbar input { flex: 1; min-width: 180px; }
.files-total { font-size: 12px; color: var(--muted, #888); margin-bottom: 8px; }
.files-list { max-height: 500px; overflow-y: auto; }
.file-row { display: grid; grid-template-columns: 80px 1fr 100px 80px 140px; gap: 8px; align-items: center; padding: 8px 6px; border-bottom: 1px solid var(--border-soft, rgba(0,0,0,.07)); font-size: 0.82rem; }
.file-row:hover { background: var(--hover, rgba(0,0,0,.03)); }
.file-type-badge { display: inline-block; color: #fff; font-size: 10px; font-weight: 600; border-radius: 4px; padding: 2px 6px; text-align: center; }
.file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-user { color: var(--muted, #888); }
.file-size { text-align: end; color: var(--muted, #888); }
.file-date { color: var(--muted, #888); font-size: 0.78rem; }
.cr-role-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border-soft, rgba(0,0,0,.07)); }
.cr-role-name { font-weight: 600; min-width: 100px; }
.cr-role-perms { flex: 1; font-size: 0.82rem; color: var(--muted, #888); }
.cal-link-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border-soft, rgba(0,0,0,.07)); }
.cal-link-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.cal-link-title { font-weight: 500; flex: 1; }
.cal-link-date { font-size: 0.78rem; color: var(--muted, #888); }
.chat-toast-notif { position: fixed; bottom: 20px; inset-inline-end: 20px; background: var(--surface, #fff); border: 1px solid var(--border, #ddd); border-inline-start: 4px solid var(--accent, #4285f4); border-radius: 8px; padding: 12px 16px; box-shadow: 0 4px 16px rgba(0,0,0,.15); z-index: 9999; max-width: 320px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; animation: slideInNotif 0.3s ease; }
.chat-toast-notif strong { font-size: 13px; }
.chat-toast-notif span { font-size: 12px; color: var(--muted, #888); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@keyframes slideInNotif { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.audit-empty { color: var(--muted, #888); font-style: italic; text-align: center; padding: 20px 0; }
.audit-entry {
  display: grid;
  grid-template-columns: 100px 100px 1fr 120px 1fr;
  gap: 6px;
  align-items: start;
  padding: 7px 6px;
  border-bottom: 1px solid var(--border-soft, rgba(0,0,0,.07));
  font-size: 0.82rem;
  line-height: 1.4;
}
.audit-entry:last-child { border-bottom: none; }
.audit-when { color: var(--muted, #888); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.audit-who { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.audit-action {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}
.audit-target { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted, #888); }
.audit-details { word-break: break-all; color: var(--muted, #888); }
.audit-old { color: #c0392b; }
.audit-new { color: #27ae60; }
.audit-action-login_failed { color: #e74c3c; }
.audit-action-user_delete, .audit-action-company_delete, .audit-action-task_delete, .audit-action-calendar_delete { color: #c0392b; }
.audit-action-user_create, .audit-action-company_create, .audit-action-task_create, .audit-action-calendar_create { color: #27ae60; }

/* === Shared Documents === */
.doc-layout { display: grid; grid-template-columns: 260px 1fr; gap: 16px; height: calc(100vh - 140px); }
.doc-sidebar { overflow-y: auto; border-inline-end: 1px solid var(--border, #ddd); padding-inline-end: 12px; }
.doc-sidebar-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.doc-sidebar-head h3 { margin: 0; }
.doc-list { display: flex; flex-direction: column; gap: 4px; }
.doc-editor-wrap { display: flex; flex-direction: column; min-height: 0; }
.doc-editor-head { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.doc-title-input { flex: 1; padding: 8px 10px; border: 1px solid var(--border, #ddd); border-radius: 6px; font-size: 15px; font-weight: 600; background: var(--bg, #fff); color: var(--text, #222); }
.doc-actions { display: flex; gap: 6px; }
.doc-content { flex: 1; min-height: 200px; padding: 12px; border: 1px solid var(--border, #ddd); border-radius: 8px; font-family: monospace; font-size: 14px; line-height: 1.6; resize: vertical; background: var(--bg, #fff); color: var(--text, #222); }
.doc-status { margin-top: 6px; font-size: 12px; color: var(--muted, #888); }

/* === Chat (DM) — Professional Messenger === */
.dm-layout { display: grid; grid-template-columns: 300px 1fr; gap: 0; height: calc(100vh - 120px); background: var(--bg, #fff); border-radius: 12px; border: 1px solid var(--border, #ddd); overflow: hidden; box-shadow: 0 2px 12px rgba(0,0,0,.06); }
.dm-sidebar { display: flex; flex-direction: column; border-inline-end: 1px solid var(--border, #ddd); background: var(--card, #fafafa); }
.dm-sidebar-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--border, #ddd); }
.dm-sidebar-head h3 { margin: 0; font-size: 16px; font-weight: 700; }
.dm-channel-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; padding: 6px; }
.ch-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: none; border-radius: 10px; background: transparent; color: var(--text, #222); cursor: pointer; text-align: start; width: 100%; transition: background .15s; position: relative; }
.ch-item:hover { background: var(--hover, #f0f0f0); }
.ch-item.active { background: var(--accent-bg, #e8f0fe); }
.ch-item-left { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.ch-item-info { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.ch-item-name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 6px; }
.ch-item-preview { font-size: 12px; color: var(--muted, #888); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.ch-item-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.ch-item-time { font-size: 11px; color: var(--muted, #888); white-space: nowrap; }
.ch-unread { display: inline-block; background: var(--accent, #4285f4); color: var(--on-accent); font-size: 10px; font-weight: 700; border-radius: 10px; padding: 1px 7px; min-width: 20px; text-align: center; }
.ch-avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 700; }
.ch-avatar-wrap { position: relative; flex-shrink: 0; display: inline-flex; }
.ch-online-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--success, #4caf50); position: absolute; bottom: 0; inset-inline-end: 0; border: 2px solid var(--card, #fafafa); }
.ch-empty { text-align: center; padding: 24px 16px; color: var(--muted, #888); font-size: 13px; }

.dm-main { display: flex; flex-direction: column; min-height: 0; background: var(--bg, #fff); }
.dm-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 18px; border-bottom: 1px solid var(--border, #ddd); background: var(--card, #fff); min-height: 54px; }
.dm-header-info { display: flex; flex-direction: column; }
.dm-header-name { font-weight: 700; font-size: 15px; }
.dm-header-meta { font-size: 12px; color: var(--muted, #888); }
.dm-header-actions { display: flex; gap: 6px; }

.dm-messages { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; padding: 16px 18px; background: var(--bg, #fafafa); }
.dm-messages::-webkit-scrollbar { width: 6px; }
.dm-messages::-webkit-scrollbar-thumb { background: rgba(0,0,0,.15); border-radius: 3px; }
.dm-no-messages { text-align: center; padding: 60px 24px; color: var(--muted, #888); font-size: 14px; }
.dm-empty-state { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--muted, #888); background: var(--bg, #fafafa); }
.dm-empty-state.hidden { display: none; }
.dm-empty-icon { font-size: 56px; margin-bottom: 14px; opacity: 0.4; }

.dm-date-sep { text-align: center; padding: 12px 0 6px; }
.dm-date-sep span { font-size: 11px; color: var(--muted, #888); background: var(--card, #fff); padding: 3px 14px; border-radius: 12px; border: 1px solid var(--border, #eee); font-weight: 500; }

.dm-row { display: flex; align-items: flex-end; gap: 8px; max-width: 65%; padding: 2px 0; transition: opacity .2s; }
.dm-row.me { align-self: flex-end; flex-direction: row-reverse; }
.dm-row.consecutive { padding-top: 0; }
.dm-row.consecutive .dm-avatar, .dm-row.consecutive .dm-avatar-spacer { visibility: hidden; height: 0; margin: 0; }
.dm-row.consecutive .dm-author { display: none; }
.dm-avatar { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.dm-avatar-spacer { width: 64px; height: 0; flex-shrink: 0; }
.dm-avatar-text { display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: #fff; }

.dm-content { display: flex; flex-direction: column; min-width: 0; position: relative; }
.dm-author { font-size: 12px; font-weight: 700; color: var(--accent, #4285f4); margin-bottom: 3px; }

.dm-bubble-wrap { display: flex; align-items: flex-end; gap: 4px; position: relative; }
.dm-bubble { padding: 9px 14px; border-radius: 16px; background: var(--card, #f0f0f0); border: 1px solid var(--border, #e0e0e0); word-break: break-word; max-width: 100%; position: relative; transition: background .15s; }
.dm-bubble.me { background: var(--accent, #4285f4); color: var(--chat-mine-text, #fff); border-color: transparent; border-bottom-right-radius: 4px; }
.dm-bubble-text { font-size: 14px; line-height: 1.5; white-space: pre-wrap; }
.dm-bubble-text a { color: inherit; text-decoration: underline; }
.dm-bubble-text.dm-deleted { font-style: italic; opacity: .6; }

.dm-msg-actions { display: none; gap: 2px; align-self: center; }
.dm-row.me:hover .dm-msg-actions { display: flex; }
.dm-action-btn { background: none; border: none; cursor: pointer; padding: 4px; border-radius: 6px; color: var(--muted, #888); display: flex; align-items: center; transition: background .12s, color .12s; }
.dm-action-btn svg { width: 14px; height: 14px; }
.dm-action-btn:hover { background: var(--hover, #f0f0f0); color: var(--text, #222); }
.dm-action-delete:hover { color: var(--danger, #e53e3e); }
@media (hover: none) { .dm-msg-actions { display: flex; } }

.dm-meta { display: flex; align-items: center; gap: 4px; margin-top: 2px; padding: 0 6px; }
.dm-row.me .dm-meta { justify-content: flex-end; }
.dm-time { font-size: 10px; color: var(--muted, #888); }
.dm-row.me .dm-time { color: color-mix(in srgb, var(--chat-mine-text, #fff) 55%, transparent); }
.dm-edited { font-size: 10px; color: var(--muted, #888); font-style: italic; }
.dm-row.me .dm-edited { color: color-mix(in srgb, var(--chat-mine-text, #fff) 50%, transparent); }

.dm-ticks { display: inline-flex; align-items: center; gap: -2px; font-size: 13px; margin-inline-start: 4px; }
.dm-ticks svg { display: inline-block; vertical-align: middle; flex-shrink: 0; }
.dm-ticks.dm-sent { color: color-mix(in srgb, var(--chat-mine-text, #fff) 55%, transparent); }
.dm-ticks.dm-delivered { color: color-mix(in srgb, var(--chat-mine-text, #fff) 70%, transparent); }
.dm-ticks.dm-read { color: var(--info, #53bdeb); }
.dm-row:not(.me) .dm-ticks.dm-sent { color: var(--muted, #aaa); }
.dm-row:not(.me) .dm-ticks.dm-delivered { color: var(--muted, #888); }
.dm-row:not(.me) .dm-ticks.dm-read { color: var(--accent, #4285f4); }

.dm-edit-input { width: 100%; padding: 6px 10px; border: 2px solid var(--accent, #4285f4); border-radius: 8px; font-size: 14px; font-family: inherit; line-height: 1.5; resize: none; background: var(--bg, #fff); color: var(--text, #222); min-height: 36px; outline: none; }
.dm-row.editing .dm-bubble { border: 2px solid var(--accent, #4285f4); }

.dm-doc-card { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border: 1px solid var(--accent, #4285f4); border-radius: 10px; background: var(--accent-bg, #e8f0fe); cursor: pointer; margin-bottom: 6px; transition: background .15s; }
.dm-doc-card:hover { background: var(--accent-hover, #d0e0fd); }
.dm-doc-icon { font-size: 20px; color: var(--accent, #4285f4); flex-shrink: 0; }
.dm-doc-info { display: flex; flex-direction: column; min-width: 0; }
.dm-doc-title { font-weight: 600; font-size: 13px; color: var(--accent, #4285f4); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dm-doc-action { font-size: 11px; color: var(--muted, #888); }

.dm-file-card { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border: 1px solid var(--border, #ddd); border-radius: 10px; background: var(--card, #fff); margin-bottom: 6px; }
.dm-file-icon { font-size: 22px; flex-shrink: 0; }
.dm-file-info { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.dm-file-name { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dm-file-size { font-size: 11px; color: var(--muted, #888); }

.dm-image-wrap { margin-bottom: 6px; }
.dm-image { max-width: 300px; max-height: 220px; border-radius: 10px; cursor: pointer; object-fit: cover; transition: transform .15s; }
.dm-image:hover { transform: scale(1.02); }
.dm-video-wrap { margin-bottom: 6px; }
.dm-video { max-width: 320px; max-height: 240px; border-radius: 10px; }
.dm-audio-wrap { margin-bottom: 6px; }
.dm-audio { width: 240px; }

.dm-typing { padding: 4px 18px; font-size: 12px; color: var(--muted, #888); font-style: italic; display: flex; align-items: center; gap: 6px; }

.dm-input-row { display: flex; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--border, #ddd); align-items: flex-end; background: var(--card, #fff); }
.dm-input-row textarea { flex: 1; padding: 10px 14px; border: 1px solid var(--border, #ddd); border-radius: 20px; font-size: 14px; resize: none; max-height: 150px; background: var(--bg, #f5f5f5); color: var(--text, #222); font-family: inherit; line-height: 1.45; transition: border-color .15s, background .15s; }
.dm-input-row textarea:focus { outline: none; border-color: var(--accent, #4285f4); background: var(--bg, #fff); }
.dm-input-row button:disabled { opacity: 0.4; cursor: not-allowed; }

.dm-emoji-panel { position: absolute; bottom: 60px; inset-inline-start: 72px; z-index: 100; background: var(--card, #fff); border: 1px solid var(--border, #ddd); border-radius: 12px; box-shadow: 0 4px 20px rgba(0,0,0,.12); padding: 8px; max-width: 320px; }
.dm-emoji-panel.hidden { display: none; }
.dm-emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; max-height: 200px; overflow-y: auto; }
.dm-emoji-btn { background: none; border: none; font-size: 20px; padding: 4px; cursor: pointer; border-radius: 6px; transition: background .1s; }
.dm-emoji-btn:hover { background: var(--hover, #f0f0f0); }

.dm-file-badge { display: flex; align-items: center; gap: 8px; padding: 8px 14px; font-size: 13px; font-weight: 600; background: var(--accent-bg, #e8f0fe); color: var(--accent, #4285f4); border-radius: 10px; margin: 0 18px; }
.dm-file-badge.hidden { display: none; }
.dm-file-badge-icon { font-size: 16px; }
.dm-file-badge-size { font-weight: 400; opacity: .7; font-size: 11px; margin-inline-start: 4px; }
.dm-file-badge-x { cursor: pointer; font-size: 18px; opacity: .5; margin-inline-start: auto; transition: opacity .15s; }
.dm-file-badge-x:hover { opacity: 1; color: var(--danger, #e53e3e); }

.dm-pick-list, .dm-user-pick-list { display: flex; flex-direction: column; gap: 4px; max-height: 300px; overflow-y: auto; margin-bottom: 12px; }
.dm-pick-item, .dm-user-pick-list label { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 14px; transition: background .1s; }
.dm-pick-item:hover, .dm-user-pick-list label:hover { background: var(--hover, #f4f4f4); }
.dm-member { display: flex; align-items: center; gap: 10px; padding: 8px 10px; font-size: 14px; }
.dm-member-name { flex: 1; font-weight: 500; }
.dm-member-status { font-size: 12px; color: var(--muted, #888); }
.dm-member-status.online { color: var(--success, #4caf50); font-weight: 600; }
.dm-manage-list { display: flex; flex-direction: column; gap: 4px; max-height: 300px; overflow-y: auto; margin-bottom: 12px; }
.dm-manage-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; font-size: 14px; cursor: pointer; border-radius: 8px; transition: background .1s; }
.dm-manage-item:hover { background: var(--hover, #f4f4f4); }

/* === Document Attachment in Messages === */
.msg-doc-card { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--accent, #4285f4); border-radius: 8px; background: var(--accent-bg, #e8f0fe); cursor: pointer; margin-bottom: 6px; transition: background .15s; }
.msg-doc-card:hover { background: var(--accent-hover, #d0e0fd); }
.msg-doc-icon { font-size: 18px; color: var(--accent, #4285f4); flex-shrink: 0; }
.msg-doc-label { font-weight: 600; font-size: 13px; color: var(--accent, #4285f4); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-doc-hint { font-size: 11px; color: var(--muted, #888); margin-inline-start: auto; white-space: nowrap; }

/* === Doc Picker Modal === */
.doc-picker-list { display: flex; flex-direction: column; gap: 4px; max-height: 300px; overflow-y: auto; margin-bottom: 12px; }
.doc-picker-item { display: flex; flex-direction: column; align-items: flex-start; padding: 8px 12px; border: 1px solid var(--border, #ddd); border-radius: 8px; background: transparent; cursor: pointer; text-align: start; width: 100%; }
.doc-picker-item:hover { background: var(--hover, #f4f4f4); }
.doc-picker-title { font-weight: 600; font-size: 13px; }
.doc-picker-meta { font-size: 11px; color: var(--muted, #888); }

/* === Doc Badge (attached doc before sending) === */
.dm-doc-badge { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; font-size: 12px; font-weight: 600; background: var(--accent-bg, #e8f0fe); color: var(--accent, #4285f4); border-radius: 6px; margin: 4px 16px; }
.dm-doc-badge::before { content: '📄 '; }

/* === Doc Overlay === */
.doc-overlay { position: fixed; inset: 0; z-index: 2000; background: rgba(0,0,0,.5); display: flex; align-items: center; justify-content: center; }
.doc-overlay.hidden { display: none; }
.doc-overlay-inner { width: 90vw; max-width: 900px; height: 80vh; background: var(--bg, #fff); border-radius: 12px; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 8px 32px rgba(0,0,0,.2); }
.doc-overlay-head { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--border, #ddd); }
.doc-overlay-head .doc-title-input { flex: 1; border: none; font-size: 16px; font-weight: 700; background: transparent; color: var(--text, #222); }
.doc-overlay-right { display: flex; align-items: center; gap: 8px; }
.doc-overlay-readers { display: flex; gap: 4px; }
.overlay-reader-badge { display: inline-block; padding: 2px 8px; font-size: 11px; font-weight: 600; background: var(--accent, #4285f4); color: #fff; border-radius: 9px; }
.doc-overlay-status { font-size: 11px; color: var(--muted, #888); }
.doc-overlay-content { flex: 1; padding: 16px; border: none; font-family: monospace; font-size: 14px; line-height: 1.6; resize: none; background: transparent; color: var(--text, #222); }

.att-overlay-body { flex: 1; overflow: auto; padding: 16px; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; }
.att-overlay-body img { max-width: 100%; max-height: 100%; border-radius: 8px; object-fit: contain; }
.att-overlay-body video { max-width: 100%; max-height: 100%; border-radius: 8px; }
.att-overlay-body audio { width: 80%; margin-top: 20px; }
.att-overlay-body iframe { width: 100%; height: 100%; border: none; border-radius: 8px; }
.att-overlay-body .att-text-editor { width: 100%; height: 100%; border: none; font-family: 'Consolas', 'Fira Code', monospace; font-size: 13px; line-height: 1.5; padding: 0; resize: none; background: transparent; color: var(--text, #222); outline: none; }
.att-overlay-body .att-text-editor:focus { outline: none; }
.att-overlay-body .att-spreadsheet { width: 100%; height: 100%; overflow: auto; }
.att-overlay-body .att-spreadsheet table { border-collapse: collapse; width: 100%; font-size: 13px; }
.att-overlay-body .att-spreadsheet th, .att-overlay-body .att-spreadsheet td { border: 1px solid var(--border, #ddd); padding: 4px 8px; min-width: 80px; white-space: nowrap; }
.att-overlay-body .att-spreadsheet th { background: var(--card, #f5f5f5); font-weight: 600; position: sticky; top: 0; }
.att-overlay-body .att-spreadsheet td:focus { outline: 2px solid var(--accent, #4285f4); outline-offset: -2px; background: var(--accent-bg, #e8f0fe); }
.att-overlay-body .att-spreadsheet td.editing { background: var(--accent-bg, #e8f0fe); }
.att-overlay-body .att-not-supported { color: var(--muted, #888); text-align: center; padding: 40px; font-size: 14px; }

/* === Chat doc badge styling fix === */
.dm-doc-badge.hidden { display: none; }

@media (max-width: 768px) {
  .audit-entry {
    grid-template-columns: 1fr;
    gap: 2px;
  }
  .audit-target, .audit-details { display: none; }
  .doc-layout, .dm-layout { grid-template-columns: 1fr; }
  .doc-sidebar, .dm-sidebar { border-inline-end: none; border-bottom: 1px solid var(--border, #ddd); padding-bottom: 8px; padding-inline-end: 0; max-height: 200px; }
  .dm-row { max-width: 85%; }
  .dm-image { max-width: 200px; }
}

/* ============================================================
   Word-Anhang: gemeinsame Absatzbearbeitung
   ============================================================ */
.att-word {
  width: 100%;
  height: 100%;
  overflow: auto;
  padding: 22px 26px;
  background: var(--surface);
}
.att-loading { color: var(--muted); font-size: 0.88rem; }

.att-word-row { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 4px; }
.att-word-marker {
  flex: 0 0 26px;
  padding-top: 4px;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--muted);
  opacity: 0.6;
  text-align: end;
  user-select: none;
}
.att-word-p {
  flex: 1;
  min-height: 1.5em;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid transparent;
  line-height: 1.65;
  outline: none;
  white-space: pre-wrap;
  word-break: break-word;
}
.att-word-p:hover { border-color: var(--border-soft); }
.att-word-p:focus { border-color: var(--accent); background: var(--surface2); }
.att-word-locked { opacity: 0.75; cursor: default; }

/* Ueberschriften und Listen wie im Dokument darstellen */
.att-word-h { font-weight: 700; }
.att-word-h1 { font-size: 1.5rem; margin-top: 14px; }
.att-word-h2 { font-size: 1.25rem; margin-top: 12px; }
.att-word-h3 { font-size: 1.08rem; margin-top: 10px; }
.att-word-li { margin-inline-start: 18px; }
.att-word-li::before { content: '• '; color: var(--muted); }

/* Kurz aufleuchten, wenn jemand anderes den Absatz geaendert hat */
.att-word-changed {
  animation: attWordFlash 1.4s ease-out;
}
@keyframes attWordFlash {
  0%   { background: rgba(255, 43, 43, 0.16); }
  100% { background: transparent; }
}

/* "X bearbeitet Absatz 5" */
.att-overlay-editors { display: inline-flex; gap: 6px; flex-wrap: wrap; margin-inline-end: 10px; }
.att-editor-badge {
  font-size: 0.74rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 43, 43, 0.12);
  color: var(--accent);
  white-space: nowrap;
}

/* ============================================================
   System: Export / Import
   ============================================================ */
.sys-block { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border-soft); }
.sys-block:first-of-type { margin-top: 10px; }
.sys-block h3 { font-size: 0.92rem; color: var(--text); margin-bottom: 10px; }
.sys-opt { display: flex; align-items: center; gap: 9px; margin-bottom: 12px; font-size: 0.88rem; color: var(--muted); cursor: pointer; }
.sys-opt input { width: 15px; height: 15px; accent-color: var(--accent); }
.sys-actions { margin-top: 12px; }
.sys-block input[type='file'] {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px dashed var(--border-soft);
  border-radius: 12px;
  background: var(--surface2);
  color: var(--muted);
  font-size: 0.85rem;
}
.sys-report {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface2);
}
.sys-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.sys-table td { padding: 5px 0; color: var(--muted); }
.sys-table td:first-child { color: var(--text); font-weight: 600; width: 42%; }
.sys-table b { color: var(--accent); }
.sys-warn { color: var(--danger); }
.sys-warnlist { margin: 10px 0 0 18px; font-size: 0.8rem; color: var(--muted); }
.sys-warnlist li { margin-bottom: 3px; }

/* ============================================================
   MOBILE — durchgehende Bedienbarkeit bis 375 px
   ============================================================
   Grundsatz: nichts darf abgeschnitten oder unerreichbar sein.
   Wo Inhalt breiter ist als der Bildschirm, wird er scrollbar
   gemacht statt beschnitten — und zwar innerhalb seines Bereichs,
   damit nie die ganze Seite seitlich wegrutscht.
   ============================================================ */

@media (max-width: 860px) {

  /* --- Die Seite selbst scrollt nie seitlich --- */
  html, body { max-width: 100%; overflow-x: hidden; }

  /* --- Tab-Leiste: alle sieben Reiter bleiben erreichbar --- */
  .tabs {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    padding-bottom: 2px;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab {
    flex: 0 0 auto;
    min-height: 42px;
    padding: 10px 16px;
    scroll-snap-align: start;
    white-space: nowrap;
  }

  /* --- Tippziele: mindestens 40 px hoch --- */
  .btn, .btn-icon, select, input[type='text'], input[type='password'],
  input[type='search'], input[type='date'], input[type='time'] {
    min-height: 40px;
  }
  .btn-mini, .btn-sm { min-height: 34px; }
  .btn-icon { min-width: 40px; }

  /* --- Kopfzeile --- */
  .topbar { padding: 10px 12px; row-gap: 8px; }
  .topbar-controls { flex-wrap: wrap; }
  main { padding: 12px; }

  /* --- Werkzeugleisten: umbrechen statt überlaufen --- */
  .view-toolbar, .ov-toolbar, .ov-toolbar-2, .cal-nav {
    flex-wrap: wrap;
    gap: 8px;
  }
  .view-toolbar > *, .ov-toolbar > * { min-width: 0; }
  .view-toolbar select, .ov-toolbar select, .ov-toolbar input[type='search'] {
    flex: 1 1 140px;
    max-width: 100%;
  }
  .toolbar-group { flex: 1 1 100%; }

  /* --- Kalender: sieben gleich breite Spalten, Inhalt darf schrumpfen --- */
  #calendar-grid { overflow-x: auto; }
  .cal-month, .cal-dows {
    grid-template-columns: repeat(7, minmax(0, 1fr));
    min-width: 0;
  }
  .cal-cell, .cal-dow, .cal-weekcol { min-width: 0; overflow: hidden; }
  .cal-entry {
    font-size: 0.66rem;
    padding: 2px 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .cal-entry em, .cal-entry b { display: none; }
  .cal-title { font-size: 0.95rem; }

  /* --- Tabellen: seitlich scrollbar statt beschnitten --- */
  #users-view .card, #overview-view .card, .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .user-table, .ov-table { min-width: 520px; }

  /* --- Board --- */
  .board { grid-template-columns: 1fr; gap: 12px; }
  .card-users { flex-wrap: wrap; }

  /* --- Übersichtskarten --- */
  .overview-cards { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .ov-company-grid, .company-checks { justify-content: center; }

  /* --- Dialoge: fast bildschirmfüllend, innen scrollbar --- */
  .modal {
    width: calc(100vw - 20px);
    max-width: none;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
  }
  .row.gap { flex-wrap: wrap; }
  .field.half { flex: 1 1 100%; }

  /* --- Chat und Dokumente: Seitenleiste über den Inhalt legen --- */
  .doc-layout, .dm-layout { grid-template-columns: 1fr; }
  .doc-sidebar, .dm-sidebar { max-height: 30vh; overflow-y: auto; }
  .dm-row { max-width: 90%; }
  .dm-composer { flex-wrap: nowrap; gap: 6px; }
  #dm-text { min-height: 40px; }

  /* --- Anhang-Overlay: volle Fläche nutzen --- */
  .att-overlay-inner, .doc-overlay-inner {
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }
  .att-word { padding: 14px 12px; }
  .att-word-marker { flex-basis: 20px; font-size: 0.6rem; }
  .att-spreadsheet { overflow: auto; }

  /* --- Benachrichtigungen --- */
  .notif-panel { width: calc(100vw - 24px); inset-inline-end: -8px; }
}

/* Sehr schmale Geräte (iPhone SE und ähnlich) */
@media (max-width: 400px) {
  .overview-cards { grid-template-columns: repeat(2, 1fr); }
  .tab { padding: 10px 12px; font-size: 0.86rem; }
  .topbar-controls .font-ctrl { display: none; }
  .cal-cell { min-height: 46px; }
}

/* Hinweis, dass die Reiterleiste seitlich weitergeht: weiche Kante rechts */
@media (max-width: 860px) {
  .tabs {
    position: relative;
    -webkit-mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 24px), transparent 100%);
            mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 24px), transparent 100%);
  }
  /* Ist alles sichtbar, stört die Kante nicht — sie liegt dann außerhalb. */
}

/* ============================================================
   Mobil-Nachtrag V3: Board-Spalten duerfen schrumpfen
   ============================================================
   V3 hat die Board-Struktur auf .column umgestellt. Grid- und
   Flex-Elemente schrumpfen von sich aus nicht unter die Breite
   ihres Inhalts (min-width: auto) — dadurch wurde die Spalte
   402 px breit und ragte aus dem 375-px-Bildschirm heraus.
   ============================================================ */
@media (max-width: 860px) {
  .board {
    grid-template-columns: minmax(0, 1fr);
    overflow-x: hidden;
  }
  .board > *,
  .column,
  .column-header,
  .column-body {
    min-width: 0;
    max-width: 100%;
  }
  /* Lange Titel und URLs ohne Leerzeichen umbrechen statt die Spalte zu dehnen */
  .card, .card-title, .card-desc, .column-header {
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
  }
  .card-meta, .card-footer, .card-users { flex-wrap: wrap; min-width: 0; }
}

/* ============================================================
   Rollenanzeige: Geltungsbereich sichtbar machen
   ============================================================
   users.role ist global, die Rechte gelten aber je Unternehmen.
   Die Zusatzangabe verhindert den Eindruck, jemand sei ueberall
   Moderator, obwohl er es nur in einzelnen Unternehmen ist.
   ============================================================ */
.role-scope {
  display: block;
  margin-top: 3px;
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.3;
}
.role-scope-warn { color: var(--danger); }

.company-mod {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  padding: 1px 7px 1px 6px;
  border-radius: 999px;
  background: rgba(255, 43, 43, 0.10);
  border: 1px solid var(--border-soft);
}
.company-mod em {
  font-style: normal;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--accent);
  text-transform: uppercase;
}
.companies-cell { line-height: 1.9; }

/* Pflichtfelder ------------------------------------------------------------
   Der Stern markiert das Feld, .invalid hebt es nach einem fehlgeschlagenen
   Speicherversuch hervor. Die Farben stammen aus den Theme-Variablen, damit
   die Markierung in allen fuenf Themes lesbar bleibt. */
.f-label .req { color: var(--danger, #c0392b); font-weight: 700; margin-inline-start: 2px; }
input.invalid,
textarea.invalid,
select.invalid {
  border-color: var(--danger, #c0392b);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--danger, #c0392b) 25%, transparent);
}

/* Persistentes Banner fuer ungelesene Chat-Nachrichten ----------------------
   Bleibt sichtbar, bis der Chat gelesen oder das Banner geschlossen wird.
   Farben ueber Theme-Variablen, damit es in allen fuenf Themes lesbar ist. */
.chat-unread-banner {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 18px;
  z-index: 1200;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: min(560px, calc(100vw - 24px));
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--accent);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28);
}
.chat-unread-banner.hidden { display: none; }
.chat-unread-banner .cub-icon { display: flex; color: var(--accent); flex: 0 0 auto; }
.chat-unread-banner .cub-icon svg { width: 22px; height: 22px; }
.chat-unread-banner .cub-text { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
.chat-unread-banner .cub-text strong { font-size: 14px; }
.chat-unread-banner .cub-text span {
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-unread-banner .cub-open { flex: 0 0 auto; }
.chat-unread-banner .cub-close {
  flex: 0 0 auto;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}
.chat-unread-banner .cub-close:hover { color: var(--text); }

/* Zaehler am Chat-Reiter */
.tab-badge {
  display: inline-block;
  margin-inline-start: 6px;
  min-width: 18px;
  padding: 1px 5px;
  border-radius: 9px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  vertical-align: middle;
}

@media (max-width: 860px) {
  /* Auf schmalen Geraeten ueber die volle Breite, damit nichts abgeschnitten wird. */
  .chat-unread-banner {
    left: 12px;
    right: 12px;
    transform: none;
    max-width: none;
    bottom: 12px;
  }
}

/* Profil- und Gruppenbilder -------------------------------------------------
   Der Avatar in der Benutzerverwaltung ist fuer Admins anklickbar. */
.avatar-editable { cursor: pointer; outline-offset: 2px; }
.avatar-editable:hover,
.avatar-editable:focus-visible { box-shadow: 0 0 0 2px var(--accent); }
.avatar-modal-preview { display: flex; justify-content: center; margin-bottom: 12px; }
.group-pic-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border, rgba(128, 128, 128, 0.25));
}
.group-pic-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Kalender: verknuepfte Personen ------------------------------------------- */
.ce-people {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  max-height: 132px;
  overflow-y: auto;
  padding: 8px;
  border: 1px solid var(--border, rgba(128, 128, 128, 0.25));
  border-radius: 8px;
}
.ce-person { display: flex; align-items: center; gap: 6px; font-size: 13px; white-space: nowrap; }
.ce-people .hint { margin: 0; }

/* Dokumentenliste ----------------------------------------------------------
   Bewusst an der Chatliste (.ch-item) ausgerichtet, damit beide Seitenleisten
   dieselbe Formsprache haben. Alle Farben ueber Theme-Variablen. */
.doc-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 11px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  text-align: start;
  cursor: pointer;
  transition: background .15s;
}
.doc-item:hover { background: var(--hover, rgba(128, 128, 128, 0.12)); }
.doc-item.active { background: var(--accent-bg, rgba(128, 128, 128, 0.18)); }
.doc-item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

.doc-item-icon {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--accent-bg, rgba(128, 128, 128, 0.15));
  color: var(--accent);
}
.doc-item-icon svg { width: 17px; height: 17px; }

/* min-width:0 ist noetig, damit die Kindelemente unter ihre Inhaltsbreite
   schrumpfen duerfen und das Abschneiden mit Auslassungspunkten greift. */
.doc-item-info { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.doc-item-title {
  font-weight: 600;
  font-size: 13.5px;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.doc-item-meta {
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Firmenkacheln auf gleiche Hoehe bringen: ohne Logo fiel die Kachel frueher
   kuerzer aus als ihre Nachbarn. */
.company-checks { align-items: stretch; }
.company-box { align-items: stretch; }
.company-box-inner:not(.company-add-inner) { height: 100%; }
/* Ohne hinterlegtes Logo bleibt der Platz reserviert, aber leer: die helle
   Logo-Platte waere hier eine sinnlose weisse Flaeche. Die Selektoren muessen
   die Plattenregel oben an Spezifitaet uebertreffen. */
.company-box-inner:not(.company-add-inner) .company-logo.logo-missing,
.ov-company .company-logo.logo-missing,
.company-admin-item .company-logo.logo-missing {
  display: inline-flex;
  background: transparent;
  border: 1px dashed var(--border-soft);
  box-shadow: none;
}

/* Theme-Vorschau in den Einstellungen ---------------------------------------
   Jede Auswahl zeigt eine Miniatur der Oberflaeche: Kopfleiste, zwei Spalten,
   Akzentzeile. Die Farben stehen als Inline-Variablen am Element, damit die
   Vorschau unabhaengig vom gerade aktiven Theme korrekt aussieht. */
.theme-option { flex-direction: column; align-items: stretch; gap: 8px; }
.theme-option .tp-name { font-size: 13px; font-weight: 600; }

.tp-card {
  display: block;
  height: 74px;
  padding: 7px;
  border-radius: 8px;
  background: var(--tp-bg);
  border: 1px solid rgba(128, 128, 128, 0.35);
  overflow: hidden;
  pointer-events: none;
}
.tp-bar {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 13px;
  padding: 0 5px;
  margin-bottom: 6px;
  border-radius: 4px;
  background: var(--tp-surface);
}
.tp-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--tp-accent); flex: 0 0 auto; }
.tp-body { display: flex; gap: 6px; height: 41px; }
.tp-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 6px 5px;
  border-radius: 5px;
  background: var(--tp-surface);
}
.tp-line { height: 4px; border-radius: 2px; background: var(--tp-text); opacity: .75; }
.tp-line-wide { flex: 1; opacity: .45; }
.tp-short { width: 60%; background: var(--tp-muted); opacity: .8; }
.tp-accent { background: var(--tp-accent); opacity: 1; }

/* Ausgewaehltes Theme deutlich hervorheben */
.theme-option.active .tp-card,
.theme-option:has(input:checked) .tp-card {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent);
}
.theme-option:hover .tp-card { border-color: var(--accent); }

@media (max-width: 860px) {
  .theme-options { grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); }
  .tp-card { height: 64px; }
}

/* ============================================================
   Ladebildschirm
   ------------------------------------------------------------
   Ein Ladekreis statt Balken: der Ring fuellt sich ueber 6 s.
   Ueber das Logo zieht ein Glanz. Der Bildschirm blockiert
   nichts — Klick, Taste oder Ueberspringen beenden ihn sofort.
   ============================================================ */
.boot {
  position: fixed;
  inset: 0;
  z-index: 4000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg0);
  background-image: var(--bg, none);
  opacity: 1;
  transition: opacity .55s ease, visibility .55s ease;
}
.boot.boot-done { opacity: 0; visibility: hidden; pointer-events: none; }
/* Sicherheitsnetz ohne JavaScript: sollte das Skript ausfallen oder ein Timer
   gedrosselt werden, gibt der Ladebildschirm die Seite trotzdem frei. Rein per
   CSS, weil die CSP (script-src 'self') kein Inline-Skript erlaubt.
   Laeuft spaeter als die regulaeren 6 s, damit es im Normalfall nie greift. */
.boot { animation: bootFailsafe 0s linear 8s forwards; }
@keyframes bootFailsafe {
  to { opacity: 0; visibility: hidden; pointer-events: none; }
}
.boot-inner { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 24px; }

.boot-logo-wrap {
  position: relative;
  width: 132px;
  height: 132px;
  display: grid;
  place-items: center;
  margin-bottom: 22px;
}
.boot-ring { position: absolute; inset: 0; width: 132px; height: 132px; transform: rotate(-90deg); }
.boot-ring circle { fill: none; stroke-width: 3; stroke-linecap: round; }
.boot-ring-track { stroke: var(--border-soft); }
.boot-ring-fill {
  stroke: var(--accent);
  /* Umfang bei r=60: 2*pi*60 = 376.99 */
  stroke-dasharray: 377;
  stroke-dashoffset: 377;
  animation: bootRing 6s cubic-bezier(.32, .06, .28, 1) forwards;
  filter: drop-shadow(0 0 6px color-mix(in srgb, var(--accent) 55%, transparent));
}
@keyframes bootRing { to { stroke-dashoffset: 0; } }

/* Der fruehere weisse Kachelhintergrund samt Glanzband ist entfallen: das neue
   Zeichen ist ein freigestelltes Vektorsymbol und braucht keine Traegerflaeche.
   Die Gestaltung steht weiter unten im Abschnitt „V5 — Markenzeichen". */

.boot-tag { font-size: .92rem; color: var(--muted); margin: 14px 0 20px; letter-spacing: .04em; }
.boot-skip {
  background: none;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  padding: 6px 16px;
  font-size: .78rem;
  color: var(--muted);
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.boot-skip:hover, .boot-skip:focus-visible { color: var(--text); border-color: var(--accent); }

/* ============================================================
   Anmeldeseite: dekorative Buehne
   ------------------------------------------------------------
   Zweispaltig ab 980 px: links die Animation, rechts das
   Formular. Darunter wird die Buehne ausgeblendet, damit das
   Formular auf schmalen Geraeten den ganzen Platz behaelt.
   Die Buehne ist rein dekorativ (pointer-events:none) und
   ueberlagert das Formular nie.
   ============================================================ */
#login-screen {
  display: grid;
  grid-template-columns: 1fr;
  place-items: center;
  gap: 40px;
  padding: 24px;
}
@media (min-width: 980px) {
  #login-screen {
    grid-template-columns: minmax(0, 1fr) minmax(0, 420px);
    max-width: 1100px;
    margin: 0 auto;
    gap: 56px;
  }
}

.login-stage {
  position: relative;
  display: block;
  width: 100%;
  max-width: 520px;
  aspect-ratio: 520 / 420;
  pointer-events: none;
  user-select: none;
}
/* Auf schmalen Geraeten steht die Buehne ueber dem Formular. Sie wird flacher
   gehalten, damit die Eingabefelder ohne Scrollen erreichbar bleiben — die
   Szene wird dafuer beschnitten statt verkleinert, sonst waeren Berge und
   Kanban-Karten nur noch Striche. */
@media (max-width: 979px) {
  .login-stage {
    aspect-ratio: auto;
    height: clamp(150px, 26vh, 230px);
    max-width: 420px;
    margin-bottom: -6px;
  }
  .ls-scene {
    /* Ausschnitt auf den interessanten Teil: Gipfel, Puzzle, Kanban. */
    height: 100%;
  }
}
/* Sehr niedrige Fenster: Buehne weglassen, damit die Anmeldung im Blick bleibt. */
@media (max-height: 520px) and (max-width: 979px) {
  .login-stage { display: none; }
}

.ls-scene { width: 100%; height: 100%; overflow: visible; }

/* --- Bergsilhouette: Linien zeichnen sich --- */
.ls-ridge {
  fill: none;
  stroke: var(--text);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
  /* Die Pfade tragen pathLength="1", die Laenge ist also normiert. Vorher
     stand hier ein fester Wert (1400), der weit ueber der echten Pfadlaenge
     lag — dadurch blieb die Linie den halben Ablauf lang unsichtbar. */
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: lsDraw 3.4s ease-out forwards;
}
.ls-ridge-back { opacity: .34; stroke-width: 1.5; }
.ls-ridge-front { opacity: .72; animation-delay: .45s; }
@keyframes lsDraw { to { stroke-dashoffset: 0; } }

.ls-snow-cap {
  fill: var(--text);
  opacity: 0;
  animation: lsFadeIn 1.2s ease-out 2.8s forwards;
}
.ls-snow-cap-2 { animation-delay: 3.2s; }
@keyframes lsFadeIn { to { opacity: .6; } }

.ls-ground {
  stroke: var(--text);
  stroke-width: 1;
  opacity: .18;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: lsDrawShort 1.6s ease-out 2.2s forwards;
}
@keyframes lsDrawShort { to { stroke-dashoffset: 0; } }

.ls-sun { animation: lsBreathe 7s ease-in-out infinite; transform-origin: 392px 118px; }
@keyframes lsBreathe {
  0%, 100% { transform: scale(1); opacity: .85; }
  50% { transform: scale(1.14); opacity: 1; }
}

/* --- Kanban: eine Karte wandert von der linken in die rechte Spalte --- */
.ls-col { fill: none; stroke: var(--text); stroke-width: 1.2; opacity: .22; }
.ls-card { fill: var(--text); opacity: .16; }
.ls-card-b { opacity: .1; }
.ls-card-move {
  fill: var(--accent);
  opacity: 0;
  animation: lsMoveCard 7s ease-in-out 4.5s infinite;
}
@keyframes lsMoveCard {
  0%      { transform: translate(0, 0); opacity: 0; }
  8%      { transform: translate(0, 0); opacity: .85; }
  22%     { transform: translate(0, -14px); }
  46%     { transform: translate(200px, -14px); }
  60%     { transform: translate(200px, 0); opacity: .85; }
  88%     { transform: translate(200px, 0); opacity: .85; }
  100%    { transform: translate(200px, 0); opacity: 0; }
}

/* --- Puzzleteile fahren zusammen --- */
.ls-piece {
  fill: color-mix(in srgb, var(--accent) 12%, transparent);
  stroke: var(--accent);
  stroke-width: 1.6;
  stroke-linejoin: round;
  opacity: .7;
}
.ls-piece-l { animation: lsJoinL 6s ease-in-out 2.2s infinite; }
.ls-piece-r { animation: lsJoinR 6s ease-in-out 2.2s infinite; }
@keyframes lsJoinL {
  0%, 100% { transform: translateX(-40px); opacity: 0; }
  22%      { transform: translateX(-40px); opacity: .7; }
  46%, 80% { transform: translateX(0); opacity: .7; }
}
@keyframes lsJoinR {
  0%, 100% { transform: translateX(40px); opacity: 0; }
  22%      { transform: translateX(40px); opacity: .7; }
  46%, 80% { transform: translateX(0); opacity: .7; }
}

/* --- Schneefall --- */
.ls-snowfall { position: absolute; inset: 0; overflow: hidden; border-radius: 20px; }
.ls-flake {
  position: absolute;
  top: -8%;
  left: var(--x);
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text);
  opacity: 0;
  transform: scale(var(--s));
  animation: lsFall var(--d) linear var(--delay) infinite;
}
@keyframes lsFall {
  0%   { transform: translate(0, 0) scale(var(--s)); opacity: 0; }
  10%  { opacity: .45; }
  85%  { opacity: .3; }
  100% { transform: translate(26px, 440px) scale(var(--s)); opacity: 0; }
}

/* Bewegung abschalten, wenn das System es verlangt. Der Ladebildschirm
   verschwindet dann sofort statt nach 6 Sekunden (siehe app.js). */
@media (prefers-reduced-motion: reduce) {
  .ls-ridge, .ls-snow-cap, .ls-ground, .ls-sun,
  .ls-card-move, .ls-piece-l, .ls-piece-r, .ls-flake,
  .boot-ring-fill, .boot-logo {
    animation: none !important;
  }
  .ls-ridge { stroke-dashoffset: 0; }
  .ls-ground { stroke-dashoffset: 0; }
  .ls-snow-cap { opacity: .5; }
  .boot-ring-fill { stroke-dashoffset: 0; }
  .ls-flake { opacity: 0; }
}

/* ============================================================
   Wortmarke auf der Anmeldeseite
   ------------------------------------------------------------
   Blob mit Chromkontur, rotes „clu", danach wird „To Do"
   aufgedeckt. Anschliessend zieht dauerhaft ein Glanzband
   schraeg ueber die gesamte Marke.
   ============================================================ */
.login-brand { margin: 0 0 18px; }
.lw {
  display: block;
  width: 100%;
  max-width: 340px;
  height: auto;
  margin: 0 auto;
  overflow: visible;
  /* Dezenter Schimmer um die Marke — gibt dem Chrom Tiefe, ohne dass die
     Kontur ausfranst. */
  filter: drop-shadow(0 2px 10px rgba(0, 0, 0, .30))
          drop-shadow(0 0 16px color-mix(in srgb, var(--accent) 22%, transparent));
}

/* Die Marke blendet auf. Bewusst NUR die Deckkraft: die Gruppe traegt ihren
   Massstab im transform-Attribut, eine Transform-Animation wuerde ihn
   ueberschreiben und die Marke aus dem Bild schieben. */
.lw-mark { animation: lwMarkIn .9s ease-out both; }
@keyframes lwMarkIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* „To Do" wird von links nach rechts aufgedeckt */
.lw-wipe {
  transform-box: fill-box;
  transform-origin: left center;
  animation: lwWipe 1.1s cubic-bezier(.22, .9, .27, 1) .55s both;
}
@keyframes lwWipe {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}
.lw-todo { animation: lwTodoIn 1.1s ease-out .55s both; }
@keyframes lwTodoIn {
  from { opacity: .25; }
  to   { opacity: 1; }
}

/* Glanzband — laeuft dauerhaft, mit ruhiger Pause dazwischen */
.lw-gloss {
  animation: lwGloss 4.2s cubic-bezier(.45, 0, .3, 1) 1.5s infinite;
}
@keyframes lwGloss {
  0%        { transform: skewX(-16deg) translateX(0); }
  45%, 100% { transform: skewX(-16deg) translateX(1300px); }
}

/* ============================================================
   Unterzeile der Anmeldeseite
   ------------------------------------------------------------
   Traegt die Aussage jetzt allein, nachdem der Schriftzug
   „Clu To-Do" entfallen ist — entsprechend groesser gesetzt,
   mit feiner Sperrung und einer schmalen Akzentlinie.
   ============================================================ */
.login-tag {
  position: relative;
  margin: 0 auto 30px;
  padding-bottom: 16px;
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: .055em;
  line-height: 1.45;
  color: var(--text);
  opacity: .92;
  animation: lwTagIn 1s ease-out 1.05s both;
}
.login-tag::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 76px;
  height: 2px;
  border-radius: 2px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
}
@keyframes lwTagIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: .92; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .lw-mark, .lw-wipe, .lw-todo, .lw-gloss, .login-tag { animation: none !important; }
  .lw-mark, .lw-todo { opacity: 1; }
  .login-tag { opacity: .92; }
  .lw-gloss { display: none; }
}

/* Logo in der Topbar ist anklickbar und fuehrt zum Board. Als <button>
   ausgefuehrt, damit es per Tastatur erreichbar ist; die Optik bleibt
   unveraendert. */
.brand-link {
  display: inline-flex;
  align-items: center;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 10px;
}
.brand-link:hover .brand { transform: scale(1.06); }
.brand-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.brand-link .brand { transition: transform .15s ease; }

/* Profilbilder in V5 doppelt so gross ---------------------------------------
   Damit die groesseren Bilder nichts verdecken und nichts sprengen:
   - Avatare schrumpfen nie unter ihre Box (flex-shrink bleibt 0), aber die
     umgebenden Zeilen duerfen umbrechen.
   - Auf schmalen Geraeten wird die Groesse gedeckelt, sonst bliebe fuer Text
     kein Platz mehr. */
.avatar, .ch-avatar, .dm-avatar { max-width: 100%; }
.user-cell { gap: 12px; }
.card-footer, .card-user { flex-wrap: wrap; row-gap: 6px; }
.avatar-modal-preview .avatar { max-width: min(192px, 60vw); max-height: min(192px, 60vw); }

@media (max-width: 860px) {
  /* Auf dem Handy zurueckhaltender: die doppelte Groesse wuerde sonst die
     Zeilen sprengen. Immer noch deutlich groesser als vorher. */
  .dm-avatar, .dm-avatar-spacer { width: 44px; height: 44px; }
  .dm-avatar-spacer { height: 0; }
  .avatar-big { width: 96px; height: 96px; font-size: 38px; border-radius: 26px; }
}

/* ============================================================
   V5 — Markenzeichen
   ------------------------------------------------------------
   Offenes C mit Haken, inline als SVG eingebettet. Die Farbe
   steht bewusst FEST (nicht currentColor aus der Umgebung):
   in der Topbar wuerde das Zeichen sonst die helle Textfarbe
   erben und waere nicht mehr rot.
   Eine Variable, damit sich der Ton an einer Stelle aendern
   laesst.
   ============================================================ */
:root { --brand-red: #E30613; }

.mark { display: block; width: 100%; height: 100%; overflow: visible; }
.brand-mark { color: var(--brand-red); display: inline-flex; }

/* Topbar */
/* V6: doppelt so gross wie zuvor (38 -> 76 px). Damit die Topbar nicht
   entsprechend hoeher wird, ragt das Zeichen per negativem Rand leicht in das
   Innenpolster hinein. */
.brand.brand-mark { width: 76px; height: 76px; margin: -14px 0; }

/* V6.1: Das Zeichen dreht sich gleichmaessig ueber volle 60 Sekunden einmal im
   Uhrzeigersinn um die eigene Achse, pulsiert danach kurz und beginnt die
   naechste Umdrehung. Ein Zyklus = 60 s Drehung + 2 s Puls = 62 s.
   60/62 = 96,774 % — bis dahin laeuft die Drehung linear; der Puls liegt in
   den letzten 3,226 %. Drehung und Skalierung stehen in derselben transform-
   Angabe, sonst ueberschriebe die eine die andere. */
.brand.brand-mark .mark {
  transform-origin: 50% 50%;
  animation: brandSpin 62s linear infinite;
}
@keyframes brandSpin {
  0%       { transform: rotate(0deg) scale(1); }
  96.774%  { transform: rotate(360deg) scale(1); animation-timing-function: ease-out; }
  97.6%    { transform: rotate(360deg) scale(1.18); animation-timing-function: ease-in-out; }
  98.4%    { transform: rotate(360deg) scale(0.96); animation-timing-function: ease-in-out; }
  99.2%    { transform: rotate(360deg) scale(1.1); animation-timing-function: ease-in-out; }
  100%     { transform: rotate(360deg) scale(1); }
}

/* Die Hover-Vergroesserung wirkt jetzt auf den Behaelter, nicht auf das
   rotierende Zeichen — sonst ueberschrieben sich beide transform-Werte. */
.brand-link:hover .brand { transform: none; }
.brand-link:hover .brand.brand-mark { filter: drop-shadow(0 0 10px color-mix(in srgb, var(--brand-red) 55%, transparent)); }
@media (prefers-reduced-motion: reduce) {
  .brand.brand-mark .mark { animation: none; }
}
@media (max-width: 860px) {
  /* Auf dem Handy waere 76 px zu viel fuer die schmale Leiste. */
  .brand.brand-mark { width: 52px; height: 52px; margin: -6px 0; }
}

/* Anmeldeseite: gross und mittig, ohne Schriftzug */
.brand-mark-lg {
  width: clamp(96px, 34%, 132px);
  height: auto;
  aspect-ratio: 1 / 1;
  margin: 0 auto 4px;
  /* Dezenter Schimmer: hebt das flache Zeichen leicht von der Karte ab. */
  filter: drop-shadow(0 0 18px color-mix(in srgb, var(--brand-red) 45%, transparent));
  animation: markGlow 4.2s ease-in-out infinite;
}
@keyframes markGlow {
  0%, 100% { filter: drop-shadow(0 0 12px color-mix(in srgb, var(--brand-red) 30%, transparent)); }
  50%      { filter: drop-shadow(0 0 26px color-mix(in srgb, var(--brand-red) 65%, transparent)); }
}
.login-brand { margin: 0 0 18px; display: flex; justify-content: center; }

/* Ladekreis: Zeichen im Ring, mit ruhiger Eigenbewegung */
.boot-logo {
  position: relative;
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  color: var(--brand-red);
  animation: bootFloat 4.2s ease-in-out infinite;
}
.boot-logo .mark { width: 76px; height: 76px; }
@keyframes bootFloat {
  0%, 100% { transform: scale(1) rotate(0deg); }
  35%      { transform: scale(1.07) rotate(-3deg); }
  70%      { transform: scale(1.02) rotate(2deg); }
}

@media (prefers-reduced-motion: reduce) {
  .brand-mark-lg, .boot-logo { animation: none !important; }
}
}

/* Benutzerdialog uebersichtlicher (V5) --------------------------------------
   Die Bereiche „Rolle im System" und „Unternehmen" sind jetzt sichtbar
   voneinander abgesetzt, damit klar wird: global gibt es nur zwei Stufen,
   die Moderatorrolle wird je Unternehmen vergeben. */
.um-block {
  padding: 14px;
  margin-bottom: 14px;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  background: color-mix(in srgb, var(--text) 3%, transparent);
}
.um-block > .f-label { font-weight: 700; margin-bottom: 8px; }
.um-hint-top { margin: 0 0 10px; }
.um-block .hint { line-height: 1.5; }

/* Unternehmensuebergreifende Zuweisung (V5) */
.assignee-group {
  margin: 12px 0 6px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
}
.assignee-extern {
  display: block;
  font-size: 10.5px;
  font-style: normal;
  color: var(--muted);
}

/* Aufgabe nur verschiebbar (V5) --------------------------------------------
   Mitarbeitende sehen die Inhalte, koennen sie aber nicht aendern. Gesperrte
   Felder bleiben lesbar — ausgegraut, nicht versteckt. */
.tm-readonly-note {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-soft);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  color: var(--text);
  font-size: 12.5px;
  line-height: 1.5;
}
.locked-block { opacity: .6; pointer-events: none; }

/* V6: Chat- und Aufgaben-Banner stehen gestapelt unten in der Mitte. Vorher
   war das Chat-Banner selbst fest positioniert — ein zweites haette es genau
   ueberdeckt. */
.notice-stack {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 1200;
  display: flex;
  flex-direction: column-reverse;
  gap: 10px;
  width: min(560px, calc(100vw - 24px));
  pointer-events: none;
}
.notice-stack > * { pointer-events: auto; }
.notice-stack .chat-unread-banner {
  position: static;
  transform: none;
  left: auto;
  bottom: auto;
  max-width: none;
}
.task-msg-banner { border-color: var(--warn, #f59e0b); }
.task-msg-banner .cub-icon { color: var(--warn, #f59e0b); }
@media (max-width: 860px) {
  .notice-stack { bottom: 12px; }
}

/* V6: Ausgeklappte Auswahllisten in allen Themes lesbar -----------------------
   Browser zeichnen die Liste eines <select> nativ. Ohne Vorgaben erscheint sie
   weiss, uebernimmt aber die (helle) Schriftfarbe des Feldes — weiss auf weiss.
   color-scheme laesst den Browser die Liste passend zum Theme zeichnen; die
   Optionsfarben sichern das zusaetzlich ab, falls color-scheme ignoriert wird. */
select { color-scheme: light; }
select option, select optgroup { background-color: #ffffff; color: #111111; }
:root[data-theme='dark'] select,
:root[data-theme='colorful'] select,
:root[data-theme='gotthard'] select { color-scheme: dark; }
:root[data-theme='dark'] select option,
:root[data-theme='colorful'] select option,
:root[data-theme='gotthard'] select option { background-color: var(--surface); color: var(--text); }
@media (prefers-color-scheme: dark) {
  :root[data-theme='auto'] select { color-scheme: dark; }
  :root[data-theme='auto'] select option { background-color: var(--surface); color: var(--text); }
}
/* Aufgabe aus einem Unternehmen, dem man nicht angehoert (V6) */
.company-tag-extern { border-style: dashed; }

/* V6: Hervorhebung der letzten Beschreibungsaenderung ----------------------- */
.desc-view {
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 10px 12px;
  background: color-mix(in srgb, var(--text) 3%, transparent);
}
.desc-view-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 12px;
  margin-bottom: 8px;
  font-size: 11.5px;
  color: var(--muted);
}
.desc-legend { display: inline-flex; gap: 6px; }
.desc-view-body {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: .9rem;
  line-height: 1.55;
  color: var(--text);
  max-height: 320px;
  overflow-y: auto;
  margin-bottom: 8px;
}
/* Hinzugefuegtes: kraeftiges Gruen mit dunkler Schrift — lesbar in allen
   Themes, weil Hintergrund und Schrift gemeinsam festgelegt sind. */
mark.desc-added {
  background: #bbf7d0;
  color: #064e3b;
  border-radius: 3px;
  padding: 0 2px;
  box-shadow: inset 0 -2px 0 #22c55e;
}
del.desc-removed {
  color: var(--danger);
  opacity: .75;
  text-decoration-thickness: 1.5px;
  font-size: .92em;
}
.desc-legend mark.desc-added, .desc-legend del.desc-removed { font-size: 11px; }
.desc-changed-badge { color: #16a34a; }
.desc-changed-badge em { font-style: normal; font-weight: 600; }

/* V6: Papierkorb ------------------------------------------------------------ */
.trash-list { display: flex; flex-direction: column; gap: 10px; }
.trash-item {
  display: flex;
  gap: 16px;
  justify-content: space-between;
  align-items: flex-start;
  padding: 14px;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  background: color-mix(in srgb, var(--text) 3%, transparent);
}
.trash-main { min-width: 0; flex: 1; }
.trash-title { font-weight: 700; margin-bottom: 6px; word-break: break-word; }
.trash-meta { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; font-size: 12px; color: var(--muted); }
.trash-meta svg { width: 13px; height: 13px; vertical-align: -2px; }
.trash-desc {
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--muted);
  white-space: pre-wrap;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.trash-side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; flex-shrink: 0; }
.trash-countdown { font-size: 11.5px; color: var(--danger); font-weight: 600; }
.trash-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 860px) {
  .trash-item { flex-direction: column; }
  .trash-side { align-items: stretch; width: 100%; }
  .trash-actions { justify-content: stretch; }
  .trash-actions .btn { flex: 1; }
}

/* Loeschknopf fuer Chat-Anhaenge (seit V5 vorhanden, bisher ohne Gestaltung —
   er erschien als weisser Balken neben dem Download-Knopf). */
.dm-att-del {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  flex-shrink: 0;
}
.dm-att-del svg { width: 15px; height: 15px; }
.dm-att-del:hover, .dm-att-del:focus-visible { color: var(--danger); border-color: var(--danger); }
/* Auf Bildanhaengen schwebt der Knopf in der Ecke */
.dm-image-wrap { position: relative; }
.dm-image-wrap .dm-att-del {
  position: absolute;
  top: 6px;
  inset-inline-end: 6px;
  background: rgba(0, 0, 0, .55);
  color: #fff;
  border-color: transparent;
}
.ov-assignee.active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }


/* ============================================================
   V7
   ============================================================ */
/* Ungelesen-Zaehler oben rechts auf der Aufgabenkarte */
.card[data-id] { position: relative; }
/* Innerhalb der Karte statt ueber den Rand: die Spalten schneiden ueberstehende
   Inhalte ab, ein Zaehler bei -8px war nur als roter Rand zu sehen. */
.card-unread {
  position: absolute;
  top: 10px;
  inset-inline-end: 10px;
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--danger);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 0 0 2px var(--surface), 0 4px 10px rgba(0, 0, 0, .25);
  z-index: 2;
  animation: unreadPop .35s cubic-bezier(.2, 1.4, .4, 1);
}
@keyframes unreadPop { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.card.has-unread .card-top { padding-inline-end: 34px; }
.card.has-unread { border-color: color-mix(in srgb, var(--danger) 45%, var(--border-soft)); }

/* Tonauswahl und Anzeigeart in den Einstellungen */
.tone-field { margin-top: 14px; }
.tone-field select { min-width: 200px; }
.notice-style-options { display: flex; flex-direction: column; gap: 10px; }
.notice-style-option {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 14px;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  cursor: pointer;
}
.notice-style-option:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.notice-style-option input { margin-top: 3px; accent-color: var(--accent); }
.notice-style-option span { display: flex; flex-direction: column; gap: 3px; }
.notice-style-option em { font-style: normal; font-size: 12.5px; color: var(--muted); }

/* Zentrierte Meldung, die weggeklickt werden muss */
.center-notice-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(0, 0, 0, .55);
  backdrop-filter: blur(3px);
  animation: cnFade .2s ease;
}
@keyframes cnFade { from { opacity: 0; } to { opacity: 1; } }
.center-notice {
  width: min(480px, 100%);
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--accent);
  border-radius: 18px;
  padding: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .45);
  animation: cnRise .28s cubic-bezier(.2, 1, .3, 1);
}
@keyframes cnRise { from { transform: translateY(14px) scale(.97); opacity: 0; } to { transform: none; opacity: 1; } }
.center-notice-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.center-notice-head h3 { margin: 0; font-size: 1.1rem; }
.center-notice-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); flex-shrink: 0; }
.center-notice-icon svg { width: 22px; height: 22px; }
.center-notice-list { display: flex; flex-direction: column; gap: 8px; }
.center-notice-item {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--text) 4%, transparent);
}
.center-notice-item.is-mention { box-shadow: inset 3px 0 0 var(--warn, #f59e0b); }
.cni-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cni-text span { font-size: 13px; color: var(--muted); word-break: break-word; white-space: pre-wrap; }
.center-notice-actions { display: flex; justify-content: flex-end; margin-top: 16px; }

/* @-Erwaehnungen im Chat */
.mention { font-weight: 700; color: var(--accent); }
.mention-me {
  color: #111;
  background: #fde68a;
  border-radius: 4px;
  padding: 0 3px;
}
.dm-input-row { position: relative; }
.mention-box {
  position: absolute;
  inset-inline-start: 8px;
  bottom: calc(100% + 6px);
  z-index: 30;
  min-width: 220px;
  max-width: calc(100% - 16px);
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .3);
}
.mention-opt {
  display: flex;
  width: 100%;
  gap: 10px;
  align-items: baseline;
  padding: 7px 10px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  text-align: start;
  cursor: pointer;
}
.mention-opt em { font-style: normal; font-size: 12px; color: var(--muted); }
.mention-opt.active, .mention-opt:hover { background: color-mix(in srgb, var(--accent) 14%, transparent); }

/* Pflichtfeld Zuweisung nicht ausgefuellt */
.assignee-picker.invalid-block {
  outline: 2px solid var(--danger);
  outline-offset: 3px;
  border-radius: 10px;
}

/* === V7.1: Chat und Dokumente passen sich der Fensterhoehe an ===
   Frueher feste Hoehe calc(100vh - 120px). Die Kopfzeile ist aber je nach
   Logo, Schriftgroesse, umbrechenden Reitern und Windows-Skalierung hoeher –
   auf Laptops rutschte das Eingabefeld dann unter den Bildschirmrand.
   fitLayout.js misst den tatsaechlichen Platz und setzt --fit-h. */
.dm-layout, .doc-layout {
  height: var(--fit-h, calc(100dvh - 140px));
  min-height: 300px;
  grid-template-rows: minmax(0, 1fr);
}
.dm-sidebar, .dm-main, .doc-sidebar, .doc-editor-wrap { min-height: 0; }
.dm-header, .dm-input-row, .dm-sidebar-head, #dm-file-badge, #dm-emoji-panel,
.doc-editor-head, .doc-status { flex-shrink: 0; }
.dm-messages { min-height: 0; }
.dm-input-row textarea { max-height: min(150px, 25vh); }
.doc-content { min-height: 0; resize: none; }
@media (max-width: 860px) {
  .dm-layout, .doc-layout { grid-template-rows: auto minmax(0, 1fr); }
  .dm-sidebar, .doc-sidebar { max-height: min(30vh, 200px); }
}
@media (max-height: 560px) {
  .dm-header { min-height: 0; padding-top: 6px; padding-bottom: 6px; }
  .dm-input-row { padding-top: 6px; padding-bottom: 6px; }
  .dm-messages { padding-top: 8px; padding-bottom: 8px; }
}

/* V7.1: Im Chat schwebt das Banner ueber der Eingabezeile statt darauf. */
.notice-stack { bottom: var(--notice-bottom, 18px); }
@media (max-width: 860px) {
  .notice-stack { bottom: var(--notice-bottom, 12px); }
}

/* === V7.3: Vorschau fuer alle Dateitypen === */
.att-overlay-body .att-preview { width: 100%; max-width: 900px; }
.att-overlay-body .att-svg { max-width: 100%; max-height: 70vh; background: #fff; border-radius: 8px; }
.att-preview-note { color: var(--muted, #888); font-size: 13px; margin: 0 0 10px; }
.att-pre { white-space: pre-wrap; word-break: break-word; font-family: 'Consolas', 'Fira Code', monospace; font-size: 13px; line-height: 1.5; margin: 0; padding: 12px 14px; background: var(--card, #f7f7f7); border: 1px solid var(--border, #ddd); border-radius: 8px; color: var(--text, #222); }
.att-hex { white-space: pre; overflow-x: auto; font-size: 12px; }
/* Dokumente */
.att-doc { background: var(--card, #fff); color: var(--text, #222); border: 1px solid var(--border, #ddd); border-radius: 8px; padding: 28px 34px; line-height: 1.6; font-size: 15px; }
.att-doc-h { margin: 18px 0 8px; line-height: 1.3; }
.att-doc-h:first-child { margin-top: 0; }
.att-doc-p { margin: 0 0 8px; white-space: pre-wrap; }
.att-doc-empty { min-height: 8px; margin: 0; }
.att-doc-ul { margin: 0 0 8px 22px; padding: 0; }
.att-doc-table { border-collapse: collapse; margin: 6px 0 12px; font-size: 14px; }
.att-doc-table td { border: 1px solid var(--border, #ddd); padding: 4px 8px; vertical-align: top; }
/* Praesentationen */
.att-slides { display: flex; flex-direction: column; gap: 14px; }
.att-slide { background: var(--card, #fff); color: var(--text, #222); border: 1px solid var(--border, #ddd); border-radius: 10px; padding: 18px 22px; aspect-ratio: 16 / 9; overflow: auto; box-shadow: 0 2px 10px rgba(0,0,0,.06); }
.att-slide-no { font-size: 12px; color: var(--muted, #888); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 8px; }
.att-slide-title { margin: 0 0 10px; font-size: 20px; }
.att-slide ul { margin: 0 0 0 20px; padding: 0; line-height: 1.6; }
/* E-Mail */
.att-mail-head { border-collapse: collapse; margin-bottom: 12px; font-size: 14px; }
.att-mail-head th { text-align: start; padding: 3px 14px 3px 0; color: var(--muted, #888); font-weight: 600; vertical-align: top; }
.att-mail-head td { padding: 3px 0; word-break: break-word; }
.att-mail-att { font-size: 13px; color: var(--muted, #888); margin-bottom: 10px; }
/* Archive */
.att-archive { border-collapse: collapse; width: 100%; font-size: 13px; }
.att-archive td { padding: 5px 8px; border-bottom: 1px solid var(--border, #eee); word-break: break-all; }
.att-archive-size { text-align: end; white-space: nowrap; color: var(--muted, #888); width: 1%; }
.att-archive-dir td:first-child { font-weight: 600; }
/* Sonstige Dateien */
.att-binary { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 26px 16px; background: var(--card, #fff); border: 1px solid var(--border, #ddd); border-radius: 10px; margin-bottom: 12px; }
.att-binary-icon { font-size: 42px; line-height: 1; }
.att-binary-name { font-weight: 700; word-break: break-all; }
.att-binary-facts { color: var(--muted, #888); font-size: 13px; }
.att-binary .att-preview-note { max-width: 520px; margin: 6px 0 10px; }
.att-binary-more { margin-bottom: 10px; }
.att-binary-more summary { cursor: pointer; font-size: 13px; font-weight: 600; padding: 6px 0; }
/* PDF */
.att-overlay-body .att-pdf { width: 100%; height: 100%; display: flex; flex-direction: column; min-height: 0; }
.att-pdf-bar { display: flex; align-items: center; gap: 6px; padding: 0 0 10px; flex-shrink: 0; }
.att-pdf-info { flex: 1; font-size: 13px; color: var(--muted, #888); }
.att-pdf-zoom { font-size: 13px; min-width: 52px; text-align: center; }
.att-pdf-pages { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 4px 12px 12px; background: var(--bg, #eef0f3); border-radius: 8px; }
.att-pdf-page { background: #fff; box-shadow: 0 1px 6px rgba(0,0,0,.18); width: fit-content; min-width: 120px; }
.att-pdf-page canvas { display: block; }
@media (max-width: 860px) {
  .att-doc { padding: 16px; font-size: 14px; }
  .att-slide { aspect-ratio: auto; }
}

/* --- Chat: Antworten und Reaktionen (Clu:Dashboard-Erweiterung, Punkt 8) --- */
.dm-row:hover .dm-msg-actions, .dm-row:focus-within .dm-msg-actions { display: flex; }
.dm-reply-ref { display: flex; flex-direction: column; gap: 1px; width: 100%; text-align: start; margin: 0 0 6px; padding: 4px 8px;
  border: none; border-inline-start: 3px solid var(--accent, #ff2b2b); border-radius: 6px; background: rgba(127, 127, 127, 0.12);
  color: inherit; font: inherit; cursor: pointer; }
.dm-reply-ref:hover { background: rgba(127, 127, 127, 0.2); }
.dm-reply-ref-author { font-size: 11px; font-weight: 600; color: var(--accent, #ff2b2b); }
.dm-reply-ref-text { font-size: 12px; opacity: .8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 320px; }
.dm-reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; padding: 0 4px; }
.dm-reactions:empty { display: none; }
.dm-row.me .dm-reactions { justify-content: flex-end; }
.dm-reaction { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; font-size: 13px; line-height: 20px;
  border: 1px solid var(--border-soft, rgba(127,127,127,.25)); background: var(--surface2, #f3f3f3); color: inherit; cursor: pointer; }
.dm-reaction:hover { border-color: var(--accent, #ff2b2b); }
.dm-reaction.mine { border-color: var(--accent, #ff2b2b); background: var(--accent-bg, rgba(255,43,43,.12)); }
.dm-reaction-count { font-size: 12px; font-variant-numeric: tabular-nums; }
.dm-reaction-picker { position: fixed; z-index: 1000; max-width: 320px; padding: 6px; border-radius: 12px;
  background: var(--surface, #fff); border: 1px solid var(--border-soft, rgba(127,127,127,.25)); box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.dm-reaction-picker button { border: none; background: none; font-size: 20px; line-height: 1; padding: 5px; border-radius: 8px; cursor: pointer; color: inherit; }
.dm-reaction-picker button:hover, .dm-reaction-picker button:focus-visible { background: rgba(127,127,127,.18); outline: none; }
.dm-reaction-quick { display: flex; align-items: center; gap: 2px; }
.dm-reaction-more { font-size: 16px !important; font-weight: 600; }
.dm-reaction-all { display: flex; flex-wrap: wrap; max-height: 180px; overflow-y: auto; margin-top: 6px; border-top: 1px solid var(--border-soft, rgba(127,127,127,.25)); padding-top: 6px; }
.dm-reply-bar { display: flex; align-items: center; gap: 8px; margin: 0 8px 4px; padding: 6px 10px; border-inline-start: 3px solid var(--accent, #ff2b2b);
  border-radius: 8px; background: rgba(127,127,127,.12); }
.dm-reply-bar-icon svg { width: 16px; height: 16px; opacity: .7; }
.dm-reply-bar-body { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.dm-reply-bar-x { border: none; background: none; font-size: 20px; cursor: pointer; color: inherit; opacity: .7; }
.dm-row.dm-highlight .dm-bubble { box-shadow: 0 0 0 2px var(--accent, #ff2b2b); transition: box-shadow .3s; }

/* --- Fokusmodus fuer das Clu:Dashboard (Chat bzw. Kalender als eigener Menuepunkt) --- */
body.clu-focus .tabs { display: none; }
body.clu-focus #brand-home { pointer-events: none; }

/* --- Feiertage im Kalender (Region aus dem Clu:Dashboard) --- */
.cal-holiday { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; font-weight: 600;
  padding: 1px 6px; border-radius: 6px; margin-bottom: 2px; cursor: default; }
.cal-holiday.off { background: var(--accent-bg, rgba(255,43,43,.12)); color: var(--accent, #ff2b2b); }
.cal-holiday.info { background: rgba(127,127,127,.14); color: inherit; font-weight: 500; opacity: .85; }
.cal-cell.holiday, .cal-weekcol.holiday { background-image: linear-gradient(rgba(255,43,43,.05), rgba(255,43,43,.05)); }
.dm-bubble.me .dm-reply-ref { background: rgba(255,255,255,.18); border-inline-start-color: rgba(255,255,255,.85); }
.dm-bubble.me .dm-reply-ref:hover { background: rgba(255,255,255,.26); }
.dm-bubble.me .dm-reply-ref-author { color: #fff; }

/* --- Drag-and-drop fuer Dateien (Clu:Dashboard-Erweiterung, Punkt 4) --- */
[data-file-drop-zone] { position: relative; }
.file-drop-over::after {
  content: attr(data-file-drop-label); position: absolute; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center;
  border: 2px dashed var(--accent, #ff2b2b); border-radius: 12px; background: var(--accent-bg, rgba(255,43,43,.12));
  color: var(--accent, #ff2b2b); font-weight: 600; pointer-events: none;
}

/* ============================================================
   Rechts-nach-links (ar, he, ur): html dir="rtl" setzt setLanguage() in i18n.js.
   Abstände, Ränder und Positionen nutzen logische Eigenschaften (inline-start/-end)
   und spiegeln sich damit von selbst, ebenso Flex-Reihen wie die Kanban-Spalten.
   Hier nur, was sich nicht von selbst spiegelt.
   ============================================================ */
[dir="rtl"] .switch .slider::before { left: auto; right: 3px; }
[dir="rtl"] .switch input:checked + .slider::before { transform: translateX(-22px); }
[dir="rtl"] .chat-toast-notif { animation-name: slideInNotifRtl; }
@keyframes slideInNotifRtl { from { transform: translateX(-100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
[dir="rtl"] .center-notice-item.is-mention { box-shadow: inset -3px 0 0 var(--warn, #f59e0b); }
/* Richtungspfeile (Abmelden, Senden, Antworten) zeigen in Leserichtung */
[dir="rtl"] #btn-logout svg,
[dir="rtl"] #dm-send,
[dir="rtl"] .dm-action-btn[data-action="reply-msg"] svg { transform: scaleX(-1); }
[dir="rtl"] #font-size-val { direction: ltr; unicode-bidi: isolate; }

/* Eigener Kalender aus dem Clu: Dashboard (ADR-062): Sekundärfarbe des Themes (--info), gepunkteter Rand, nur lesend */
.cal-entry.cal-own { --ecolor: var(--info, #64748b); border-style: dotted; font-weight: 600; }
.cal-entry.cal-own i { border-radius: 2px; box-shadow: none; }
.own-badge { display: inline-flex; align-items: center; gap: 6px; margin: 0 0 12px; padding: 3px 10px; border-radius: 999px;
  font-size: 0.78rem; font-weight: 700; color: var(--info, #64748b); background: color-mix(in srgb, var(--info, #64748b) 14%, transparent); }
.own-badge i { width: 8px; height: 8px; border-radius: 2px; background: var(--info, #64748b); }
.own-rows { display: grid; gap: 6px; margin-bottom: 12px; }
.own-row { display: flex; gap: 12px; justify-content: space-between; font-size: 0.9rem; }
.own-row span { color: var(--muted); }
.own-row strong { text-align: end; overflow-wrap: anywhere; }
.own-hint { margin: 6px 0 0; font-size: 0.8rem; color: var(--muted); }

/* Anmeldung nur über Clu: Dashboard (ADR-065 im Dashboard); Formular nur als Notfallzugang */
.login-sso { display: grid; gap: 12px; text-align: center; }
.login-sso-text { margin: 0; font-size: .95rem; line-height: 1.5; color: var(--text); opacity: .9; }
.login-breakglass { background: transparent; border: 1px solid var(--border); color: var(--text); opacity: .75; font-size: .85rem; }
.login-breakglass:hover { opacity: 1; }
