/* =============================================================================
   Kanban-Board – Design-System
   Orientiert am Notion-Look: warme Graustufen, sehr zurueckhaltende Rahmen,
   pastellige Tags, viel Weissraum. Licht- und Dunkelmodus.
   ============================================================================= */

/* --- Design-Tokens --------------------------------------------------------- */

:root {
  --font-sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
    Helvetica, "Apple Color Emoji", Arial, sans-serif, "Segoe UI Emoji";
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  /* Flaechen */
  --bg: #ffffff;
  --bg-subtle: #f7f7f5;
  --surface: #ffffff;
  --surface-hover: rgba(55, 53, 47, 0.06);
  --surface-active: rgba(55, 53, 47, 0.1);

  /* Text */
  --text: #37352f;
  --text-2: rgba(55, 53, 47, 0.65);
  --text-3: rgba(55, 53, 47, 0.45);

  /* Linien */
  --border: rgba(55, 53, 47, 0.09);
  --border-strong: rgba(55, 53, 47, 0.16);

  /* Akzent */
  --accent: #2383e2;
  --accent-hover: #1a6dbf;
  --accent-soft: rgba(35, 131, 226, 0.12);
  --danger: #eb5757;
  --danger-soft: rgba(235, 87, 87, 0.12);

  /* Schatten */
  --shadow-card: rgba(15, 15, 15, 0.1) 0 0 0 1px, rgba(15, 15, 15, 0.1) 0 1px 2px;
  --shadow-card-hover: rgba(15, 15, 15, 0.1) 0 0 0 1px, rgba(15, 15, 15, 0.12) 0 3px 6px;
  --shadow-pop: rgba(15, 15, 15, 0.05) 0 0 0 1px, rgba(15, 15, 15, 0.1) 0 3px 6px,
    rgba(15, 15, 15, 0.2) 0 9px 24px;

  --radius-sm: 4px;
  --radius: 6px;
  --radius-lg: 10px;

  /* Diagrammfarben. Einzelne Datenreihe -> eine Farbe, kein Regenbogen.
     Gegen die Kartenflaeche geprueft (Kontrast >= 3:1 in beiden Modi). */
  --viz-series: #2a78d6;
  --viz-grid: #e1e0d9;
  --viz-axis: #c3c2b7;
  --viz-muted: #898781;

  /* Statusfarben sind fest und werden nie umgefaerbt. Sie treten immer
     zusammen mit Text auf, nie als alleiniger Traeger der Bedeutung. */
  --status-good: #0ca30c;
  --status-warning: #fab219;
  --status-serious: #ec835a;
  --status-critical: #d03b3b;

  /* Notion-Tag-Pastelltoene (hell) */
  --tag-gray-bg: #e3e2e0;      --tag-gray-fg: #32302c;
  --tag-brown-bg: #eee0da;     --tag-brown-fg: #442a1e;
  --tag-orange-bg: #fadec9;    --tag-orange-fg: #49290e;
  --tag-yellow-bg: #fdecc8;    --tag-yellow-fg: #402c1b;
  --tag-green-bg: #dbeddb;     --tag-green-fg: #1c3829;
  --tag-blue-bg: #d3e5ef;      --tag-blue-fg: #183347;
  --tag-purple-bg: #e8deee;    --tag-purple-fg: #412454;
  --tag-pink-bg: #f5e0e9;      --tag-pink-fg: #4c2337;
  --tag-red-bg: #ffe2dd;       --tag-red-fg: #5d1715;

  color-scheme: light;
}

/* Dunkelmodus: automatisch nach Systemeinstellung … */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #191919;
    --bg-subtle: #202020;
    --surface: #252525;
    --surface-hover: rgba(255, 255, 255, 0.055);
    --surface-active: rgba(255, 255, 255, 0.1);

    --text: rgba(255, 255, 255, 0.81);
    --text-2: rgba(255, 255, 255, 0.46);
    --text-3: rgba(255, 255, 255, 0.28);

    --border: rgba(255, 255, 255, 0.094);
    --border-strong: rgba(255, 255, 255, 0.16);

    --accent-soft: rgba(35, 131, 226, 0.2);
    --danger: #ff7369;
    --danger-soft: rgba(255, 115, 105, 0.15);

    --shadow-card: rgba(255, 255, 255, 0.075) 0 0 0 1px, rgba(0, 0, 0, 0.2) 0 1px 2px;
    --shadow-card-hover: rgba(255, 255, 255, 0.13) 0 0 0 1px, rgba(0, 0, 0, 0.3) 0 3px 6px;
    --shadow-pop: rgba(0, 0, 0, 0.3) 0 0 0 1px, rgba(0, 0, 0, 0.4) 0 9px 24px;
    --viz-series: #3987e5;
    --viz-grid: #2c2c2a;
    --viz-axis: #383835;
    --viz-muted: #898781;

    --tag-gray-bg: #5a5a5a;      --tag-gray-fg: rgba(255, 255, 255, 0.9);
    --tag-brown-bg: #603b2c;     --tag-brown-fg: rgba(255, 255, 255, 0.9);
    --tag-orange-bg: #854c1d;    --tag-orange-fg: rgba(255, 255, 255, 0.9);
    --tag-yellow-bg: #89632a;    --tag-yellow-fg: rgba(255, 255, 255, 0.9);
    --tag-green-bg: #2b593f;     --tag-green-fg: rgba(255, 255, 255, 0.9);
    --tag-blue-bg: #28456c;      --tag-blue-fg: rgba(255, 255, 255, 0.9);
    --tag-purple-bg: #492f64;    --tag-purple-fg: rgba(255, 255, 255, 0.9);
    --tag-pink-bg: #69314c;      --tag-pink-fg: rgba(255, 255, 255, 0.9);
    --tag-red-bg: #6e3630;       --tag-red-fg: rgba(255, 255, 255, 0.9);

    color-scheme: dark;
  }
}

/* … oder per Umschalter fest eingestellt. */
:root[data-theme="dark"] {
  --bg: #191919;
  --bg-subtle: #202020;
  --surface: #252525;
  --surface-hover: rgba(255, 255, 255, 0.055);
  --surface-active: rgba(255, 255, 255, 0.1);

  --text: rgba(255, 255, 255, 0.81);
  --text-2: rgba(255, 255, 255, 0.46);
  --text-3: rgba(255, 255, 255, 0.28);

  --border: rgba(255, 255, 255, 0.094);
  --border-strong: rgba(255, 255, 255, 0.16);

  --accent-soft: rgba(35, 131, 226, 0.2);
  --danger: #ff7369;
  --danger-soft: rgba(255, 115, 105, 0.15);

  --shadow-card: rgba(255, 255, 255, 0.075) 0 0 0 1px, rgba(0, 0, 0, 0.2) 0 1px 2px;
  --shadow-card-hover: rgba(255, 255, 255, 0.13) 0 0 0 1px, rgba(0, 0, 0, 0.3) 0 3px 6px;
  --shadow-pop: rgba(0, 0, 0, 0.3) 0 0 0 1px, rgba(0, 0, 0, 0.4) 0 9px 24px;
  --viz-series: #3987e5;
  --viz-grid: #2c2c2a;
  --viz-axis: #383835;
  --viz-muted: #898781;

  --tag-gray-bg: #5a5a5a;      --tag-gray-fg: rgba(255, 255, 255, 0.9);
  --tag-brown-bg: #603b2c;     --tag-brown-fg: rgba(255, 255, 255, 0.9);
  --tag-orange-bg: #854c1d;    --tag-orange-fg: rgba(255, 255, 255, 0.9);
  --tag-yellow-bg: #89632a;    --tag-yellow-fg: rgba(255, 255, 255, 0.9);
  --tag-green-bg: #2b593f;     --tag-green-fg: rgba(255, 255, 255, 0.9);
  --tag-blue-bg: #28456c;      --tag-blue-fg: rgba(255, 255, 255, 0.9);
  --tag-purple-bg: #492f64;    --tag-purple-fg: rgba(255, 255, 255, 0.9);
  --tag-pink-bg: #69314c;      --tag-pink-fg: rgba(255, 255, 255, 0.9);
  --tag-red-bg: #6e3630;       --tag-red-fg: rgba(255, 255, 255, 0.9);

  color-scheme: dark;
}

/* --- Grundlagen ------------------------------------------------------------ */

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }

::selection { background: var(--accent-soft); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-radius: var(--radius-sm);
}

/* Das hidden-Attribut muss staerker sein als jede display-Angabe. Ohne diese
   Regel gewinnt z. B. ".prop { display: grid }" gegen das Browser-Standard-
   "[hidden] { display: none }" - das Element bliebe trotz hidden sichtbar. */
