/* ==========================================================================
   ARBEITS|BRETT – Oberflaeche
   Flaches, ruhiges Design. Farben ausschliesslich ueber Tokens,
   damit Hell und Dunkel aus derselben Quelle kommen.
   Reihenfolge: 1 Tokens · 2 Grundlagen · 3 Bausteine · 4 Layout · 5 Board
                6 Dialoge · 7 Chat · 8 Login/Einstellungen · 9 Responsiv · 10 Druck
   ========================================================================== */

/* --- 1 Tokens ----------------------------------------------------------- */

:root {
  color-scheme: light;

  /* Markenflaechen. Beide Toene sind dunkel, darum steht alles, was
     unmittelbar darauf liegt, in heller Schrift. Karten, Spalten und
     Dialoge behalten ihre eigenen hellen Flaechen. */
  --bg:            #8F3F65;
  --on-bg:         #ffffff;
  --on-bg-2:       rgba(255, 255, 255, .78);
  --on-bg-soft:    rgba(255, 255, 255, .14);

  --sidebar-bg:          #182E50;
  --sidebar-text:        rgba(255, 255, 255, .80);
  --sidebar-text-strong: #ffffff;
  --sidebar-label:       rgba(255, 255, 255, .55);
  --sidebar-line:        rgba(255, 255, 255, .12);
  --sidebar-hover:       rgba(255, 255, 255, .09);
  --sidebar-active:      rgba(255, 255, 255, .17);

  /* Flaechen */
  --surface:       #ffffff;
  --surface-2:     #f2f2f5;
  --surface-sunk:  #eeeef2;

  /* Linien */
  --line:          #e3e3e9;
  --line-strong:   #d2d2dc;

  /* Text */
  --text:          #17171c;
  --text-2:        #55555f;
  --text-3:        #66666f;

  /* Akzent: derselbe Blauton wie die Spalte (#012041), nur ins Licht
     gehoben. Auf der pflaumenfarbenen Arbeitsflaeche steht er klar da,
     neben Seitenleiste und Spalten gehoert er sichtbar zur Familie. */
  --accent:        #0a6dc9;
  --accent-hover:  #08589f;
  --accent-soft:   #e8f1fb;
  --accent-text:   #ffffff;
  --accent-badge:  #08528f;

  /* Signale */
  --ok:            #14804a;
  --ok-soft:       #e6f5ed;
  --warn:          #9a6700;
  --warn-badge:    #7a5100;
  --warn-soft:     #fdf5e2;
  --danger:        #c02626;
  --danger-soft:   #fdecec;

  /* Form */
  --r-sm: 6px;
  --r:    9px;
  --r-lg: 14px;

  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;

  --ring: 0 0 0 3px color-mix(in srgb, var(--accent) 28%, transparent);
  --pop:  0 8px 28px rgba(20, 20, 30, .12), 0 1px 2px rgba(20, 20, 30, .06);

  --topbar-h: 56px;
  --sidebar-w: 248px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

html[data-resolved-theme="dark"] {
  color-scheme: dark;

  /* Die Marke bleibt auch im dunklen Modus die Marke. */
  --bg:            #8F3F65;
  --surface:       #17171c;
  --surface-2:     #1e1e24;
  --surface-sunk:  #121216;

  --line:          #2a2a32;
  --line-strong:   #3a3a45;

  --text:          #ecedf0;
  --text-2:        #a2a3ad;
  --text-3:        #9a9ba5;

  --accent:        #5aa8f2;
  --accent-hover:  #7cbbf7;
  --accent-soft:   #17293d;
  --accent-text:   #0b1520;
  --accent-badge:  #9acbf9;

  --ok:            #4ac585;
  --ok-soft:       #16281f;
  --warn:          #e0a33a;
  --warn-soft:     #2b2317;
  --warn-badge:    #e0a33a;
  --danger:        #f0716b;
  --danger-soft:   #2d1a1a;

  --pop: 0 12px 32px rgba(0, 0, 0, .5), 0 1px 2px rgba(0, 0, 0, .4);
}

/* Fallback, falls theme.js nicht laeuft: Systemeinstellung greift trotzdem. */
@media (prefers-color-scheme: dark) {
  html:not([data-resolved-theme="light"]) {
    color-scheme: dark;
    /* Die Marke bleibt auch im dunklen Modus die Marke. */
    --bg:            #8F3F65;
    --surface:       #17171c;
    --surface-2:     #1e1e24;
    --surface-sunk:  #121216;
    --line:          #2a2a32;
    --line-strong:   #3a3a45;
    --text:          #ecedf0;
    --text-2:        #a2a3ad;
    --text-3:        #9a9ba5;
    --accent:        #5aa8f2;
    --accent-hover:  #7cbbf7;
    --accent-soft:   #17293d;
    --accent-text:   #0b1520;
    --accent-badge:  #9acbf9;
    --ok:            #4ac585;
    --ok-soft:       #16281f;
    --warn:          #e0a33a;
    --warn-soft:     #2b2317;
    --warn-badge:    #e0a33a;
    --danger:        #f0716b;
    --danger-soft:   #2d1a1a;
    --pop: 0 12px 32px rgba(0, 0, 0, .5), 0 1px 2px rgba(0, 0, 0, .4);
  }
}

/* --- 2 Grundlagen ------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.3; letter-spacing: -.01em; }
h1 { font-size: 18px; }
h2 { font-size: 15px; }
h3 { font-size: 14px; }
p  { margin: 0 0 var(--sp-3); }
p:last-child { margin-bottom: 0; }

/* Kein Bild sprengt seinen Kasten – auch keins aus einer Beschreibung. */
img { max-width: 100%; height: auto; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

[hidden] { display: none !important; }
.hidden  { display: none !important; }

.muted, .hint, .text-2 { color: var(--text-2); }
.hint { font-size: 12.5px; font-weight: 400; }
.err  { color: var(--danger); }

:focus-visible {
  outline: none;
  box-shadow: var(--ring);
  border-radius: var(--r-sm);
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border: 3px solid transparent;
  background-clip: padding-box;
  border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover { background: var(--text-3); background-clip: padding-box; }

/* --- 3 Bausteine -------------------------------------------------------- */

/* Schaltflaechen */
.btn,
button {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
  color: var(--text);
  font: 500 13px/1 var(--font);
  cursor: pointer;
  white-space: nowrap;
  transition: box-shadow .12s ease;
}
.btn:hover,
button:hover { background: var(--surface-2); border-color: var(--line-strong); }
.btn:disabled,
button:disabled { opacity: .5; cursor: not-allowed; }

.btn--primary, .btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}
.btn--primary:hover, .btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn--ghost, .ghost, .btn--soft {
  background: transparent;
  border-color: transparent;
  color: var(--text-2);
}
.btn--ghost:hover, .ghost:hover, .btn--soft:hover {
  background: var(--surface-2);
  border-color: var(--line);
  color: var(--text);
}

.btn--sm { height: 26px; padding: 0 9px; font-size: 12.5px; }

.btn--danger {
  background: var(--danger-soft);
  border-color: transparent;
  color: var(--danger);
}

.icon-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  border-color: transparent;
  background: transparent;
  color: var(--text-2);
  font-size: 15px;
  line-height: 1;
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--line); color: var(--text); }
.icon-btn--sm { width: 24px; height: 24px; font-size: 13px; border-radius: var(--r-sm); }

/* Formularfelder */
.input,
input:not([type]), input[type="text"], input[type="email"], input[type="password"],
input[type="search"], input[type="date"], input[type="datetime-local"],
input[type="number"], input[type="tel"], input[type="url"],
select, textarea {
  width: 100%;
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
  color: var(--text);
  font: 400 13.5px/1.4 var(--font);
  transition: box-shadow .12s ease;
}
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):hover,
select:hover, textarea:hover { border-color: var(--line-strong); }
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):focus,
select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--ring);
}
input::placeholder, textarea::placeholder { color: var(--text-3); }
textarea { min-height: 84px; resize: vertical; }

select {
  appearance: none;
  padding-right: 28px;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
                    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 15px) 14px, calc(100% - 10px) 14px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

label {
  display: block;
  margin-bottom: var(--sp-1);
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 500;
}

.check, .inline-check {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin: 0;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 400;
  cursor: pointer;
}
.check input[type="checkbox"],
.inline-check input[type="checkbox"] {
  width: 15px; height: 15px; min-height: 0; margin: 0;
  accent-color: var(--accent);
  flex: 0 0 auto;
}
.inline-check--nowrap { white-space: nowrap; }
.check-grid { display: grid; gap: var(--sp-2); }

/* Etiketten */
.badge {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 7px;
  border-radius: 99px;
  background: var(--accent-soft);
  color: var(--accent-badge);
  font-size: 11px;
  font-weight: 600;
  vertical-align: middle;
}
.badge--muted { background: var(--surface-2); color: var(--text-2); }
.badge--superadmin { background: var(--accent-soft); color: var(--accent-badge); }
.badge--admin { background: var(--warn-soft); color: var(--warn-badge); }
.badge--member { background: var(--surface-2); color: var(--text-2); }

/* Layoutbausteine in Dialogen */
.form { display: grid; gap: var(--sp-3); }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
.row--end { justify-content: flex-end; }
.row--between { justify-content: space-between; align-items: flex-start; }
.row > .input, .row > select, .row > input { flex: 1 1 160px; width: auto; }
.row--between > .hint { flex: 1 1 240px; }
.row-actions { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }

.sep { height: 1px; background: var(--line); border: 0; margin: var(--sp-1) 0; }

.panel {
  padding: var(--sp-3);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface-2);
}
.panel-title { margin-bottom: var(--sp-2); font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.panel .hint { margin: var(--sp-2) 0 0; }

.empty-note {
  margin: 0;
  padding: var(--sp-4);
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-lg);
  color: var(--text-2);
  font-size: 13px;
  text-align: center;
}

/* Tabellen */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-lg); }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .03em;
  text-transform: uppercase;
  text-align: left;
  white-space: nowrap;
}
.table td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table .is-inactive { opacity: .55; }
.col-actions { text-align: right; white-space: nowrap; }
.col-actions > .btn + .btn { margin-left: var(--sp-1); }
.col-scope { color: var(--text-2); white-space: nowrap; }

/* Namensmarke */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  border-radius: 99px;
  background: var(--accent-soft);
  color: var(--accent-badge);
  font-size: 12px;
  font-weight: 600;
}

/* --- 4 Layout ----------------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  height: var(--topbar-h);
  padding: 0 var(--sp-4);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.brand { font-size: 14px; font-weight: 600; letter-spacing: -.01em; white-space: nowrap; }
.topbar-spacer { flex: 1; }
.topbar-actions, .topbar .right {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-left: auto;
}
.topbar .right a, .topbar-actions a { color: var(--text-2); }
.topbar .right a:hover, .topbar-actions a:hover { color: var(--text); }

.user-chip {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 3px 10px 3px 3px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: var(--surface-2);
  /* Ist ein Knopf, sieht aber aus wie vorher - er oeffnet das Startfenster. */
  font: inherit;
  cursor: pointer;
}
button.user-chip:hover { border-color: var(--accent); }
.user-name, .topbar .user { font-size: 13px; font-weight: 500; color: var(--text-2); }

.theme-icon::before { content: "◐"; font-size: 15px; }
html[data-resolved-theme="dark"] .theme-icon::before { content: "◑"; }

.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  align-items: start;
  min-height: calc(100vh - var(--topbar-h));
}

/* Seitenleiste */
.sidebar {
  position: sticky;
  top: var(--topbar-h);
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
  height: calc(100vh - var(--topbar-h));
  padding: var(--sp-4);
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background: var(--surface-sunk);
}
.side-section { display: flex; flex-direction: column; gap: 2px; }
.side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  min-height: 24px;
  margin-bottom: var(--sp-1);
}
.side-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-3);
}
.side-head-actions { display: flex; gap: var(--sp-1); }

.list { display: flex; flex-direction: column; gap: 2px; }
.list-empty { padding: var(--sp-2); color: var(--text-3); font-size: 12.5px; }

.item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  padding: 6px 8px;
  border-radius: var(--r);
  color: var(--text-2);
  font-size: 13.5px;
  cursor: pointer;
  transition: box-shadow .12s ease;
}
.item:hover { background: var(--surface-2); color: var(--text); }
.item.active {
  background: var(--accent-soft);
  color: var(--accent-badge);
  font-weight: 600;
}
.item-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .pdel { opacity: 0; color: var(--text-3); }
.item:hover .pdel, .item:focus-within .pdel { opacity: 1; }
.item .pdel:hover { color: var(--danger); background: var(--danger-soft); }

/* Projekte lassen sich ziehen. Der Greifer haelt sich zurueck, bis die
   Maus da ist - sonst steht vor jedem Namen ein Strichmuster. */