[hidden] { display: none !important; }

/* Scrollbars dezent halten */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: content-box;
}
*::-webkit-scrollbar-track { background: transparent; }

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

button {
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  white-space: nowrap;
  transition: background 20ms ease-in, box-shadow 20ms ease-in;
}

.btn svg { flex: 0 0 auto; }

.btn--primary {
  background: var(--accent);
  color: #fff;
  box-shadow: rgba(15, 15, 15, 0.1) 0 1px 2px;
}
.btn--primary:hover { background: var(--accent-hover); }

.btn--ghost { color: var(--text-2); }
.btn--ghost:hover { background: var(--surface-hover); color: var(--text); }

.btn--subtle {
  background: var(--surface-hover);
  color: var(--text);
}
.btn--subtle:hover { background: var(--surface-active); }

.btn--danger { color: var(--danger); }
.btn--danger:hover { background: var(--danger-soft); }

.btn--icon {
  width: 28px;
  height: 28px;
  padding: 0;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-2);
}
.btn--icon:hover { background: var(--surface-hover); color: var(--text); }

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* --- Formularelemente ------------------------------------------------------ */

.input,
.select,
.textarea {
  width: 100%;
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  background-color: var(--bg-subtle);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  transition: background 20ms ease-in, box-shadow 20ms ease-in;
}

.input::placeholder,
.textarea::placeholder { color: var(--text-3); }

.input:hover,
.select:hover,
.textarea:hover { background-color: var(--surface-hover); }

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  background-color: var(--bg);
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.textarea { resize: vertical; min-height: 60px; line-height: 1.6; }

/* Gesperrte Auswahl (z. B. Aufgaben ohne gewaehltes Projekt) */
.select:disabled {
  color: var(--text-3);
  cursor: not-allowed;
  background-color: transparent;
}
.select:disabled:hover { background-color: transparent; }

.select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  padding-right: 28px;
  background-size: 12px 12px;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2337352f' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  cursor: pointer;
}
:root[data-theme="dark"] .select,
:root:not([data-theme="light"]) .select {
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23999999' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field > span {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
}

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--text-2);
  cursor: pointer;
  user-select: none;
}
.checkbox input { accent-color: var(--accent); width: 15px; height: 15px; cursor: pointer; }

.error-box {
  margin: 0;
  padding: 8px 10px;
  font-size: 13px;
  color: var(--danger);
  background: var(--danger-soft);
  border-radius: var(--radius-sm);
}

/* Hinweis im Planungs-Dialog, wenn der Termin zu einer Serie gehört. */
.plan-serie-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0 0;
  padding: 8px 10px;
  font-size: 13px;
  color: var(--text-2);
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
}
.plan-serie-icon { flex: 0 0 auto; font-size: 14px; line-height: 1; }

/* --- Tags (Notion-Pastell) ------------------------------------------------- */

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 180px;
  height: 20px;
  padding: 0 8px;
  border-radius: 3px;
  font-size: 12px;
  line-height: 20px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: var(--tag-gray-bg);
  color: var(--tag-gray-fg);
}

/* Eigener Textknoten, damit "…" auch im Flex-Tag zuverlaessig greift. */
.tag-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tag--gray   { background: var(--tag-gray-bg);   color: var(--tag-gray-fg); }
.tag--brown  { background: var(--tag-brown-bg);  color: var(--tag-brown-fg); }
.tag--orange { background: var(--tag-orange-bg); color: var(--tag-orange-fg); }
.tag--yellow { background: var(--tag-yellow-bg); color: var(--tag-yellow-fg); }
.tag--green  { background: var(--tag-green-bg);  color: var(--tag-green-fg); }
.tag--blue   { background: var(--tag-blue-bg);   color: var(--tag-blue-fg); }
.tag--purple { background: var(--tag-purple-bg); color: var(--tag-purple-fg); }
.tag--pink   { background: var(--tag-pink-bg);   color: var(--tag-pink-fg); }
.tag--red    { background: var(--tag-red-bg);    color: var(--tag-red-fg); }

/* Kategorie-Tag: faerbt sich nach der in der Verwaltung gewaehlten Farbe.
   color-mix haelt den Ton in beiden Themes lesbar. */
.tag--custom {
  background: color-mix(in srgb, var(--tag-color) 22%, var(--surface));
  color: var(--text);
}
.tag--custom .tag-dot { background: var(--tag-color); }

.tag-dot {
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* --- Avatare --------------------------------------------------------------- */

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #fff;
  text-transform: uppercase;
  user-select: none;
}

.avatar--lg { width: 28px; height: 28px; font-size: 12px; }

/* --- Kopfzeile ------------------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 45px;
  padding: 0 12px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 6px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
}
a.breadcrumb:hover { background: var(--surface-hover); }

.breadcrumb-icon { font-size: 15px; line-height: 1; }

.breadcrumb-sep { color: var(--text-3); }

.topbar-spacer { flex: 1; }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 2px;
}

/* --- Werkzeugleiste -------------------------------------------------------- */

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 24px;
}

/* Seitentitel in der Werkzeugleiste (Zeiten-Seite) - optisch auf einer
   Hoehe mit dem Board-Umschalter. */
.toolbar-title {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.toolbar-title svg { color: var(--text-3); flex: 0 0 auto; }

/* --- Board-Umschalter ------------------------------------------------------ */

.board-switch { position: relative; }

.board-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 260px;
  height: 32px;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.board-btn:hover { background: var(--surface-hover); }
.board-btn[aria-expanded="true"] { background: var(--surface-active); }

.board-btn svg { color: var(--text-3); flex: 0 0 auto; }

#board-btn-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Aufklappmenue */
.menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 50;
  min-width: 260px;
  max-height: 70vh;
  overflow-y: auto;
  padding: 4px;
  background: var(--bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-pop);
}

.menu-label {
  padding: 6px 8px 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-3);
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text);
  text-align: left;
}
.menu-item:hover { background: var(--surface-hover); }
.menu-item--danger { color: var(--danger); }
.menu-item--danger:hover { background: var(--danger-soft); }

.menu-item-icon { flex: 0 0 auto; width: 18px; text-align: center; }

.menu-item-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.menu-item-count {
  margin-left: auto;
  padding-left: 8px;
  font-size: 12px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.menu-item-check { flex: 0 0 auto; color: var(--accent); }

.menu-sep {
  height: 1px;
  margin: 4px 0;
  background: var(--border);
}

/* Kompaktes Dialogformat fuer Board anlegen/umbenennen */
.sheet--sm { width: min(420px, calc(100vw - 32px)); }
.sheet-body--sm { padding: 20px; }

/* Mittleres Dialogformat (Archiv). */
.sheet--md { width: min(560px, calc(100vw - 32px)); }
.sheet--md .sheet-body { padding: 16px 20px 20px; }

.archive-hint {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--text-3);
  line-height: 1.45;
}

.archive-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.archive-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.archive-row-main { flex: 1 1 auto; min-width: 0; }

.archive-row-title {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.archive-row-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
  font-size: 12px;
  color: var(--text-3);
}

.archive-row-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
}

/* Kleiner „Zurückholen"-Knopf mit Symbol und Text. */
.btn--sm {
  height: 28px;
  padding: 0 10px;
  gap: 5px;
  font-size: 13px;
}

.archive-empty {
  margin: 16px 0;
  text-align: center;
  font-size: 13px;
  color: var(--text-3);
}

.board-fields {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}
.board-fields .field:first-child { flex: 0 0 72px; }
.board-fields .field:last-child { flex: 1 1 auto; }

.input--icon {
  text-align: center;
  font-size: 20px;
  line-height: 1.2;
}

.toolbar-spacer { flex: 1; }

.search {
  position: relative;
  display: flex;
  align-items: center;
}

.search svg {
  position: absolute;
  left: 8px;
  color: var(--text-3);
  pointer-events: none;
}

.search .input {
  width: 200px;
  padding-left: 28px;
  background: transparent;
  transition: width 120ms ease, background 20ms ease-in;
}
.search .input:focus { width: 260px; }

/* Filterzeile */
.filters {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 0 24px 12px;
}

.filters .select {
  width: auto;
  min-width: 0;
  height: 28px;
  padding: 0 26px 0 8px;
  font-size: 13px;
  background-color: transparent;
  color: var(--text-2);
}
.filters .select:hover { background-color: var(--surface-hover); }
.filters .select:focus { color: var(--text); }

/* Ein Filter, der aktiv ist, hebt sich farblich ab. */
.filters .select[data-active="1"] {
  background-color: var(--accent-soft);
  color: var(--text);
}