.item--drag { padding-left: 2px; }
.item--drag .item-label { flex: 1 1 auto; }
.item .grip {
  flex: none;
  width: 16px;
  color: var(--text-3);
  font-size: 13px;
  line-height: 1;
  text-align: center;
  cursor: grab;
  opacity: 0;
  transition: opacity .12s ease;
}
.item:hover .grip, .item:focus-within .grip, .item.active .grip { opacity: .85; }
.item .grip:active { cursor: grabbing; }
.item.sortable-chosen { background: var(--surface-2); }
.item.sortable-ghost { opacity: .35; }

.side-btn {
  justify-content: flex-start;
  width: 100%;
  height: 30px;
  padding: 0 8px;
  border-color: transparent;
  background: transparent;
  color: var(--text-2);
  font-weight: 500;
}
.side-btn:hover { background: var(--surface-2); border-color: transparent; color: var(--text); }
.side-btn--danger:hover { background: var(--danger-soft); color: var(--danger); }

/* Auf den Seiten ohne Board kommt die Leiste fertig vom Server, dort sind
   die Eintraege Links statt Knoepfe. Ohne das hier bekaemen sie den
   Unterstrich aller Links und stuenden zentriert. */
a.item, a.side-btn { text-decoration: none; }
a.item:hover, a.side-btn:hover { text-decoration: none; }
a.side-btn { justify-content: flex-start; }
/* Wo man gerade ist, bleibt markiert - sonst sucht man es sich zusammen. */
.side-btn--aktiv { background: var(--accent-soft); color: var(--accent-badge); font-weight: 600; }
.side-wer {
  padding: 2px 8px var(--sp-2);
  color: var(--text-3);
  font-size: 12.5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sidebar .side-wer { color: var(--sidebar-label); }

body.sidebar-collapsed .layout { grid-template-columns: 0 minmax(0, 1fr); }
body.sidebar-collapsed .sidebar {
  width: 0;
  padding-left: 0;
  padding-right: 0;
  overflow: hidden;
  border-right-color: transparent;
}

/* Inhaltsspalte */
.content {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  min-width: 0;
  padding: var(--sp-5);
}

.statusbar {
  display: none;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
  font-size: 13px;
}
.statusbar--ok   { display: block; background: var(--ok-soft);     border-color: transparent; color: var(--ok); }
.statusbar--err  { display: block; background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.statusbar--info { display: block; background: var(--accent-soft); border-color: transparent; color: var(--accent-badge); }

.content-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  flex-wrap: wrap;
}
.board-title { font-size: 20px; font-weight: 600; letter-spacing: -.02em; }
.content-actions { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.input--search, .search-input { width: 220px; }

.hint-line { margin: calc(var(--sp-4) * -1) 0 0; color: var(--text-3); font-size: 12.5px; }

/* --- 5 Board ------------------------------------------------------------ */

.board {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  overflow-x: auto;
  padding-bottom: var(--sp-4);
  min-height: 200px;
}
.board > .muted { padding: var(--sp-5); }

.lane {
  display: flex;
  flex-direction: column;
  flex: 0 0 300px;
  max-height: calc(100vh - 230px);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface-sunk);
}
/* Der Spaltenname steht in einer eigenen Zeile ueber den Werkzeugen.
   So bleibt er auch bei langen Namen einzeilig lesbar. */
.lane-head {
  display: grid;
  gap: var(--sp-2);
  padding: var(--sp-3);
  border-bottom: 1px solid var(--line);
}
.lane-head h2 {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-width: 0;
  font-size: 13px;
  font-weight: 600;
}
.lane-head .lane-name {
  min-width: 0;
  overflow-wrap: anywhere;
}
.grip, .card-grip {
  color: var(--text-3);
  cursor: grab;
  font-size: 12px;
  user-select: none;
}
.lane-actions { display: flex; justify-content: flex-end; gap: 2px; }
.lane-actions button {
  width: 26px;
  height: 26px;
  padding: 0;
  border-color: transparent;
  background: transparent;
  color: var(--text-3);
  font-size: 12px;
}
.lane-actions button:hover { background: var(--surface-2); border-color: var(--line); color: var(--text); }
.lane-actions .add { width: auto; padding: 0 9px; }
.lane-actions .pdf { width: auto; padding: 0 8px; font-size: 11px; }
.lane-actions .del:hover { background: var(--danger-soft); color: var(--danger); }

.card-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  padding: var(--sp-2);
  overflow-y: auto;
  min-height: 60px;
}

.card {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
  transition: box-shadow .12s ease;
}
.card:hover { border-color: var(--line-strong); }
.card-title-row { display: flex; align-items: flex-start; gap: var(--sp-2); }
.card-title { flex: 1; font-size: 13.5px; font-weight: 500; line-height: 1.4; word-break: break-word; }

.comment-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 99px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 11px;
  font-weight: 600;
}
.pulse { animation: fb-pulse 1.8s ease-in-out infinite; }
@keyframes fb-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .5; } }

/* Anhangvorschau auf der Karte: fester Rahmen, das Bild fuellt ihn nur aus.
   Ohne die Regel fuer das img waere die Originalgroesse zu sehen. */
.card-thumb {
  display: block;
  width: 100%;
  height: 132px;
  margin: var(--sp-2) 0 0;
  overflow: hidden;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--surface-2);
  cursor: zoom-in;
}
.card-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.card-thumb { position: relative; }
.card-thumb-count {
  position: absolute;
  right: 6px;
  bottom: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(15, 15, 20, .74);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .01em;
}
.card-thumb:hover { border-color: var(--line-strong); }
.card-thumb:focus-visible { outline: none; box-shadow: var(--ring); }
.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  margin-top: var(--sp-2);
  color: var(--text-3);
  font-size: 11.5px;
}
.card-actions {
  display: flex;
  gap: 2px;
  margin-top: var(--sp-2);
  padding-top: var(--sp-2);
  border-top: 1px solid var(--line);
  /* Die Werkzeuge sind dauerhaft sichtbar, nicht erst beim Ueberfahren. */
  opacity: 1;
}
.card-actions button, .card-actions .file-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: auto;
  height: 24px;
  padding: 0 7px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-3);
  font-size: 12px;
  cursor: pointer;
}
.card-actions button:hover, .card-actions .file-label:hover {
  background: var(--surface-2);
  border-color: var(--line);
  color: var(--text);
}
.card-actions .del:hover { background: var(--danger-soft); color: var(--danger); }
.card-actions .file-label .txt { font-size: 11.5px; }

.card--done    { border-left: 3px solid var(--ok); }
.card--blocked { border-left: 3px solid var(--danger); }
.card--unread  { border-left: 3px solid var(--accent); }

/* --- Wichtigkeit ---------------------------------------------------------
   Der Farbstreifen sitzt links an der Karte. Die Regeln stehen absichtlich
   nach den Status-Streifen: beim Ueberfliegen eines Bretts ist die
   Wichtigkeit die Angabe, die man zuerst sucht, also gewinnt sie den Platz.
   "ist egal" (Stufe 4) bekommt keine Regel - solche Karten bleiben so, wie
   sie sind, und behalten ihren Status-Streifen. */
.card--prio-1,
.card--prio-2 {
  border-color: var(--danger);
  border-left: 6px solid var(--danger);
  /* Der rote Rahmen liegt innen. So verschiebt sich beim Setzen der
     Wichtigkeit nichts im Layout. */
  box-shadow: inset 0 0 0 1px var(--danger);
}
.card--prio-3 { border-left: 6px solid var(--warn); }

/* Ohne diese Zeilen wuerde .card:hover den roten Rahmen ueberschreiben. */
.card--prio-1:hover,
.card--prio-2:hover { border-color: var(--danger); }
.card--prio-3:hover { border-left-color: var(--warn); }

/* "heute noch" pulsiert. Der Rahmen wird dicker und wieder duenner, die
   Karte selbst bewegt sich nicht - der Schatten liegt innen. Wer im
   Betriebssystem weniger Bewegung eingestellt hat, sieht durch die Regel
   weiter unten den ruhigen roten Rahmen. */
@keyframes fb-prio-pulse {
  0%, 100% { box-shadow: inset 0 0 0 1px var(--danger); }
  50%      { box-shadow: inset 0 0 0 3px var(--danger); }
}
.card--prio-2 { animation: fb-prio-pulse 1.6s ease-in-out infinite; }

.dragging-card, .card.is-dragging { opacity: .4; }
.drag-ghost {
  border: 1px dashed var(--accent) !important;
  background: var(--accent-soft) !important;
}

/* --- 5b Arbeitsplaner ----------------------------------------------------
   Der Planer steht neben dem Board, nicht darueber: die Karten bleiben
   sichtbar, damit man sie hinueberziehen kann. Vorbild ist der Planer von
   Trello - eine zweite, persoenliche Sicht auf dieselben Karten. Eine Karte
   zieht dabei nicht um und bekommt auch keine Frist; sie bekommt Zeit.

   Die Hoehe einer Stunde steht als Merkmal --pl-hour genau einmal hier.
   Die Anzeige rechnet Minuten in Vielfache davon um, ohne selbst zu messen.
   ------------------------------------------------------------------------ */

.workspace { display: flex; align-items: flex-start; gap: var(--sp-4); min-width: 0; }
.workspace > .board { flex: 1 1 auto; min-width: 0; }

.planner {
  --pl-gutter: 42px;
  --pl-hour: 42px;
  --pl-days: 3;
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
  width: var(--pl-w, 460px);
  max-width: 58%;
  max-height: calc(100vh - 170px);
  position: sticky;
  top: calc(var(--topbar-h) + var(--sp-4));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  color: var(--text);
}
.planner[hidden] { display: none; }

.planner-bar {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--line);
}
.planner-nav { display: flex; align-items: center; gap: 2px; }
.planner-nav .btn { padding: 3px 8px; font-size: 12px; }
.planner-range {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.planner-tools { display: flex; align-items: center; gap: 2px; }
.planner-tools select { width: auto; padding: 3px 6px; font-size: 12px; }

/* Kopf, Fristen und Raster teilen sich dieselben Spalten. Alle drei liegen
   im selben Rollbereich, damit sie auch mit Rollbalken buendig bleiben. */
.planner-head, .planner-due, .planner-grid {
  display: grid;
  grid-template-columns: var(--pl-gutter) repeat(var(--pl-days), minmax(0, 1fr));
}
.planner-scroll { flex: 1 1 auto; overflow: auto; }
.planner-sticky { position: sticky; top: 0; z-index: 3; background: var(--surface); }
.planner-head { border-bottom: 1px solid var(--line); background: var(--surface-2); }
.pl-corner { border-right: 1px solid var(--line); }
.pl-daytitle {
  padding: 4px 3px;
  border-left: 1px solid var(--line);
  text-align: center;
  font-size: 11px;
  line-height: 1.3;
  color: var(--text-2);
}
.pl-daytitle b { display: block; font-size: 12.5px; color: var(--text); }
.pl-daytitle .pl-sum { display: block; font-size: 10px; color: var(--text-3); }
.pl-daytitle--today { background: var(--accent-soft); }

.planner-due { min-height: 24px; border-bottom: 1px solid var(--line); }
.pl-duelabel { padding: 4px; text-align: right; font-size: 10px; color: var(--text-3); }
.pl-duecell {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 3px;
  border-left: 1px solid var(--line);
}
.pl-due {
  padding: 1px 5px;
  border-radius: var(--r-sm);
  background: var(--warn-soft);
  color: var(--warn-badge);
  font-size: 11px;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pl-hour {
  height: var(--pl-hour);
  padding-right: 4px;
  border-right: 1px solid var(--line);
  text-align: right;
  font-size: 10px;
  color: var(--text-3);
}
.pl-day {
  position: relative;
  height: calc(var(--pl-hour) * 24);
  border-left: 1px solid var(--line);
  background-image: repeating-linear-gradient(
    to bottom,
    var(--line) 0, var(--line) 1px,
    transparent 1px, transparent var(--pl-hour));
  cursor: crosshair;
}
.pl-day--today { background-color: color-mix(in srgb, var(--accent) 6%, transparent); }

.pl-block {
  position: absolute;
  left: 2px;
  right: 2px;
  overflow: hidden;
  padding: 2px 5px;
  border: 1px solid var(--accent);
  border-left-width: 3px;
  border-radius: var(--r-sm);
  background: var(--accent-soft);
  color: var(--text);
  font-size: 11px;
  line-height: 1.25;
  cursor: grab;
}
.pl-block b { display: block; font-size: 11.5px; overflow-wrap: anywhere; }
.pl-block .pl-time { color: var(--text-3); font-size: 10px; }
.pl-block .pl-cards { color: var(--text-2); overflow-wrap: anywhere; }
.pl-block .pl-more { color: var(--accent-badge); }
.pl-block.is-target { outline: 2px solid var(--ok); outline-offset: 1px; }
.pl-block-resize { position: absolute; left: 0; right: 0; bottom: 0; height: 7px; cursor: ns-resize; }

.pl-ghostblock {
  position: absolute;
  left: 2px;
  right: 2px;
  padding: 1px 5px;
  border: 1px dashed var(--accent);
  border-radius: var(--r-sm);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  font-size: 10px;
  color: var(--text-2);
  pointer-events: none;
}
/* Die Linie der laufenden Stunde - nur am heutigen Tag. */
.pl-now { position: absolute; left: 0; right: 0; border-top: 2px solid var(--danger); pointer-events: none; }

.pl-drag-ghost {
  position: fixed;
  z-index: 9999;
  max-width: 220px;
  padding: 4px 8px;
  border: 1px solid var(--accent);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  box-shadow: var(--pop);
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.planner-pool {
  display: flex;
  flex-direction: column;
  max-height: 168px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}
.planner-pool-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  padding: 6px var(--sp-3) 4px;
}
.planner-pool-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  padding: 0 var(--sp-2) var(--sp-2);
}
.pl-pool-card {
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  font-size: 12px;
  cursor: grab;
}
.pl-pool-card .muted { font-size: 10.5px; }
.pl-pool-card.is-due { border-left: 3px solid var(--warn); }
.planner-pool-list > .muted { padding: 4px 6px; }

/* Der Block-Dialog listet die Karten, die an einem Block haengen. */
.pl-dlg-cards { display: grid; gap: var(--sp-2); }
.pl-dlg-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  flex-wrap: wrap;
  padding: var(--sp-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-2);
}