.filter-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-2);
}
.filter-toggle:hover { background: var(--surface-hover); }
.filter-toggle[aria-pressed="true"] {
  background: var(--accent-soft);
  color: var(--text);
  font-weight: 500;
}

/* Sieben Zeitraeume plus Nutzerfilter passen am Rechner in eine Zeile.
   Wird es schmaler, greifen die Kurzformen - sonst braucht die Filterzeile
   drei Zeilen, bevor die Auswertung ueberhaupt anfaengt. */
.lbl-kurz { display: none; }

@media (max-width: 820px) {
  .lbl-lang { display: none; }
  .lbl-kurz { display: inline; }
}

/* --- Board ----------------------------------------------------------------- */

.board {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 4px 24px 40px;
  overflow-x: auto;
}

.column {
  flex: 1 1 0;
  min-width: 260px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.column-header {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 4px;
}

.column-header h2 {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

/* Farbe kommt aus der Spalte selbst und wird per style-Attribut gesetzt. */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: var(--text-3);
}

.count {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

/* Bearbeiten und Hinzufuegen erscheinen erst beim Zeigen auf die Spalte. */
.column-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
  opacity: 0;
  transition: opacity 80ms ease;
}
.column:hover .column-actions,
.column-actions:focus-within { opacity: 1; }

@media (hover: none) {
  .column-actions { opacity: 1; }        /* Touch: dauerhaft sichtbar */
}

.cards {
  list-style: none;
  margin: 0;
  padding: 2px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 8px;
  border-radius: var(--radius);
  transition: background 120ms ease;
}

/* Waehrend des Ziehens die Zielspalte sanft hervorheben. */
body.is-dragging .cards { background: var(--bg-subtle); min-height: 60px; }

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 8px 10px;
  box-shadow: var(--shadow-card);
  cursor: pointer;
  user-select: none;
  transition: box-shadow 100ms ease, background 20ms ease-in;
}

/* Archivieren-Knopf oben rechts auf erledigten Karten - erscheint beim
   Zeigen auf die Karte, damit die Karte im Ruhezustand ruhig bleibt. */
.card-archive {
  position: absolute;
  top: 6px;
  right: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  color: var(--text-3);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  opacity: 0;
  transition: opacity 80ms ease, color 80ms ease, background 80ms ease;
}
.card:hover .card-archive,
.card-archive:focus-visible { opacity: 1; }
.card-archive:hover { color: var(--accent); background: var(--surface-hover); }

@media (hover: none) {
  .card-archive { opacity: 1; }        /* Touch: dauerhaft sichtbar */
}

/* Sammel-Archivieren am Fuß der Abschluss-Spalte. */
.column-archive-all {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  height: 30px;
  margin-top: 2px;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-3);
  text-align: left;
}
.column-archive-all:hover { background: var(--surface-hover); color: var(--text-2); }

.card:hover { background: var(--surface-hover); box-shadow: var(--shadow-card-hover); }
.card:active { cursor: grabbing; }

/* Titel belegt auf der Karte immer genau zwei Zeilen und wird danach mit
   "…" abgeschnitten. Vollstaendig steht er im geoeffneten Dialog. */
.card-title {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.35;
  word-break: break-word;
  min-height: 2.7em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Der Textblock belegt immer genau zwei Zeilen - egal ob die Beschreibung
   kuerzer, laenger oder gar nicht vorhanden ist. Dadurch sind alle Karten
   gleich hoch, statt je nach Textlaenge unterschiedlich. */
.card-desc {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.45;
  min-height: 2.9em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* margin-top:auto schiebt die Meta-Zeile auf den Kartenboden - dadurch
   liegen Tags und Avatare aller Karten auf einer Linie. Kein Umbruch:
   die Zeile bleibt immer genau eine Zeile hoch, lange Kategorienamen
   werden stattdessen gekuerzt. */
.card-meta {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  margin-top: auto;
  padding-top: 8px;
  overflow: hidden;
}

/* Nur der Kategorie-Tag darf schrumpfen - Prioritaet, Datum und Avatar
   behalten ihre Groesse. */
.card-meta > * { flex: 0 0 auto; }
.card-meta .tag--custom { flex: 0 1 auto; min-width: 3em; }

.card-due {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-2);
}
.card-due.is-overdue { color: var(--danger); font-weight: 500; }

.card-assignee { margin-left: auto; }

/* Drag-&-Drop-Zustaende von SortableJS */
.card-ghost {
  opacity: 1;
  background: var(--accent-soft);
  box-shadow: none;
}
.card-ghost > * { visibility: hidden; }

.card-drag {
  opacity: 1 !important;
  transform: rotate(1.5deg);
  box-shadow: var(--shadow-pop);
}

/* Hinweis fuer leere Spalten. Liegt bewusst NEBEN der Karten-Liste (nicht
   darin), damit er die Drop-Position beim Ziehen nicht verschiebt. */
.column-empty {
  display: none;
  margin: 0;
  padding: 10px 6px;
  font-size: 13px;
  color: var(--text-3);
}

.cards:empty + .column-empty { display: block; }
body.is-dragging .column-empty { display: none; }

.column-add {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  height: 30px;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text-3);
  text-align: left;
}
.column-add:hover { background: var(--surface-hover); color: var(--text-2); }

/* --- Dialog (Aufgabe anlegen / bearbeiten) --------------------------------- */

dialog {
  padding: 0;
  border: none;
  background: transparent;
  max-width: none;
  max-height: none;
}

dialog::backdrop {
  background: rgba(15, 15, 15, 0.4);
  backdrop-filter: blur(1px);
}

.sheet {
  width: min(720px, calc(100vw - 32px));
  max-height: calc(100vh - 64px);
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop);
  overflow: hidden;
  animation: sheet-in 140ms cubic-bezier(0.2, 0, 0.2, 1);
}

@keyframes sheet-in {
  from { opacity: 0; transform: translateY(6px) scale(0.99); }
  to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .sheet { animation: none; }
  * { transition-duration: 0.01ms !important; }
}

.sheet-head {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}

.sheet-head .btn--icon { margin-left: auto; }

.sheet-crumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-2);
}

.sheet-body {
  padding: 24px 48px 32px;
  overflow-y: auto;
}

/* Der Titel wird – wie eine Notion-Seite – randlos gross eingegeben und
   waechst mit dem Inhalt mit, damit auch lange Titel vollstaendig
   sichtbar sind (auf der Karte werden sie gekuerzt). */
.title-input {
  display: block;
  width: 100%;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 30px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--text);
  padding: 0;
  margin-bottom: 16px;
  resize: none;
  overflow: hidden;
}
.title-input::placeholder { color: var(--text-3); }
.title-input:focus { outline: none; }

/* Eigenschaftenliste: Icon + Label links, Steuerelement rechts. */
.props {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 20px;
}

.prop {
  display: grid;
  grid-template-columns: 160px 1fr;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  border-radius: var(--radius-sm);
}

.prop > span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 6px;
  font-size: 14px;
  color: var(--text-2);
}

.prop > span svg { flex: 0 0 auto; color: var(--text-3); }

/* Ausdruecklich nur die Farbe setzen: die Kurzform "background" wuerde
   das Pfeil-Symbol (background-image) mitloeschen. */
.prop .select,
.prop .input {
  background-color: transparent;
  border-color: transparent;
}
.prop .select:hover,
.prop .input:hover { background-color: var(--surface-hover); }
.prop .select:focus,
.prop .input:focus { background-color: var(--bg); border-color: var(--accent); }

.prop-divider {
  height: 1px;
  background: var(--border);
  margin: 12px 0 16px;
}

/* Beschreibung randlos wie ein Notion-Textblock, ebenfalls mitwachsend. */
.desc-input {
  display: block;
  width: 100%;
  min-height: 110px;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  padding: 4px 0;
  resize: none;
  overflow: hidden;
}
.desc-input::placeholder { color: var(--text-3); }
.desc-input:focus { outline: none; }

.sheet-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.sheet-foot .spacer { flex: 1; }

.sheet-foot .error-box { flex: 1 1 100%; order: -1; }

/* --- Toasts ---------------------------------------------------------------- */

.toasts {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  box-shadow: var(--shadow-pop);
  animation: toast-in 140ms ease-out;
}

.toast--error { color: var(--danger); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

/* --- Anmeldeseite ---------------------------------------------------------- */

.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg-subtle);
}

.auth-card {
  width: min(400px, 100%);
  padding: 40px 36px;
  background: var(--bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop);
}

.auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-bottom: 20px;
  border-radius: var(--radius);
  background: var(--text);
  color: var(--bg);
  font-size: 22px;
}

.auth-card h1 {
  font-size: 24px;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.auth-sub {
  margin: 0 0 28px;
  font-size: 14px;
  color: var(--text-2);
}

.auth-card form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-card .input {
  height: 36px;
  background: var(--bg-subtle);
}

.auth-card .btn--primary {
  height: 36px;
  justify-content: center;
  margin-top: 4px;
}

/* --- Verwaltungsseite ------------------------------------------------------ */

.page {
  max-width: 900px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

.page-title {
  font-size: 32px;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.page-sub {
  margin: 0 0 36px;
  font-size: 14px;
  color: var(--text-2);
}

.panel { margin-bottom: 44px; }

.panel-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 12px;
}

.panel-head h2 { font-size: 17px; }

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table th {
  text-align: left;
  padding: 6px 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-3);
  border-bottom: 1px solid var(--border);
}

.table td {
  padding: 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.table tbody tr:hover { background: var(--surface-hover); }

.table .cell-actions { text-align: right; width: 40px; }

.table .btn--icon { opacity: 0; }
.table tr:hover .btn--icon { opacity: 1; }
.table .btn--icon:focus-visible { opacity: 1; }

.user-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.empty-row {
  padding: 16px 8px;
  color: var(--text-3);
  font-size: 13px;
}

/* Inline-Formular unter einer Tabelle */
.inline-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px;
  margin-top: 16px;
  padding: 16px;
  background: var(--bg-subtle);
  border-radius: var(--radius);
}

.inline-form .field { flex: 1 1 180px; }
.inline-form .error-box { flex: 1 1 100%; }

.color-input {
  width: 40px;
  height: 32px;
  padding: 2px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg);
  cursor: pointer;
}

.color-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  vertical-align: -1px;
}

/* --- Responsiv ------------------------------------------------------------- */

@media (max-width: 860px) {
  .board {
    flex-direction: column;
    padding: 4px 16px 40px;
  }
  .column { width: 100%; min-width: 0; }
  .toolbar, .filters { padding-left: 16px; padding-right: 16px; }
  .sheet-body { padding: 20px 20px 24px; }
  .title-input { font-size: 24px; }
  .prop { grid-template-columns: 1fr; align-items: stretch; gap: 2px; }
  .search .input, .search .input:focus { width: 100%; }
  .search { flex: 1 1 140px; }
}

@media (max-width: 520px) {
  .page { padding: 24px 16px 60px; }
  .board-btn { max-width: 160px; }
  .menu { min-width: 220px; }
}

/* =============================================================================
   Navigation, Zeiterfassung und Auswertung
   ============================================================================= */

/* --- Seitennavigation in der Kopfzeile -------------------------------------- */

/* Navigation als aufklappbarer Drawer (Slide-in von links, alle Groessen). */
.topnav {
  position: fixed;
  top: 45px;
  left: 0;
  z-index: 40;
  height: calc(100dvh - 45px);
  width: 250px;
  max-width: 82vw;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  margin: 0;
  padding: 10px;
  background: var(--bg-subtle);
  border-right: 1px solid var(--border);
  box-shadow: var(--shadow-pop);
  overflow-y: auto;
  transform: translateX(-100%);
  transition: transform 0.22s ease;
}
.topnav.open { transform: translateX(0); }

.nav-scrim {
  position: fixed;
  inset: 45px 0 0;
  z-index: 30;
  background: rgba(0, 0, 0, 0.35);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.22s ease, visibility 0.22s ease;
}
.nav-scrim.open { opacity: 1; visibility: visible; }
@media (prefers-reduced-motion: reduce) {
  .topnav, .nav-scrim { transition: none; }
}

.topnav-item {
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text-2);
  text-decoration: none;
  white-space: nowrap;
}
.topnav-item:hover { background: var(--surface-hover); color: var(--text); }
.topnav-item.is-active {
  background: var(--surface-active);
  color: var(--text);
  font-weight: 500;
}

/* Linien-Icons neben den Eintraegen - einheitlich mit dem Finanz-Dashboard.
   Als Maske gezeichnet, damit sie die Textfarbe uebernehmen. */