/* --- 6 Dialoge ---------------------------------------------------------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: var(--sp-6) var(--sp-4);
  overflow-y: auto;
  background: rgba(15, 15, 20, .45);
}
html[data-resolved-theme="dark"] .modal { background: rgba(0, 0, 0, .6); }

.modal-card {
  width: min(760px, 100%);
  /* Der Dialog bleibt im Bild: was nicht passt, scrollt innen. Sonst
     wandert die Speichern-Zeile bei langem Inhalt aus dem Fenster. */
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 2 * var(--sp-6));
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--pop);
  animation: fb-rise .14s ease-out;
}
/* Breite Stufe fuer Dialoge mit mehreren Spalten (Karte bearbeiten). */
.modal-card--wide { width: min(1180px, 100%); }
@keyframes fb-rise { from { opacity: 0; transform: translateY(6px); } }

.modal-head {
  display: flex;
  flex: none;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4);
  border-bottom: 1px solid var(--line);
}
.modal-title { flex: 1; font-size: 15px; font-weight: 600; }
.modal-actions { display: flex; gap: var(--sp-2); }
.modal-body { flex: 1 1 auto; min-height: 0; padding: var(--sp-4); overflow-y: auto; }

/* Kartendialog */
.card-edit-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr) minmax(0, 1.1fr);
  gap: var(--sp-5);
  align-items: start;
}
.ce-col { min-width: 0; display: grid; gap: var(--sp-3); align-content: start; }
.ce-col > h3 {
  padding-bottom: var(--sp-2);
  border-bottom: 1px solid var(--line);
  color: var(--text-2);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.ce-col > h3 + * { margin-top: calc(var(--sp-1) * -1); }

/* Beschriftung ueber dem Feld, beides gehoert zusammen. */
.field { display: grid; gap: 6px; min-width: 0; }
.field > label { color: var(--text-2); font-size: 12.5px; font-weight: 500; }
.field > input, .field > select, .field > textarea { width: 100%; }
/* Die Beschreibung ist der Grund, warum der Dialog offen ist - sie
   bekommt die Hoehe, die das Fenster hergibt. Nach oben gedeckelt,
   damit auf einem hohen Bildschirm kein Feldrand ins Nichts laeuft. */
.ce-main .rte-area { min-height: clamp(220px, 52vh, 640px); }
.ce-comments .comment-box { max-height: 320px; }
.ce-comments textarea { min-height: 90px; }
.att-list { display: grid; gap: var(--sp-2); }

.rte { display: grid; gap: 0; }
.rte-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2);
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: var(--r) var(--r) 0 0;
  background: var(--surface-2);
}
/* Was zusammengehoert, steht eng; dazwischen ein Strich. Vorher stand
   alles im selben Abstand und "1. Liste Link Reset" las sich als ein Wort. */
.rte-gruppe { display: flex; align-items: center; gap: 2px; }
.rte-trenner { width: 1px; height: 18px; background: var(--line); }
.rte-bar button {
  height: 26px;
  min-width: 26px;
  padding: 0 var(--sp-2);
  border-color: transparent;
  background: transparent;
  color: var(--text-2);
  font-size: 12.5px;
  white-space: nowrap;
}
/* Buchstabenknoepfe brauchen keine Innenpolsterung - und B I U S sollen
   gleich breit stehen, damit sie als Reihe lesbar sind. */
.rte-bar button.rte-icon { width: 28px; min-width: 28px; padding: 0; font-size: 14px; }
.rte-bar button:hover { background: var(--surface); border-color: var(--line); }
.rte-bar button.is-an {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent-badge);
}
.rte-area {
  min-height: 160px;
  padding: var(--sp-3);
  border: 1px solid var(--line);
  border-radius: 0 0 var(--r) var(--r);
  background: var(--surface);
  overflow-y: auto;
  /* Wem die Hoehe nicht passt, der zieht die untere Kante. */
  resize: vertical;
  font-size: 13.5px;
  line-height: 1.55;
}
.rte-area a { color: var(--accent); }
.rte-area ul, .rte-area ol { margin: var(--sp-2) 0; padding-left: var(--sp-5); }
.rte-area li { margin: 2px 0; }
.rte-area p { margin: 0 0 var(--sp-2); }
.rte-area > *:last-child { margin-bottom: 0; }
.rte-area:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }

.comment-box {
  display: grid;
  gap: var(--sp-2);
  max-height: 260px;
  padding: var(--sp-2);
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface-sunk);
}
.comment-item {
  padding: var(--sp-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  font-size: 13px;
}
.comment-item b { font-size: 12.5px; }
.comment-form { display: grid; gap: var(--sp-2); }

.att {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  font-size: 13px;
}
.att img {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  cursor: zoom-in;
}
.att a { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-del { width: 24px; height: 24px; padding: 0; border-color: transparent; background: transparent; color: var(--text-3); }
.att-del:hover { background: var(--danger-soft); color: var(--danger); }

/* Grossansicht im Dialog: passt sich immer dem Fenster an. */
.lightbox { display: grid; justify-items: center; gap: var(--sp-3); }
.lightbox img {
  max-width: 100%;
  max-height: 70vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: var(--r);
  border: 1px solid var(--line);
  background: var(--surface-2);
}
.lightbox a { font-size: 13px; }

/* Auswahlleiste der Galerie */
.gal-strip { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.gal-pick {
  width: 60px;
  height: 46px;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  cursor: pointer;
}
.gal-pick img { display: block; width: 100%; height: 100%; object-fit: cover; }
.gal-pick.is-active { border-color: var(--accent); box-shadow: var(--ring); }

/* Mitglieder */
.member-list { display: grid; gap: var(--sp-2); }
.member {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  flex-wrap: wrap;
  padding: 10px var(--sp-3);
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
}
.member-id { display: flex; align-items: center; gap: var(--sp-2); min-width: 0; }
.member-name { display: flex; align-items: center; gap: var(--sp-2); font-size: 13.5px; font-weight: 500; }
.member-mail { color: var(--text-3); font-size: 12px; }
.member-actions { display: flex; align-items: center; gap: var(--sp-2); }
.input--role { width: auto; min-width: 180px; }
.role-static { color: var(--text-3); font-size: 12.5px; }

/* Suche und Aktivitaet */
.search-result {
  padding: 10px var(--sp-3);
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
  cursor: pointer;
  font-size: 13.5px;
}
.search-result:hover { border-color: var(--accent); background: var(--accent-soft); }
.acts { display: grid; gap: 0; max-height: 60vh; overflow-y: auto; }
.act { padding: 8px 10px; border-bottom: 1px solid var(--line); font-size: 13px; }
.act:last-child { border-bottom: 0; }

.box {
  padding: var(--sp-3);
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
}

/* --- 7 Chat ------------------------------------------------------------- */

.chat-backdrop {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: rgba(15, 15, 20, .3);
}

.chat-dock { position: fixed; right: var(--sp-5); bottom: var(--sp-5); z-index: 160; }

.chat-toggle {
  position: relative;
  height: 38px;
  padding: 0 16px;
  border-radius: 99px;
  border-color: var(--line);
  background: var(--surface);
  box-shadow: var(--pop);
  font-weight: 600;
}
.chat-toggle.has-unread { border-color: var(--accent); color: var(--accent); }
.chat-pulse {
  position: absolute;
  top: 6px;
  right: 8px;
  width: 8px;
  height: 8px;
  border-radius: 99px;
  background: var(--accent);
  animation: fb-pulse 1.8s ease-in-out infinite;
}

.chat-panel {
  position: absolute;
  right: 0;
  bottom: 48px;
  display: flex;
  flex-direction: column;
  width: min(360px, calc(100vw - 32px));
  height: min(460px, calc(100vh - 140px));
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--pop);
  overflow: hidden;
  opacity: 0;
  transform: translateY(8px) scale(.98);
  pointer-events: none;
  visibility: hidden;
  transition: opacity .14s ease, transform .14s ease, visibility .14s;
}
.chat-panel.is-open { opacity: 1; transform: none; pointer-events: auto; visibility: visible; }

.chat-head {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3);
  border-bottom: 1px solid var(--line);
}
.chat-title {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-messages {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  padding: var(--sp-3);
  overflow-y: auto;
  background: var(--surface-sunk);
}
.chat-msg {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
  font-size: 13px;
  line-height: 1.45;
  word-break: break-word;
}
.chat-msg .meta { margin-bottom: 2px; color: var(--text-3); font-size: 11.5px; }
.chat-form {
  display: flex;
  gap: var(--sp-2);
  padding: var(--sp-3);
  border-top: 1px solid var(--line);
}
.chat-form .input, .chat-form input { flex: 1; }

/* --- 8 Login und Einstellungen ------------------------------------------ */

body.auth {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: var(--sp-4);
}
.auth-card, .login-card {
  width: min(400px, 100%);
  display: grid;
  gap: var(--sp-3);
  padding: var(--sp-6);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--pop);
}
.auth-card h1, .login-card h1 { font-size: 17px; }
.auth-card label { margin-bottom: 0; }
.auth-card button[type="submit"] {
  margin-top: var(--sp-2);
  height: 36px;
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}
.auth-card button[type="submit"]:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.login-shell { display: grid; place-items: center; min-height: 100vh; padding: var(--sp-4); }
.login-logo-placeholder { display: none; }
.theme-quick { max-width: 160px; }

main.settings-page {
  max-width: 1080px;
  margin: 0 auto;
  padding: var(--sp-5) var(--sp-4);
  display: grid;
  gap: var(--sp-4);
}
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--sp-4);
  align-items: start;
}
.settings-card, .system-grid {
  display: grid;
  gap: var(--sp-2);
  padding: var(--sp-4);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
}
.settings-card h2 {
  margin-bottom: var(--sp-2);
  padding-bottom: var(--sp-2);
  border-bottom: 1px solid var(--line);
}
.settings-card label:not(.check):not(.inline-check) { margin-top: var(--sp-2); }

/* Hilfeseite nutzt .lane als Textblock */
body:not(.auth) main.content > .lane { flex: 1 1 auto; max-height: none; background: var(--surface); }

/* Umschalten des Farbmodus ohne Uebergangs-Artefakte */
html.theme-switching, html.theme-switching *, html.theme-switching *::before, html.theme-switching *::after {
  transition: none !important;
}

/* --- 8b Markenflaechen ---------------------------------------------------
   Zwei Regeln reichen fuer die Flaechen selbst. Der Rest hier faerbt nur,
   was ohne eigene Flaeche unmittelbar darauf steht - Ueberschriften,
   Hinweise, randlose Schaltflaechen. Alles mit eigener heller Flaeche
   (Karten, Spalten, Dialoge, Eingabefelder) bleibt unberuehrt.
   ------------------------------------------------------------------------ */