.topnav-item:not(.topnav-item--external) { display: flex; align-items: center; gap: 9px; }
.topnav-item:not(.topnav-item--external)::before {
  content: "";
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  background-color: currentColor;
  opacity: 0.75;
  -webkit-mask: var(--ico) center / contain no-repeat;
  mask: var(--ico) center / contain no-repeat;
}
.topnav-item[href="/"]              { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='18' height='18' rx='2'/%3E%3Cline x1='9' y1='3' x2='9' y2='21'/%3E%3Cline x1='15' y1='3' x2='15' y2='21'/%3E%3C/svg%3E"); }
.topnav-item[href="/kalender.html"] { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E"); }
.topnav-item[href="/zeiten.html"]   { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpolyline points='12 7 12 12 16 14'/%3E%3C/svg%3E"); }
.topnav-item[href="/uebersicht.html"] { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 3v18h18'/%3E%3Crect x='7' y='11' width='3' height='7'/%3E%3Crect x='12' y='7' width='3' height='11'/%3E%3Crect x='17' y='4' width='3' height='14'/%3E%3C/svg%3E"); }
.topnav-item[href="/wissen.html"]   { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 19.5A2.5 2.5 0 0 1 6.5 17H20'/%3E%3Cpath d='M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z'/%3E%3C/svg%3E"); }

/* --- Seitenaufbau ----------------------------------------------------------- */

.page-wide {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px 80px;
}

.section { margin-bottom: 40px; }

/* Abschnittsueberschrift wie eine Notion-Zwischenueberschrift: schlicht,
   ohne Rahmen, mit Haarlinie darunter. */
.section-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 8px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.section-head h2 {
  font-size: 15px;
  font-weight: 600;
}

.section-head .spacer { flex: 1; }

/* Inhalte stehen direkt auf der Seite - keine Karten, keine Schatten. */
.panel-flat { padding: 2px 0; }

/* Zeitraum-Anzeige rechts in der Werkzeugleiste */
.range-label {
  font-size: 13px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- Kennzahlen ------------------------------------------------------------- */

/* Flache Zahlenreihe statt Kacheln mit Schatten. */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px 32px;
  margin-bottom: 40px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border);
}

.stat-tile { min-width: 0; }

.stat-label {
  font-size: 12px;
  color: var(--text-2);
  margin-bottom: 2px;
}

/* Grosse Zahlen mit proportionalen Ziffern - tabellarische wirken hier zu locker. */
.stat-value {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.stat-sub {
  margin-top: 2px;
  font-size: 12px;
  color: var(--text-3);
}

/* Genau eine fuehrende Zahl pro Seite. */
.stat-hero .stat-value { font-size: 38px; letter-spacing: -0.03em; }

/* Steht die Zahlenreihe mitten im Abschnitt ueber ihrer eigenen Tabelle,
   braucht sie weder Trennlinie noch den grossen Abstand der Seitenkopfzahlen. */
.kpi-row--inline {
  margin-bottom: 14px;
  padding-bottom: 0;
  border-bottom: none;
}

/* --- Diagramme -------------------------------------------------------------- */

.chart-card[data-view="table"] .chart-view { display: none; }
.chart-card:not([data-view="table"]) .table-view { display: none; }

.viz-svg { display: block; width: 100%; height: auto; overflow: visible; }

.viz-bar { fill: var(--viz-series); }

/* Gitter und Achsen: durchgezogene Haarlinien, nie gestrichelt. */
.viz-grid-line { stroke: var(--viz-grid); stroke-width: 1; }
.viz-axis-line { stroke: var(--viz-axis); stroke-width: 1; }

/* Beschriftung traegt Textfarben, nie die Datenfarbe. */
.viz-tick { fill: var(--viz-muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.viz-value { fill: var(--text-2); font-size: 11px; font-weight: 600; }

.viz-hit { fill: transparent; cursor: default; }
.viz-hit:hover, .viz-hit:focus { fill: var(--surface-hover); outline: none; }

.viz-empty {
  margin: 0;
  padding: 24px 0;
  text-align: center;
  font-size: 13px;
  color: var(--text-3);
}

/* Waagerechte Balken */
.viz-bars { display: flex; flex-direction: column; gap: 2px; }

.viz-bar-row {
  display: grid;
  grid-template-columns: minmax(90px, 190px) 1fr auto;
  align-items: center;
  gap: 12px;
  min-height: 28px;                    /* bequeme Trefferflaeche */
  padding: 2px 4px;
  border-radius: var(--radius-sm);
}
.viz-bar-row:hover, .viz-bar-row:focus { background: var(--surface-hover); outline: none; }

.viz-bar-name {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  font-size: 13px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.viz-bar-dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.viz-bar-track {
  height: 14px;
  background: transparent;
  border-radius: 2px;
}

.viz-bar-fill {
  display: block;
  height: 100%;
  background: var(--viz-series);
  border-radius: 0 4px 4px 0;          /* rund am Datenende, eckig an der Basis */
}

.viz-bar-value {
  font-size: 12px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.viz-tooltip {
  position: fixed;
  z-index: 200;
  max-width: 240px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow-pop);
  font-size: 12px;
  line-height: 1.45;
  color: var(--text);
  pointer-events: none;
}
.viz-tooltip-sub { color: var(--text-3); }

.viz-table td:last-child,
.viz-table th:last-child { text-align: right; font-variant-numeric: tabular-nums; }

/* --- Statusanzeige (Dringlichkeit) ------------------------------------------ */

/* Statusfarbe erscheint nie allein: immer Punkt UND Text. */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-2);
  white-space: nowrap;
}

.status-pill::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--status-dot, var(--viz-muted));
  flex: 0 0 auto;
}

.status-pill[data-status="critical"] { --status-dot: var(--status-critical); }
.status-pill[data-status="serious"]  { --status-dot: var(--status-serious); }
.status-pill[data-status="warning"]  { --status-dot: var(--status-warning); }
.status-pill[data-status="good"]     { --status-dot: var(--status-good); }

.is-overdue-text { color: var(--danger); font-weight: 500; }

/* "09:00-10:30" gehoert zusammen und darf nicht umbrechen. */
.cell-zeit,
.cell-datum { white-space: nowrap; }

/* Auf dem Handy passt die Planungstabelle vollstaendig ins Bild: geplante
   Uhrzeit und Spalte treten zurueck, damit Datum, Aufgabe, Projekt und
   Status ohne seitliches Wischen lesbar sind. */
@media (max-width: 620px) {
  /* Schlaegt .table-scroll .table (min-width: 460px) unabhaengig von der
     Reihenfolge in der Datei. */
  .table-scroll .table.plan-table { min-width: 0; }
  .plan-table .cell-zeit,
  .plan-table .cell-spalte { display: none; }
}

/* --- Zeiterfassung ---------------------------------------------------------- */

/* Kopfzeile der Liste: Summe rechts, wie eine Notion-Datenbank-Zusammenfassung */
.time-summary {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 0 4px 10px;
  margin-bottom: 4px;
}

.time-summary-total {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.time-summary-sub {
  font-size: 13px;
  color: var(--text-2);
}

.time-summary .spacer { flex: 1; }

/* Tagesgruppen */
.day-group { margin-bottom: 28px; }

.day-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 0 4px 6px;
  border-bottom: 1px solid var(--border);
}

.day-date { font-size: 14px; font-weight: 600; }

.day-total {
  margin-left: auto;
  font-size: 13px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

/* Eine Zeile pro Eintrag - ruhig, ohne Kasten, wie eine Notion-Liste */
.time-entry {
  display: grid;
  grid-template-columns: 116px 1fr auto auto;
  align-items: center;
  gap: 14px;
  padding: 9px 6px;
  border-radius: var(--radius-sm);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.time-entry:hover { background: var(--surface-hover); }

.entry-span {
  font-size: 13px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.entry-main { min-width: 0; }

.entry-note {
  font-size: 14px;
  line-height: 1.35;
  word-break: break-word;
}
.entry-note:empty::before { content: "Ohne Beschreibung"; color: var(--text-3); }

.entry-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 5px;
}

.entry-duration {
  font-size: 14px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.entry-actions { display: flex; gap: 2px; opacity: 0; }
.time-entry:hover .entry-actions,
.entry-actions:focus-within { opacity: 1; }

@media (hover: none) { .entry-actions { opacity: 1; } }

/* Berechnete Dauer im Dialog - sieht aus wie ein Feld, ist aber nur Anzeige */
.prop-static {
  display: flex;
  align-items: center;
  padding: 6px 10px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}
.prop-static.is-bad { color: var(--danger); font-weight: 400; }

.prop-hint {
  padding: 0 10px 6px;
  font-size: 12px;
  color: var(--text-3);
  grid-column: 2;
}

@media (max-width: 820px) {
  .time-entry { grid-template-columns: 1fr auto; gap: 8px; }
  .time-entry .entry-span { grid-column: 1 / -1; }
  .time-entry .entry-main { grid-column: 1 / -1; }
  .page-wide { padding: 24px 16px 60px; }
  .viz-bar-row { grid-template-columns: minmax(80px, 130px) 1fr auto; gap: 8px; }
}

/* --- Label-Verwaltung ------------------------------------------------------- */

/* Auswahl plus kleiner Knopf in einer Eigenschaftszeile */
.prop-with-action {
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
}
.prop-with-action .select { flex: 1 1 auto; min-width: 0; }
.prop-with-action .btn--icon { flex: 0 0 auto; }

.label-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
}

.label-row .input { background: transparent; }
.label-row .input:hover { background: var(--surface-hover); }

.label-row .btn--icon { opacity: 0; }
.label-row:hover .btn--icon,
.label-row .btn--icon:focus-visible { opacity: 1; }

@media (hover: none) { .label-row .btn--icon { opacity: 1; } }

.label-add {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.label-empty {
  padding: 8px 0 4px;
  font-size: 13px;
  color: var(--text-3);
}

/* --- Ringdiagramm ----------------------------------------------------------- */

.viz-donut-wrap {
  display: flex;
  align-items: center;
  gap: 28px;
  flex-wrap: wrap;
}

.viz-donut { flex: 0 0 auto; }

/* Trefferflaeche ist der Ring selbst (30 px stark, klar ueber dem Minimum) */
.viz-slice {
  pointer-events: stroke;
  cursor: default;
  transition: opacity 80ms ease;
}
.viz-slice:hover, .viz-slice:focus { opacity: 0.82; outline: none; }

.viz-slice-label {
  font-size: 11px;
  font-weight: 600;
  pointer-events: none;
}

.viz-donut-label { fill: var(--text-3); font-size: 11px; }
.viz-donut-value { fill: var(--text); font-size: 15px; font-weight: 600; }

/* Legende: immer vorhanden, damit die Zuordnung nie nur an der Farbe haengt */
.viz-legend {
  flex: 1 1 240px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.viz-legend-row {
  display: grid;
  grid-template-columns: 10px 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 5px 6px;
  border-radius: var(--radius-sm);
}
.viz-legend-row:hover { background: var(--surface-hover); }

.viz-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.viz-legend-name {
  min-width: 0;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.viz-legend-share {
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.viz-legend-value {
  font-size: 12px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

@media (max-width: 560px) {
  .viz-donut-wrap { gap: 16px; justify-content: center; }
}

/* --- Unteraufgaben ---------------------------------------------------------- */

.subtasks summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 6px;
  margin: 0 -6px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.subtasks summary::-webkit-details-marker { display: none; }
.subtasks summary:hover { background: var(--surface-hover); color: var(--text); }

.subtasks-chevron {
  flex: 0 0 auto;
  color: var(--text-3);
  transition: transform 120ms ease;
}
.subtasks[open] .subtasks-chevron { transform: rotate(90deg); }

.subtasks-progress {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.subtasks-progress.is-complete { color: var(--status-good); font-weight: 600; }

.subtask-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-top: 6px;
}

.subtask-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 5px 6px;
  border-radius: var(--radius-sm);
}
.subtask-row:hover { background: var(--surface-hover); }

.subtask-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
  flex: 0 0 auto;
}

.subtask-title {
  min-width: 0;
  font-size: 14px;
  line-height: 1.4;
  word-break: break-word;
  cursor: pointer;
}

/* Erledigtes wird durchgestrichen und tritt zurueck. */
.subtask-row.is-done .subtask-title {
  text-decoration: line-through;
  color: var(--text-3);
}

.subtask-row .btn--icon { opacity: 0; }
.subtask-row:hover .btn--icon,
.subtask-row .btn--icon:focus-visible { opacity: 1; }

@media (hover: none) { .subtask-row .btn--icon { opacity: 1; } }

.subtask-empty {
  padding: 6px;
  font-size: 13px;
  color: var(--text-3);
}

.subtask-add {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-top: 8px;
}

/* Fortschritt auf der Karte */
.card-subtasks {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
.card-subtasks.is-complete { color: var(--status-good); }

/* --- Wechsel zum Finanz-Dashboard ------------------------------------------- */

.topnav-sep {
  width: auto;
  height: 1px;
  margin: 6px 6px;
  background: var(--border);
  flex: 0 0 auto;
}

/* Fremde Anwendung: dezenter als die eigenen Seiten, mit Pfeil als Hinweis. */
.topnav-item--external {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text-3);
}
.topnav-item--external:hover { color: var(--text); }
.topnav-item--external svg { flex: 0 0 auto; }
.topnav-item--external .external-arrow { opacity: 0.7; }

@media (max-width: 620px) {
  .topnav-item--external { padding: 4px 6px; }
  .topnav-item--external .external-arrow { display: none; }
}

/* =============================================================================
   Handy-Anpassungen
   ============================================================================= */

/* Breite Inhalte scrollen in ihrem eigenen Kasten - nie die ganze Seite. */
.table-scroll {
  width: 100%;
  overflow-x: auto;
  overscroll-behavior-x: contain;
}
.table-scroll .table { min-width: 460px; }

@media (max-width: 720px) {
  /* Kopfzeile: der Markenname weicht, damit Navigation und Werkzeuge passen.
     Reicht der Platz trotzdem nicht, scrollt nur die Navigation. */
  .topbar { padding: 0 8px; gap: 4px; }

  .breadcrumb { padding: 3px 4px; }
  .breadcrumb-text { display: none; }
  .breadcrumb-sep { display: none; }

  /* .topnav ist jetzt ein Drawer (siehe Basis-CSS) - keine Topzeilen-Reste mehr. */
  .topbar-right { gap: 0; }
  .btn--icon { width: 30px; height: 30px; }   /* bequemer zu treffen */
}

@media (max-width: 520px) {
  /* Werkzeugleiste umbricht, damit der Hauptknopf immer sichtbar bleibt. */
  .toolbar { row-gap: 6px; }
  .toolbar-spacer { display: none; }
  .search { order: 3; flex: 1 1 100%; }
  .board-btn { max-width: 44vw; }

  .filters { row-gap: 6px; }
  .filters .select { max-width: 46vw; }

  /* Dialoge nutzen die volle Hoehe des Bildschirms. */
  .sheet { max-height: calc(100vh - 24px); }
  .sheet-foot { flex-wrap: wrap; row-gap: 6px; }
  .sheet-foot .spacer { display: none; }

  /* Ueberschrift und Zusammenfassung duerfen untereinander rutschen,
     statt sich gegenseitig zu quetschen. */
  .section-head { flex-wrap: wrap; row-gap: 2px; }

  .kpi-row { grid-template-columns: 1fr 1fr; gap: 8px 16px; }
  .stat-hero .stat-value { font-size: 30px; }

  .day-total, .time-summary-sub { font-size: 12px; }
}

/* --- Spalten einklappen (nur schmale Displays) ------------------------------ */

/* Am Rechner stehen die Spalten nebeneinander - dort bringt Einklappen
   nichts und der Knopf bliebe nur im Weg. */
.column-collapse { display: none; }

@media (max-width: 860px) {
  .column-collapse {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    margin-left: -4px;
    border-radius: var(--radius-sm);
    color: var(--text-3);
  }
  .column-collapse:hover { background: var(--surface-hover); color: var(--text); }

  /* Pfeil zeigt nach unten, solange die Spalte offen ist. */
  .column-collapse svg { transition: transform 120ms ease; }
  .column:not(.is-collapsed) .column-collapse svg { transform: rotate(90deg); }

  /* Eingeklappt bleibt nur die Kopfzeile mit Name und Anzahl stehen. */
  .column.is-collapsed .cards,
  .column.is-collapsed .column-add { display: none; }
  .column.is-collapsed .cards:empty + .column-empty { display: none; }

  .column.is-collapsed { gap: 0; }
  .column.is-collapsed .column-header {
    border-bottom: 1px solid var(--border);
    padding-bottom: 4px;
  }

  /* Die Anzahl wird im eingeklappten Zustand zur Hauptinformation. */
  .column.is-collapsed .count {
    background: var(--surface-hover);
    padding: 1px 7px;
    border-radius: 999px;
    color: var(--text-2);
  }

  /* Die Aktionsknoepfe der Spalte bleiben erreichbar. */
  .column.is-collapsed .column-actions { opacity: 1; }
}

/* Hinweis auf der Karte, dass die Aufgabe wiederkehrt */
.card-repeat {
  display: inline-flex;
  align-items: center;
  color: var(--text-3);
}

/* =============================================================================
   Kalender
   ============================================================================= */

.month-nav {
  display: flex;
  align-items: center;
  gap: 2px;
}

.month-label {
  min-width: 130px;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
}

/* --- Monatsraster ----------------------------------------------------------- */

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  margin-bottom: 28px;
}

.cal-weekday {
  padding: 4px 0 6px;
  text-align: center;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-3);
}

.cal-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-height: 52px;
  padding: 6px 2px 4px;
  border-radius: var(--radius-sm);
  background: none;
  font-size: 14px;
  color: var(--text);
  transition: background 20ms ease-in;
}
.cal-day:hover { background: var(--surface-hover); }

/* Tage der Nachbarmonate treten zurueck, bleiben aber anklickbar. */
.cal-day.is-outside { color: var(--text-3); }

.cal-day.is-today .cal-daynum {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

.cal-day.is-selected { background: var(--surface-active); }

.cal-daynum {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 4px;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
}

/* Punkte statt Zahlen: offen in Akzentfarbe, erledigt gedeckt. */
.cal-dots { display: flex; gap: 3px; height: 6px; }

.cal-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}
.cal-dot.is-done { background: var(--text-3); }

/* --- Tagesplan -------------------------------------------------------------- */

.day-plan { margin-top: 4px; }

.plan-slot {
  display: grid;
  grid-template-columns: 110px 1fr auto;
  align-items: start;
  gap: 14px;
  padding: 10px 6px;
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.plan-slot:hover { background: var(--surface-hover); }

/* Erledigtes tritt zurueck, bleibt aber lesbar. */
.plan-slot.is-done .slot-title { color: var(--text-2); }
.plan-slot.is-done .slot-time { color: var(--text-3); }

.slot-time {
  font-size: 13px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  padding-top: 2px;
}

.slot-main { min-width: 0; }

.slot-title {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.35;
  word-break: break-word;
}

.slot-note {
  margin-top: 2px;
  font-size: 13px;
  color: var(--text-2);
}

.slot-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.slot-done-btn { height: 28px; padding: 0 10px; font-size: 13px; }

.slot-erfasst {
  font-size: 13px;
  font-weight: 500;
  color: var(--status-good);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.slot-actions { display: flex; opacity: 0; }
.plan-slot:hover .slot-actions,
.slot-actions:focus-within { opacity: 1; }

@media (hover: none) { .slot-actions { opacity: 1; } }

.done-task {
  margin: 0 0 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  font-weight: 500;
}

.subtle-hint { color: var(--text-3); font-weight: 400; }

@media (max-width: 620px) {
  .month-label { min-width: 96px; font-size: 13px; }
  .cal-day { min-height: 44px; font-size: 13px; }
  .plan-slot { grid-template-columns: 1fr auto; gap: 8px; }
  .plan-slot .slot-time { grid-column: 1 / -1; padding-top: 0; }
  .plan-slot .slot-main { grid-column: 1 / -1; }
}

/* =============================================================================
   Wissens-/Notiz-Bereich
   ============================================================================= */

.topbar-menu { display: none; }            /* nur auf schmalen Displays */

.wiki-shell {
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr) 240px;
  height: calc(100dvh - 45px);
}

/* --- Linke Leiste: Suche + Baum -------------------------------------------- */
.wiki-rail {
  background: var(--bg-subtle);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.wiki-search { padding: 12px 12px 6px; position: relative; }
.wiki-search-box {
  display: flex; align-items: center; gap: 7px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 6px 9px;
}
.wiki-search-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.wiki-search-box svg { color: var(--text-3); flex: 0 0 auto; }
.wiki-search-box input { border: none; background: transparent; outline: none; font: inherit; font-size: 13.5px; color: var(--text); width: 100%; }
.wiki-search-box input::placeholder { color: var(--text-3); }
.wiki-search-results {
  position: absolute; left: 12px; right: 12px; top: 46px; z-index: 15;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius); box-shadow: var(--shadow-pop); overflow: hidden;
  max-height: 320px; overflow-y: auto;
}
.wiki-search-hit {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  font-size: 13.5px; color: var(--text); text-decoration: none; cursor: pointer;
}
.wiki-search-hit:hover { background: var(--surface-hover); }

.wiki-tree { overflow-y: auto; padding: 4px 8px 8px; flex: 1; min-height: 0; }
.wiki-tree-section { margin-top: 8px; }
.wiki-eyebrow {
  font-size: 11px; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--text-3); padding: 6px 8px 2px; user-select: none;
}
.wiki-tree-empty { padding: 6px 8px; font-size: 13px; color: var(--text-3); }

.wiki-row {
  display: flex; align-items: center; gap: 5px;
  padding: 4px 6px; border-radius: var(--radius-sm);
  font-size: 14px; color: var(--text); cursor: pointer; user-select: none;
}
.wiki-row:hover { background: var(--surface-hover); }
.wiki-row.active { background: var(--accent-soft); font-weight: 500; }
.wiki-twist {
  flex: 0 0 auto; width: 16px; text-align: center; color: var(--text-3);
  font-size: 10px; cursor: pointer; border-radius: 3px;
}
.wiki-twist.leer { cursor: default; color: var(--text-3); }
.wiki-twist:not(.leer):hover { background: var(--surface-active); }
.wiki-row-emoji { flex: 0 0 auto; width: 18px; text-align: center; }
.wiki-row-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wiki-row-actions { display: none; gap: 1px; flex: 0 0 auto; }
.wiki-row:hover .wiki-row-actions { display: flex; }
.wiki-mini {
  border: none; background: transparent; color: var(--text-3); cursor: pointer;
  width: 22px; height: 22px; border-radius: 4px; font-size: 12px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none;
}
.wiki-mini:hover { background: var(--surface-active); color: var(--text); }
.wiki-children { display: flex; flex-direction: column; }

.wiki-newpage {
  display: flex; align-items: center; gap: 6px;
  margin: 4px 12px 14px; padding: 6px 8px;
  border: none; background: transparent; color: var(--text-3);
  font: inherit; font-size: 13.5px; cursor: pointer; border-radius: var(--radius-sm);
}
.wiki-newpage:hover { background: var(--surface-hover); color: var(--text); }

/* --- Mitte: Editor --------------------------------------------------------- */
.wiki-main { overflow-y: auto; min-height: 0; background: var(--bg); }
.wiki-doc { max-width: 760px; margin: 0 auto; padding: 34px 56px 120px; }

.wiki-empty { max-width: 460px; margin: 90px auto; text-align: center; color: var(--text-3); padding: 0 24px; }
.wiki-empty-mark { font-size: 34px; margin-bottom: 12px; }
.wiki-empty strong { color: var(--text); }

.wiki-crumbs { font-size: 12.5px; color: var(--text-3); margin-bottom: 16px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.wiki-crumb { cursor: pointer; }
.wiki-crumb:hover { color: var(--text); }
.wiki-crumb-sep { color: var(--text-3); }

.wiki-titlerow { display: flex; align-items: center; gap: 8px; }
.wiki-emoji-btn {
  border: none; background: transparent; cursor: pointer;
  font-size: 34px; line-height: 1; padding: 2px 4px; border-radius: var(--radius-sm);
}
.wiki-emoji-btn:hover { background: var(--surface-hover); }
.wiki-title-input {
  flex: 1; border: none; background: transparent; outline: none;
  font-family: inherit; font-size: 32px; font-weight: 700; letter-spacing: -0.02em;
  color: var(--text); padding: 2px 2px;
}
.wiki-title-input::placeholder { color: var(--text-3); }
.wiki-meta { font-size: 12.5px; color: var(--text-3); margin: 4px 0 14px 6px; }

.wiki-toolbar { display: flex; align-items: center; gap: 8px; padding-bottom: 10px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.wiki-toolbar .spacer { flex: 1; }
.wiki-toolbar-edit { display: inline-flex; align-items: center; gap: 2px; }
.wiki-fmt {
  border: 1px solid transparent; background: transparent; color: var(--text-2);
  cursor: pointer; min-width: 28px; height: 28px; padding: 0 7px; border-radius: var(--radius-sm);
  font: inherit; font-size: 13px;
}
.wiki-fmt:hover { background: var(--surface-hover); color: var(--text); }
.wiki-fmt-sep { width: 1px; height: 18px; background: var(--border-strong); margin: 0 4px; }
.wiki-saved { font-size: 12px; color: var(--text-3); white-space: nowrap; }

.wiki-editarea {
  width: 100%; min-height: 340px; resize: vertical;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-subtle); color: var(--text);
  font-family: var(--font-mono); font-size: 13.5px; line-height: 1.7;
  padding: 14px 16px; outline: none;
}
.wiki-editarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* --- Gerenderte Ansicht ---------------------------------------------------- */
.wiki-view { font-size: 15px; line-height: 1.6; color: var(--text); }
.wiki-view h2 { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; margin: 28px 0 6px; scroll-margin-top: 16px; }
.wiki-view h3 { font-size: 16.5px; font-weight: 600; margin: 22px 0 4px; scroll-margin-top: 16px; }
.wiki-view h2:first-child, .wiki-view h3:first-child { margin-top: 4px; }
.wiki-view p { margin: 8px 0; }
.wiki-view a { color: var(--accent); text-decoration: none; }
.wiki-view a:hover { text-decoration: underline; }
.wiki-placeholder { color: var(--text-3); }

.wiki-link {
  color: var(--accent); cursor: pointer; text-decoration: none;
  border-bottom: 1px solid var(--accent-soft); padding-bottom: 1px;
}
.wiki-link::before { content: "[["; color: var(--text-3); font-size: 0.85em; }
.wiki-link::after { content: "]]"; color: var(--text-3); font-size: 0.85em; }
.wiki-link:hover { background: var(--accent-soft); border-radius: 3px; }

.wiki-ul, .wiki-ol { margin: 8px 0; padding-left: 24px; }
.wiki-ul li, .wiki-ol li { margin: 3px 0; }
.wiki-checklist { margin: 8px 0; display: flex; flex-direction: column; gap: 3px; }
.wiki-check { display: flex; align-items: flex-start; gap: 9px; }
.wiki-check input { margin: 3px 0 0; accent-color: var(--accent); width: 16px; height: 16px; flex: 0 0 auto; }
.wiki-check.done span { color: var(--text-3); text-decoration: line-through; }
.wiki-callout {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--bg-subtle); border: 1px solid var(--border);
  border-left: 3px solid var(--accent); border-radius: var(--radius);
  padding: 12px 14px; margin: 16px 0;
}
.wiki-callout-ico { flex: 0 0 auto; }
.wiki-code {
  background: var(--surface-hover); border-radius: var(--radius);
  padding: 12px 14px; overflow-x: auto; margin: 12px 0;
  font-family: var(--font-mono); font-size: 12.5px; line-height: 1.6; color: var(--text);
  white-space: pre;
}
.wiki-view code { font-family: var(--font-mono); font-size: 0.88em; background: var(--surface-hover); padding: 1px 5px; border-radius: 4px; }
.wiki-hr { border: none; border-top: 1px solid var(--border); margin: 22px 0; }
.wiki-img { max-width: 100%; height: auto; border-radius: var(--radius); margin: 10px 0; display: block; }

/* --- Anhänge --------------------------------------------------------------- */
.wiki-attach { margin-top: 34px; border-top: 1px solid var(--border); padding-top: 18px; }
.wiki-attach-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.wiki-attach-head h3 { font-size: 14px; font-weight: 600; margin: 0; }
.wiki-upload-btn { cursor: pointer; }
.wiki-attach-list { display: flex; flex-direction: column; gap: 4px; }
.wiki-file {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface);
}
.wiki-file:hover { border-color: var(--border-strong); }
.wiki-file-ico { flex: 0 0 auto; font-size: 16px; }
.wiki-file-name { flex: 1; color: var(--text); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wiki-file-name:hover { color: var(--accent); }
.wiki-file-size { flex: 0 0 auto; font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.wiki-dropzone {
  margin-top: 10px; padding: 14px; text-align: center; font-size: 13px; color: var(--text-3);
  border: 1px dashed var(--border-strong); border-radius: var(--radius);
}
.wiki-dropzone.over { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }

/* --- Rechte Leiste --------------------------------------------------------- */
.wiki-aside {
  border-left: 1px solid var(--border); background: var(--bg-subtle);
  padding: 26px 18px; overflow-y: auto; min-height: 0;
  display: flex; flex-direction: column; gap: 24px;
}
.wiki-aside-block h4 { font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); margin: 0 0 8px; font-weight: 600; }
.wiki-toc a { display: block; font-size: 13px; color: var(--text-2); text-decoration: none; padding: 3px 0 3px 10px; border-left: 2px solid transparent; }
.wiki-toc a.lvl-h3 { padding-left: 22px; font-size: 12.5px; }
.wiki-toc a:hover { color: var(--text); border-left-color: var(--border-strong); }
.wiki-backlink { display: flex; align-items: center; gap: 7px; padding: 5px 6px; font-size: 13px; color: var(--text-2); border-radius: var(--radius-sm); cursor: pointer; text-decoration: none; }
.wiki-backlink:hover { background: var(--surface-hover); color: var(--text); }
.wiki-aside-note { font-size: 12.5px; color: var(--text-3); }

.wiki-scrim { display: none; }

/* --- Schmale Displays ------------------------------------------------------ */
@media (max-width: 1080px) {
  .wiki-shell { grid-template-columns: 268px minmax(0, 1fr); }
  .wiki-aside { display: none; }
}
@media (max-width: 760px) {
  .topbar-menu { display: inline-flex; }
  .wiki-shell { grid-template-columns: 1fr; }
  .wiki-rail {
    position: fixed; top: 45px; left: 0; bottom: 0; width: 286px; z-index: 40;
    transform: translateX(-100%); transition: transform 0.22s ease; box-shadow: var(--shadow-pop);
  }
  .wiki-rail.open { transform: translateX(0); }
  .wiki-scrim { display: block; position: fixed; inset: 45px 0 0; background: rgba(0,0,0,0.35); z-index: 30; }
  .wiki-doc { padding: 24px 20px 100px; }
  .wiki-title-input { font-size: 26px; }
}
@media (prefers-reduced-motion: reduce) { .wiki-rail { transition: none; } }

/* --- Wissen: Ziehen-und-Ablegen im Baum ------------------------------------ */
.wiki-row.is-dragging { opacity: 0.45; }
.wiki-row.drop-inside { background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.wiki-row.drop-before { box-shadow: inset 0 2px 0 0 var(--accent); }
.wiki-row.drop-after { box-shadow: inset 0 -2px 0 0 var(--accent); }

/* --- Wissen: Emoji-Auswähler ----------------------------------------------- */
.wiki-emoji-pop {
  position: absolute; z-index: 60; width: 244px;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius); box-shadow: var(--shadow-pop); padding: 8px;
}
.wiki-emoji-eigen {
  width: 100%; box-sizing: border-box; margin-bottom: 8px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-subtle); color: var(--text); font: inherit; font-size: 13px; padding: 6px 8px; outline: none;
}
.wiki-emoji-eigen:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.wiki-emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; }
.wiki-emoji-opt {
  border: none; background: transparent; cursor: pointer;
  font-size: 18px; line-height: 1; padding: 5px 0; border-radius: var(--radius-sm);
}
.wiki-emoji-opt:hover { background: var(--surface-hover); }

/* --- Wissen: WYSIWYG-Editor ------------------------------------------------- */
.wiki-toolbar { flex-wrap: wrap; row-gap: 4px; position: sticky; top: 0; background: var(--bg); z-index: 5; }
.wiki-fmt strong, .wiki-fmt em { font-size: 13px; }

.wiki-editor {
  font-size: 15px; line-height: 1.6; color: var(--text);
  min-height: 320px; outline: none; padding: 2px 0 4px;
}
.wiki-editor:focus { outline: none; }
.wiki-editor:empty::before,
.wiki-editor[data-empty]::before { content: attr(data-placeholder); color: var(--text-3); }
.wiki-editor h2 { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; margin: 26px 0 6px; }
.wiki-editor h3 { font-size: 16.5px; font-weight: 600; margin: 20px 0 4px; }
.wiki-editor h2:first-child, .wiki-editor h3:first-child, .wiki-editor p:first-child { margin-top: 2px; }
.wiki-editor p { margin: 8px 0; }
.wiki-editor ul, .wiki-editor ol { margin: 8px 0; padding-left: 24px; }
.wiki-editor li { margin: 3px 0; }
.wiki-editor a.wiki-extlink { color: var(--accent); text-decoration: none; }
.wiki-editor a.wiki-extlink:hover { text-decoration: underline; }
.wiki-editor blockquote.wiki-callout {
  margin: 16px 0; padding: 12px 14px; background: var(--bg-subtle);
  border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: var(--radius);
}
.wiki-editor pre.wiki-code {
  background: var(--surface-hover); border-radius: var(--radius); padding: 12px 14px;
  overflow-x: auto; margin: 12px 0; font-family: var(--font-mono); font-size: 12.5px; white-space: pre-wrap;
}
.wiki-editor code { font-family: var(--font-mono); font-size: 0.88em; background: var(--surface-hover); padding: 1px 5px; border-radius: 4px; }
.wiki-editor hr { border: none; border-top: 1px solid var(--border); margin: 20px 0; }
.wiki-editor .wiki-img { max-width: 100%; height: auto; border-radius: var(--radius); margin: 10px 0; }
.wiki-editor a.wiki-link {
  color: var(--accent); text-decoration: none; cursor: pointer;
  border-bottom: 1px solid var(--accent-soft); padding-bottom: 1px; white-space: nowrap;
}
.wiki-editor a.wiki-link::before { content: "[["; color: var(--text-3); font-size: 0.85em; }
.wiki-editor a.wiki-link::after { content: "]]"; color: var(--text-3); font-size: 0.85em; }
.wiki-editor a.wiki-link:hover { background: var(--accent-soft); border-radius: 3px; }

/* Aufgaben-Liste mit anklickbarer Checkbox */
.wiki-editor ul.wiki-todo { list-style: none; padding-left: 4px; }
.wiki-editor ul.wiki-todo li { display: flex; align-items: flex-start; gap: 9px; }
.wiki-cb {
  flex: 0 0 auto; width: 17px; height: 17px; margin-top: 2px; padding: 0; cursor: pointer;
  border: 1.5px solid var(--border-strong); border-radius: 4px; background: var(--surface);
}
.wiki-cb:hover { border-color: var(--accent); }
.wiki-todo-li[data-checked="true"] > .wiki-cb {
  background: var(--accent); border-color: var(--accent);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: center;
}
.wiki-todo-li[data-checked="true"] { color: var(--text-3); text-decoration: line-through; }

/* Verweis-Auswahl (Seiten-Picker) */
.wiki-verweis-pop {
  position: absolute; z-index: 60; width: 250px;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius); box-shadow: var(--shadow-pop); padding: 8px;
}
.wiki-verweis-suche {
  width: 100%; box-sizing: border-box; margin-bottom: 6px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-subtle); color: var(--text); font: inherit; font-size: 13px; padding: 6px 8px; outline: none;
}
.wiki-verweis-suche:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.wiki-verweis-list { max-height: 260px; overflow-y: auto; }
.wiki-verweis-opt {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  border: none; background: transparent; color: var(--text); font: inherit; font-size: 13.5px;
  padding: 6px 8px; border-radius: var(--radius-sm); cursor: pointer;
}
.wiki-verweis-opt:hover { background: var(--surface-hover); }
.wiki-verweis-neu { color: var(--accent); }

/* --- Wissen: Projekt-Auswahl ----------------------------------------------- */
.wiki-projektwahl {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 12px 4px;
}
.wiki-projektwahl-label {
  font-size: 11px; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--text-3); flex: 0 0 auto;
}
.wiki-projekt-select { flex: 1; min-width: 0; height: 30px; font-size: 13.5px; }

/* Projektangabe im Seitenkopf */
.wiki-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.wiki-projekt-tag { display: inline-flex; align-items: center; gap: 6px; }
.wiki-projekt-tag-sep { color: var(--text-3); }
.wiki-projekt-tag-label { color: var(--text-3); }
.wiki-projekt-inline {
  border: 1px solid transparent; background: transparent; color: var(--text-2);
  font: inherit; font-size: 12.5px; border-radius: var(--radius-sm);
  padding: 2px 4px; cursor: pointer; max-width: 200px;
}
.wiki-projekt-inline:hover { background: var(--surface-hover); border-color: var(--border); }
.wiki-projekt-inline:focus { border-color: var(--accent); outline: none; }
.wiki-projekt-erbt { color: var(--text-2); }

/* --- Wochentags-Auswahl (Wiederholung / Kalenderserie) --------------------- */
.weekday-chips { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.weekday-chip {
  min-width: 34px; height: 28px; padding: 0 8px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text-2);
  font: inherit; font-size: 12.5px; cursor: pointer;
}
.weekday-chip:hover { border-color: var(--accent); color: var(--text); }
.weekday-chip[aria-pressed="true"] {
  background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 500;
}