.sidebar {
  background: var(--sidebar-bg);
  border-right-color: var(--sidebar-line);
  color: var(--sidebar-text);
}
.sidebar .side-label   { color: var(--sidebar-label); }
.sidebar .list-empty   { color: var(--sidebar-label); }
.sidebar .item         { color: var(--sidebar-text); }
.sidebar .item:hover   { background: var(--sidebar-hover); color: var(--sidebar-text-strong); }
.sidebar .item.active  { background: var(--sidebar-active); color: var(--sidebar-text-strong); }
.sidebar .item .pdel   { color: var(--sidebar-label); }
.sidebar .item .grip   { color: var(--sidebar-label); }
.sidebar .item .pdel:hover { background: rgba(255, 130, 130, .18); color: #ffc2c2; }
.sidebar .side-btn     { color: var(--sidebar-text); }
.sidebar .side-btn:hover {
  background: var(--sidebar-hover);
  border-color: transparent;
  color: var(--sidebar-text-strong);
}
.sidebar .side-btn--danger:hover { background: rgba(255, 130, 130, .18); color: #ffc2c2; }
.sidebar .side-btn--aktiv { background: var(--sidebar-active); color: var(--sidebar-text-strong); }
.sidebar .icon-btn     { color: var(--sidebar-label); }
.sidebar .icon-btn:hover {
  background: var(--sidebar-hover);
  border-color: transparent;
  color: var(--sidebar-text-strong);
}

.board-title              { color: var(--on-bg); }
.hint-line                { color: var(--on-bg-2); }
.board > .muted           { color: var(--on-bg-2); }
.content > .muted         { color: var(--on-bg-2); }
.content-actions .btn--ghost { color: var(--on-bg-2); }
.content-actions .btn--ghost:hover {
  background: var(--on-bg-soft);
  border-color: transparent;
  color: var(--on-bg);
}

/* Spalten und Karten tragen eigene Farben, in beiden Farbmodi dieselben.
   Statt jede der rund dreissig Regeln im Board einzeln umzufaerben, werden
   hier nur die Merkmale neu belegt - Karten, Kopfzeilen, Werkzeuge,
   Anhaenge und Kommentare lesen sie ohnehin schon aus und ziehen mit. */
.lane {
  --surface-sunk:  #012041;   /* die Spalte selbst */
  --surface:       #01162C;   /* die Karten darin - derselbe Blauton, dunkler */
  --surface-2:     #023265;   /* Flaechen beim Ueberfahren - derselbe Blauton, heller */

  --line:          rgba(255, 255, 255, .14);
  --line-strong:   rgba(255, 255, 255, .28);

  --text:          #f1f2f4;
  --text-2:        #c2c5cb;
  --text-3:        #9ba1a9;

  /* Signalfarben in der dunklen Fassung, sonst waere etwa das Rot beim
     Loeschen auf der dunklen Karte kaum zu erkennen. Der Akzent gehoert
     dazu: in seiner hellen Stufe hebt er sich vom Blau der Karte ab,
     in der dunklen ginge er darin unter. */
  --accent:        #5aa8f2;
  --accent-hover:  #7cbbf7;
  --accent-text:   #0b1520;
  --accent-soft:   #0d3a66;
  --accent-badge:  #bcdcfb;
  --ok:            #4ac585;
  --ok-soft:       #16281f;
  --warn:          #e0a33a;
  --warn-badge:    #e0a33a;
  --warn-soft:     #2b2317;
  --danger:        #f0716b;
  --danger-soft:   #2d1a1a;

  color: var(--text);
}

/* --- 9 Responsiv -------------------------------------------------------- */

/* Zwischenstufe: Kommentare rutschen unter Text und Eigenschaften. */
@media (max-width: 1100px) {
  .card-edit-grid { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
  .ce-comments { grid-column: 1 / -1; }
}

@media (max-width: 960px) {
  .layout, body.sidebar-collapsed .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    z-index: 100;
    width: var(--sidebar-w);
    box-shadow: var(--pop);
    transition: transform .16s ease;
  }
  body.sidebar-collapsed .sidebar {
    width: var(--sidebar-w);
    padding: var(--sp-4);
    transform: translateX(-100%);
    visibility: hidden;
    pointer-events: none;
  }
  .content { padding: var(--sp-4); }
  .card-edit-grid { grid-template-columns: minmax(0, 1fr); gap: var(--sp-4); }
  .user-name { display: none; }
  .input--search, .search-input { width: 150px; }
  .workspace { flex-direction: column; }
  .planner { position: static; width: 100%; max-width: 100%; max-height: 72vh; }
}

@media (max-width: 560px) {
  .brand { font-size: 13px; }
  .topbar { padding: 0 var(--sp-3); gap: var(--sp-2); }
  .lane { flex-basis: 84vw; }
  .board-title { font-size: 17px; }
  .chat-dock { right: var(--sp-3); bottom: var(--sp-3); }
  .modal { padding: var(--sp-3); }
  .modal-card { max-height: calc(100vh - 2 * var(--sp-3)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

/* --- 10 Druck ----------------------------------------------------------- */

/* --- Neuigkeiten ---------------------------------------------------------
   Eigene Seite, kein Board: eine Lesespalte statt Spalten nebeneinander.
   Die Breite ist bewusst begrenzt - Fliesstext ueber die ganze Breite
   eines Monitors liest niemand gern. */
.news-page { max-width: 1000px; margin: 0 auto; }
/* Von den Neuigkeiten aus ins Board: ein Knopf je Projekt, in der
   Reihenfolge der Seitenleiste. */
.news-go {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
  margin: var(--sp-4) 0;
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
}
.news-go-label { color: var(--text-2); font-size: 12.5px; font-weight: 600; }
.news-go-mehr { margin-left: auto; color: var(--text-3); font-size: 12.5px; }
.news-go-mehr:hover { color: var(--accent); }
@media (max-width: 560px) { .news-go-mehr { margin-left: 0; } }

.news-filter {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: var(--sp-4); margin: var(--sp-4) 0;
}
.news-filter-feld {
  display: flex; align-items: center; gap: var(--sp-2);
  font-size: 12.5px; color: var(--text-2);
}
.news-filter-feld select {
  height: 30px; padding: 0 var(--sp-2);
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface); color: var(--text); font: inherit; font-size: 12.5px;
}

/* Zwei Kacheln nebeneinander. minmax(0, 1fr) statt 1fr: sonst sprengt ein
   langer Titel ohne Leerzeichen die Spalte auf. */
.news-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-4);
  align-items: stretch;
}
@media (max-width: 720px) { .news-list { grid-template-columns: 1fr; } }

.news-item {
  display: flex; flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  transition: box-shadow .15s ease, transform .15s ease;
}
.news-item:hover { box-shadow: 0 6px 18px rgba(0,0,0,.10); transform: translateY(-2px); }

/* Erkannte Frist, noch unbestaetigt: gelb. Laeuft sie in den naechsten
   vier Wochen ab, rot. Dieselbe Bedeutung wie bei den Karten - nur sitzt
   der Streifen bei einer Kachel oben statt links. */
.news-item--frist { border-color: var(--warn); box-shadow: inset 0 4px 0 var(--warn); }
.news-item--bald  { border-color: var(--danger); box-shadow: inset 0 4px 0 var(--danger); }
.news-item--frist:hover { box-shadow: inset 0 4px 0 var(--warn), 0 6px 18px rgba(0,0,0,.10); }
.news-item--bald:hover  { box-shadow: inset 0 4px 0 var(--danger), 0 6px 18px rgba(0,0,0,.10); }

/* Festes Seitenverhaeltnis, damit die Kacheln einer Reihe gleich hoch
   anfangen. Die Bilder der Quellen haben jedes Format - object-fit
   schneidet zu, statt sie zu verzerren. */
.news-cover {
  display: block; position: relative;
  aspect-ratio: 2 / 1; flex: none;
  background: var(--bg-2, rgba(128,128,128,.10));
  overflow: hidden;
}
.news-cover img {
  width: 100%; height: 100%;
  object-fit: cover; display: block;
  border: 0;
}
.news-item--frist .news-cover, .news-item--bald .news-cover { margin-top: 4px; }

/* Ohne Bild: ein ruhiger Farbverlauf mit der Rubrik darin. Der Farbton
   kommt aus dem Quellennamen (--ton), damit eine Quelle wiedererkennbar
   bleibt. */
.news-cover--leer {
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg,
    hsl(var(--ton, 210) 42% 92%) 0%,
    hsl(calc(var(--ton, 210) + 28) 38% 84%) 100%);
}
/* Die Rubrik steht auf jeder Kachel. Ueber einem Bild als kleines Schild
   unten links, auf der bildlosen Kachel gross in der Mitte. */
.news-kat {
  position: absolute; left: var(--sp-3); bottom: var(--sp-3);
  padding: 3px var(--sp-2); border-radius: var(--r-sm);
  background: rgba(20, 20, 24, .68); color: #fff;
  font-size: 11px; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase;
}
.news-cover--leer .news-kat {
  position: static; padding: 0; background: none;
  font-size: 13px; letter-spacing: .08em;
  color: hsl(var(--ton, 210) 38% 32%);
}
[data-resolved-theme="dark"] .news-cover--leer {
  background: linear-gradient(135deg,
    hsl(var(--ton, 210) 26% 22%) 0%,
    hsl(calc(var(--ton, 210) + 28) 24% 16%) 100%);
}
[data-resolved-theme="dark"] .news-cover--leer .news-kat { color: hsl(var(--ton, 210) 30% 76%); }

/* Der Text waechst, die Schaltflaechen bleiben unten - sonst tanzen sie
   von Kachel zu Kachel auf einer anderen Hoehe. */
.news-body { flex: 1 1 auto; padding: var(--sp-4) var(--sp-4) 0; }

.news-meta {
  display: flex; flex-wrap: wrap; gap: var(--sp-2);
  margin-bottom: var(--sp-2); font-size: 12px; color: var(--text-3);
}
.news-source { font-weight: 600; color: var(--text-2); }
.news-date::before { content: "·"; margin-right: var(--sp-2); }

.news-title { margin: 0 0 var(--sp-2); font-size: 15px; line-height: 1.35; font-weight: 600; }
.news-title a { color: inherit; text-decoration: none; }
.news-title a:hover { text-decoration: underline; }

/* Drei Zeilen Anriss. Ohne die Begrenzung entscheidet die laengste
   Meldung, wie hoch die ganze Reihe wird. */
.news-summary {
  margin: 0 0 var(--sp-3); font-size: 13px; line-height: 1.5; color: var(--text-2);
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3;
  overflow: hidden;
}

.news-frist {
  margin: 0 0 var(--sp-3); padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-sm); background: var(--warn-soft);
  font-size: 12.5px; line-height: 1.5;
}
.news-item--bald .news-frist { background: var(--danger-soft); }
.news-frist-rest  { margin-left: var(--sp-2); }
.news-frist-zitat { display: block; margin-top: 2px; color: var(--text-2); font-style: italic; }

.news-actions {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4) var(--sp-4);
}
.news-target {
  height: 26px; max-width: 100%; flex: 1 1 140px; padding: 0 var(--sp-2);
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface); color: var(--text); font: inherit; font-size: 12.5px;
}
.news-done { font-size: 12.5px; color: var(--ok); }

/* Quellenverwaltung. Nur Administratoren sehen den Abschnitt. */
.news-sources { margin-top: var(--sp-6); }
.news-src-wrap { overflow-x: auto; }
.news-src-tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.news-src-tbl th {
  padding: var(--sp-2); border-bottom: 1px solid var(--line);
  text-align: left; font-weight: 600; color: var(--text-2); white-space: nowrap;
}
.news-src-tbl td { padding: var(--sp-2); border-bottom: 1px solid var(--line); vertical-align: top; }
.news-src-tbl .input { height: 26px; font-size: 12.5px; min-width: 110px; }
.news-src-tbl .src-url .input, .news-src-tbl td:nth-child(2) .input { min-width: 220px; }
.src-last { white-space: nowrap; color: var(--text-3); }
.src-err  { color: var(--danger); }
.src-btns { white-space: nowrap; }

/* Der Hinweis nach der Anmeldung. */
.news-pop-list { margin: var(--sp-3) 0 0; padding: 0; list-style: none; }
.news-pop-item {
  display: grid; gap: 2px;
  padding: var(--sp-3) 0; border-top: 1px solid var(--line);
}
.news-pop-datum  { font-size: 12.5px; font-weight: 600; color: var(--danger); }
.news-pop-titel  { font-size: 13px; line-height: 1.4; }
.news-pop-titel a { color: inherit; }
.news-pop-quelle { font-size: 12px; color: var(--text-3); }

@media (max-width: 640px) {
  .news-actions .news-target { max-width: 100%; width: 100%; }
  /* Auf dem Handy passen die vier Schaltflaechen nicht in eine Zeile.
     Nur auf dieser Seite: die Kopfzeile darf umbrechen statt die Seite
     nach rechts zu schieben. */
  .topbar--wrap {
    height: auto;
    flex-wrap: wrap;
    row-gap: var(--sp-2);
    padding-top: var(--sp-2);
    padding-bottom: var(--sp-2);
  }
  .topbar--wrap .topbar-spacer { flex-basis: 100%; height: 0; }
  .topbar--wrap .topbar-actions { flex-wrap: wrap; }
}


@media print {
  .topbar, .sidebar, .chat-dock, .chat-backdrop, .card-actions,
  .lane-actions, .content-actions, .statusbar, .hint-line,
  .planner { display: none !important; }
  body { background: #fff; color: #000; }
  .board-title, .board > .muted, .content > .muted { color: #000; }
  .layout { display: block; }
  .content { padding: 0; }
  .board { display: block; }
  .workspace { display: block; }
  /* Auf Papier zaehlt Lesbarkeit, nicht die Hausfarbe: die Merkmale der
     Spalte werden fuer den Druck wieder auf Schwarz auf Weiss gestellt. */
  .lane {
    --surface: #fff; --surface-sunk: #fff; --surface-2: #fff;
    --text: #000; --text-2: #222; --text-3: #444;
    --line: #ddd; --line-strong: #ccc;
    break-inside: avoid; border: 1px solid #ddd; margin-bottom: 16px; max-height: none;
  }
  .card { break-inside: avoid; border: 1px solid #ddd; }
}
