:root {
  --bg: #f5f4f0;
  --surface: #ffffff;
  --sunken: #eceae4;
  --ink: #1d1c1a;
  --muted: #6d6a63;
  --line: #e1ded6;
  --accent: #0f6b5c;
  --accent-ink: #ffffff;
  --danger: #b3261e;
  --warn: #9a6400;
  --ok: #2e7d32;
  --soon: #8a6d00;
  --soon-bg: #fff2b3;
  --shadow: 0 1px 2px rgb(0 0 0 / 6%), 0 8px 24px rgb(0 0 0 / 6%);
  --radius: 10px;
  color-scheme: light dark;
}
/* Dunkel: wie im System eingestellt, außer man hat in Teamplan selbst umgeschaltet (data-theme). */
:root[data-theme="light"] { color-scheme: light; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141412;
    --surface: #1d1d1a;
    --sunken: #25241f;
    --ink: #eceae4;
    --muted: #9c988f;
    --line: #302f2a;
    --accent: #53c1ab;
    --accent-ink: #0b211d;
    --danger: #f2877f;
    --warn: #e0ad4f;
    --ok: #7fcf86;
    --soon: #f2d35b;
    --soon-bg: rgb(242 211 91 / 14%);
    --shadow: 0 1px 2px rgb(0 0 0 / 40%), 0 8px 24px rgb(0 0 0 / 35%);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #141412;
  --surface: #1d1d1a;
  --sunken: #25241f;
  --ink: #eceae4;
  --muted: #9c988f;
  --line: #302f2a;
  --accent: #53c1ab;
  --accent-ink: #0b211d;
  --danger: #f2877f;
  --warn: #e0ad4f;
  --ok: #7fcf86;
  --soon: #f2d35b;
  --soon-bg: rgb(242 211 91 / 14%);
  --shadow: 0 1px 2px rgb(0 0 0 / 40%), 0 8px 24px rgb(0 0 0 / 35%);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p { margin: 0; }
h1 { font-size: 24px; font-weight: 650; letter-spacing: -0.01em; text-wrap: balance; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--muted); }
.spacer { flex: 1; }

/* Anmeldung */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card {
  width: min(400px, 100%);
  display: grid; gap: 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 28px; box-shadow: var(--shadow);
}

.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 16px; }
.brand-mark { width: 18px; height: 18px; border-radius: 5px; background: var(--accent); box-shadow: 6px 6px 0 -2px color-mix(in srgb, var(--accent) 35%, transparent); }

/* Rahmen */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 20px;
  padding: 20px 12px; border-right: 1px solid var(--line); background: var(--surface);
}
.side .brand { padding: 0 8px; }
.nav, .nav-group { display: grid; gap: 2px; }
.nav-group { flex: 1; align-content: start; }
.nav-title { padding: 0 8px 6px; font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.nav-empty { padding: 0 8px; color: var(--muted); font-size: 14px; }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 7px; color: var(--muted); }
.nav-link:hover { background: var(--sunken); color: var(--ink); }
.nav-link.is-active { background: var(--sunken); color: var(--ink); font-weight: 600; }
.nav-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { flex: none; width: 9px; height: 9px; border-radius: 3px; }
.side-user { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; align-items: center; padding: 12px 8px 0; border-top: 1px solid var(--line); }
.side-user-name { display: grid; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.side-user-name small { font-weight: 400; color: var(--muted); }
.link-btn { background: none; border: 0; padding: 4px 0; color: var(--muted); cursor: pointer; text-align: left; }
.link-btn:hover { color: var(--ink); text-decoration: underline; }

.main { padding: 28px 32px 64px; min-width: 0; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; margin-bottom: 20px; }
.page-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.project-desc { max-width: 70ch; margin-bottom: 20px; color: var(--muted); white-space: pre-wrap; }

/* Bedienelemente */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 14px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); cursor: pointer; font-weight: 550; white-space: nowrap;
}
.btn:hover { border-color: var(--muted); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { border-color: var(--accent); filter: brightness(1.08); }
.btn-danger { color: var(--danger); }
.btn-small { padding: 4px 10px; font-size: 13px; }
.icon-btn { width: 32px; height: 32px; border: 0; border-radius: 8px; background: none; font-size: 22px; line-height: 1; cursor: pointer; color: var(--muted); }
.icon-btn:hover { background: var(--sunken); color: var(--ink); }

.tabs { display: inline-flex; padding: 3px; border-radius: 9px; background: var(--sunken); }
.tab { border: 0; background: none; padding: 5px 14px; border-radius: 7px; cursor: pointer; color: var(--muted); font-weight: 550; }
.tab.is-active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgb(0 0 0 / 12%); }

.avatar {
  flex: none; display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 16%, var(--surface)); color: var(--accent); font-size: 12px; font-weight: 700;
}
.avatar-sm { width: 24px; height: 24px; font-size: 10px; }

.badge, .tag, .prio { display: inline-flex; align-items: center; padding: 5px 9px; border-radius: 4px; font-size: 12px; font-weight: 600; line-height: 1.3; white-space: nowrap; }
.badge { background: var(--sunken); color: var(--muted); }
.tag { background: var(--tag); color: #fff; }
.st-in_arbeit, .ps-aktiv { background: color-mix(in srgb, #2f5fb3 15%, var(--surface)); color: color-mix(in srgb, #2f5fb3 65%, var(--ink)); }
.st-review, .ps-pausiert { background: color-mix(in srgb, #a37a12 18%, var(--surface)); color: color-mix(in srgb, #a37a12 65%, var(--ink)); }
.st-erledigt, .ps-abgeschlossen { background: color-mix(in srgb, #4f7a28 18%, var(--surface)); color: color-mix(in srgb, #4f7a28 65%, var(--ink)); }
.st-dot { width: 9px; height: 9px; padding: 0; border-radius: 50%; }
.st-dot.st-offen { background: var(--muted); }
.st-dot.st-in_arbeit { background: #2f5fb3; }
.st-dot.st-review { background: #a37a12; }
.st-dot.st-erledigt { background: #4f7a28; }
.prio { padding: 0; color: var(--muted); }
.prio-hoch { color: var(--warn); }
.prio-dringend { color: var(--danger); }
.due { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
/* Fälligkeit: grün = liegt vor uns, gelb = in den nächsten Tagen, rot = heute oder vorbei. */
.due.future, .due.soon, .due.overdue { font-weight: 600; padding: 1px 6px; border-radius: 4px; }
.due.future { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.due.soon { color: var(--soon); background: var(--soon-bg); }
.due.overdue { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); }
.count { color: var(--muted); font-weight: 500; font-size: 13px; }

/* Projektkarten */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.card {
  display: grid; gap: 12px; padding: 18px;
  background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--tag); border-radius: var(--radius);
}
.card:hover { box-shadow: var(--shadow); }
.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.card h3 { font-size: 16px; font-weight: 650; overflow-wrap: anywhere; }
.card-desc { color: var(--muted); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.9em; }
.bar { height: 6px; border-radius: 3px; background: var(--sunken); overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 3px; }
.card-foot { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--muted); }

/* Board */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: 14px; min-height: 60vh; overflow-x: auto; padding-bottom: 8px; }
.col { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; align-content: start; padding: 10px; background: var(--sunken); border-radius: var(--radius); outline: 2px solid transparent; }
.col.is-over { outline-color: var(--accent); }
.col-title { display: flex; align-items: center; gap: 8px; margin: -10px -10px 2px; padding: 8px 8px 8px 12px; border-radius: var(--radius) var(--radius) 0 0; color: #fff; }
.col-title h2 { font-size: 13px; font-weight: 650; overflow-wrap: anywhere; }
.col-count { font-size: 12px; font-weight: 600; padding: 0 7px; border-radius: 999px; background: rgb(255 255 255 / 25%); }
.col-edit { flex: none; width: 26px; height: 24px; border: 0; border-radius: 6px; background: none; color: #fff; font-size: 16px; line-height: 1; cursor: pointer; }
.col-edit:hover, .col-edit:focus-visible { background: rgb(255 255 255 / 25%); }
.col-new { align-self: start; padding: 10px 12px; border: 1px dashed var(--line); border-radius: var(--radius); background: none; color: var(--muted); cursor: pointer; text-align: left; font-weight: 550; }
.col-new:hover { border-color: var(--muted); color: var(--ink); }
.col-cards { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; min-height: 36px; align-content: start; }
.task {
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; padding: 10px 12px; cursor: grab;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
}
.task:hover { border-color: var(--muted); }
.task.is-dragging { opacity: 0.35; }
.task.is-done .task-title { color: var(--muted); text-decoration: line-through; }
.task-title { font-weight: 550; overflow-wrap: anywhere; }
.task-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; min-height: 24px; font-size: 12px; white-space: nowrap; }
.task-meta:not(:has(> :not(.spacer))) { display: none; }
.quick-add { width: 100%; padding: 7px 10px; border: 1px dashed var(--line); border-radius: 8px; background: none; color: var(--muted); text-align: left; cursor: pointer; }
.quick-add:hover { border-color: var(--muted); color: var(--ink); background: var(--surface); }
.quick-form { display: grid; gap: 8px; }
.quick-actions { display: flex; gap: 6px; }

/* Listen */
.group { margin-bottom: 24px; }
.group-title { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 14px; font-weight: 650; }
.list-tools { display: flex; justify-content: flex-end; margin-bottom: 10px; }
.rows { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }
.row-title { flex: 1; min-width: 0; padding: 0; border: 0; background: none; text-align: left; cursor: pointer; font-weight: 550; overflow-wrap: anywhere; }
.row-title:hover { color: var(--accent); }
.row-static { cursor: default; }
.row-static:hover { color: inherit; }
.row-who { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.row.is-done .row-title { color: var(--muted); text-decoration: line-through; }
.row.is-done .avatar { opacity: 0.5; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); width: 16px; height: 16px; flex: none; margin: 0; }
.check { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); cursor: pointer; }

.empty { display: grid; gap: 6px; justify-items: center; padding: 56px 16px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); }
.empty h2 { font-size: 16px; color: var(--ink); }

/* Formulare und Dialoge */
.form { display: grid; gap: 14px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { display: grid; gap: 5px; min-width: 0; }
.field-label { font-size: 13px; font-weight: 600; }
.field-hint { font-size: 12px; color: var(--muted); }
input:not([type="checkbox"], [type="radio"]), select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface);
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: 2px solid color-mix(in srgb, var(--accent) 30%, transparent); outline-offset: 0; }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 4px; }
.form-error { color: var(--danger); font-size: 14px; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatches label { position: relative; cursor: pointer; }
.swatches input { position: absolute; opacity: 0; }
.swatch { display: block; width: 26px; height: 26px; border-radius: 7px; }
.swatches input:checked + .swatch { outline: 2px solid var(--ink); outline-offset: 2px; }
.swatches input:focus-visible + .swatch { outline: 2px solid var(--accent); outline-offset: 2px; }

.dlg {
  width: min(480px, calc(100vw - 32px)); max-height: calc(100vh - 48px);
  padding: 22px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow);
}
.dlg-wide { width: min(620px, calc(100vw - 32px)); }
.dlg::backdrop { background: rgb(0 0 0 / 45%); }
.dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.dlg-head h2 { font-size: 18px; font-weight: 650; }

.comment-box { display: grid; gap: 12px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.comment-box h3 { font-size: 14px; font-weight: 650; }
.comments { display: grid; gap: 12px; }
.comment { display: grid; gap: 2px; }
.comment-head { display: flex; gap: 10px; align-items: baseline; font-size: 13px; }
.comment p { white-space: pre-wrap; overflow-wrap: anywhere; }
.comment-form { display: grid; gap: 8px; justify-items: end; }

#toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 10; }
.toast { padding: 10px 14px; border-radius: 9px; background: var(--ink); color: var(--bg); box-shadow: var(--shadow); max-width: 340px; }
.toast-error { background: var(--danger); color: #fff; }

@media (max-width: 800px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 12px 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .nav { display: flex; }
  .nav-group { display: none; }
  .side-user { border-top: 0; padding: 0; grid-template-columns: repeat(4, auto); margin-left: auto; }
  .side-user-name { display: none; }
  .main { padding: 20px 16px 48px; }
  .form-row { grid-template-columns: 1fr; }
  .row { flex-wrap: wrap; }
  .row-title { flex-basis: 60%; }
}

/* Tags und eigene Felder */
.task-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.row .tag { flex: none; }
.tag-pick { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.tag-btn { border: 1px solid transparent; cursor: pointer; opacity: 0.45; }
.tag-btn:hover { opacity: 0.85; }
.tag-btn.is-on { opacity: 1; }
.tag-btn.is-on::before { content: "✓"; margin-right: 4px; }
input.tag-new { width: 130px; padding: 3px 8px; border-style: dashed; border-radius: 4px; font-size: 13px; }
.custom-fields { padding-top: 14px; border-top: 1px solid var(--line); }
.manage { display: grid; gap: 10px; }
.manage-row { display: flex; align-items: center; gap: 8px; }
.manage-row input { flex: 1; min-width: 0; }
.manage-add { margin-top: 8px; padding-top: 16px; border-top: 1px solid var(--line); }
.manage-add h3 { font-size: 14px; font-weight: 650; }
[hidden] { display: none !important; }
@media (max-width: 800px) {
  .manage-row { flex-wrap: wrap; }
}

/* Tag-Farben und Anzeige-Auswahl */
.color-pick { display: inline-flex; flex-wrap: wrap; gap: 5px; }
.color-dot { width: 18px; height: 18px; padding: 0; border: 0; border-radius: 50%; cursor: pointer; }
.color-dot.is-on { outline: 2px solid var(--ink); outline-offset: 2px; }
.tag-create { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; width: 100%; }
.tag-row { flex-wrap: wrap; }
.tag-row input { flex: 1 1 140px; }
.tag-create input.tag-new { border-style: solid; }
.task-desc { color: var(--muted); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.task-custom { display: grid; gap: 2px; font-size: 12px; }
.cf { overflow-wrap: anywhere; }
.row .cf { font-size: 13px; }
.check-list { display: grid; gap: 10px; }

/* CRM */
.list-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 14px; }
input.search { flex: 1 1 240px; max-width: 380px; }
.row-link:hover { background: var(--sunken); }
.cs-kunde { background: color-mix(in srgb, #4f7a28 18%, var(--surface)); color: color-mix(in srgb, #4f7a28 65%, var(--ink)); }
.cs-interessent { background: color-mix(in srgb, #2f5fb3 15%, var(--surface)); color: color-mix(in srgb, #2f5fb3 65%, var(--ink)); }
.back { display: inline-block; margin-bottom: 12px; color: var(--muted); font-size: 14px; }
.back:hover { color: var(--ink); }
.detail { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; align-items: start; }
.panel { display: grid; gap: 12px; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.panel h2 { font-size: 15px; font-weight: 650; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.panel-text { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--muted); }
.panel a:not(.contact) { color: var(--accent); }
.panel a:not(.contact):hover { text-decoration: underline; }
.info { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0; }
.info dt { color: var(--muted); font-size: 13px; }
.info dd { margin: 0; overflow-wrap: anywhere; }
.contact { display: flex; align-items: center; gap: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.contact-body { flex: 1; min-width: 0; display: grid; gap: 1px; overflow-wrap: anywhere; }
.contact-links { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; }
a.contact:hover strong { color: var(--accent); }
.project-customer { margin-bottom: 8px; color: var(--muted); }
.project-customer a { color: var(--accent); }
.project-customer a:hover { text-decoration: underline; }
.card-customer { font-size: 13px; font-weight: 600; }

.tabs-wrap { flex-wrap: wrap; }

select.filter-select { width: auto; flex: 0 1 220px; }

/* Zeiterfassung */
.timer { display: grid; gap: 6px; padding: 0 8px; }
.timer-btn { justify-self: start; }
.timer.is-running { padding: 10px; margin: 0 4px; border: 1px solid color-mix(in srgb, var(--danger) 45%, var(--line)); border-radius: 9px; background: color-mix(in srgb, var(--danger) 7%, var(--surface)); }
.timer-head { display: flex; align-items: center; gap: 8px; }
.timer-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--danger); animation: blink 1.4s ease-in-out infinite; }
@keyframes blink { 50% { opacity: 0.25; } }
@media (prefers-reduced-motion: reduce) { .timer-dot { animation: none; } }
.timer-clock { font-weight: 650; font-variant-numeric: tabular-nums; }
.timer-what { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.timer-what:hover { color: var(--ink); }
.entry-time { min-width: 52px; font-weight: 650; font-variant-numeric: tabular-nums; }
.entry-body { flex: 1; min-width: 0; display: grid; gap: 2px; }
.entry-task { margin-left: 8px; font-weight: 550; overflow-wrap: anywhere; }
.entry-note { font-size: 13px; overflow-wrap: anywhere; }
.badge-live { background: color-mix(in srgb, var(--danger) 15%, var(--surface)); color: var(--danger); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { display: grid; gap: 4px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.stat strong { font-size: 22px; font-variant-numeric: tabular-nums; }
.group-panel { margin-bottom: 24px; }
.group-row { display: grid; grid-template-columns: minmax(120px, 220px) 1fr auto; align-items: center; gap: 12px; }
.group-name { overflow-wrap: anywhere; }
input.filter-date { width: auto; }
.time-hint { margin: -4px 0 12px; font-size: 13px; }
@media (max-width: 800px) {
  .timer { order: 3; padding: 0; }
  .group-row { grid-template-columns: 1fr auto; }
  .group-row .bar { display: none; }
}

.timer.is-paused { padding: 10px; margin: 0 4px; border: 1px solid var(--line); border-radius: 9px; background: var(--sunken); }
.timer.is-paused .timer-dot { background: var(--muted); animation: none; }
.timer-state { font-size: 12px; font-weight: 600; color: var(--muted); }
.timer-total { font-size: 12px; color: var(--muted); }
.timer-sum { font-weight: 650; color: var(--ink); font-variant-numeric: tabular-nums; }
.timer-last { padding: 4px 0; border: 0; background: none; color: var(--ink); font-size: 13px; text-align: left; cursor: pointer; overflow-wrap: anywhere; }
.timer-last:hover { color: var(--accent); }
.timer-head .btn-small { min-width: 30px; }

/* Mitglieder und Zuständige */
.avatars { display: inline-flex; }
.avatars .avatar + .avatar { margin-left: -6px; box-shadow: 0 0 0 2px var(--surface); }
.members-btn { gap: 8px; }
.member-name { flex: 1 1 auto; min-width: 8em; font-weight: 550; overflow-wrap: break-word; }
/* Auswahlfelder in Verwaltungszeilen nur so breit wie nötig, damit der Name Platz behält. */
.manage-row select { width: auto; flex: 0 0 auto; }
.member-row { padding: 8px 0; border-top: 1px solid var(--line); }
.member-row:first-of-type { border-top: 0; }
.person-btn { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 4px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); cursor: pointer; font-size: 13px; opacity: 0.6; }
.person-btn:hover { opacity: 0.9; }
.person-btn.is-on { opacity: 1; border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--surface)); font-weight: 600; }
.member-admin { margin-left: 8px; }

/* Benachrichtigungen und Einstellungen */
.notify-box { display: grid; gap: 6px; margin-top: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--sunken); }
.notify-options { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; }
.notify-options .check { color: var(--ink); }
.notify-list { display: grid; gap: 4px; margin-top: 8px; font-size: 13px; }
.notify-item { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.settings-panel { max-width: 720px; }

/* Beträge */
.entry-amount { min-width: 84px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.stat-money { font-size: 15px; font-weight: 600; color: var(--accent); font-variant-numeric: tabular-nums; }
.group-row.with-money { grid-template-columns: minmax(120px, 220px) 1fr auto auto; }
.settings-stack { display: grid; gap: 16px; }
@media (max-width: 800px) { .group-row.with-money { grid-template-columns: 1fr auto auto; } }

/* Recherche */
.research { display: grid; gap: 14px; }
.research-title { font-size: 14px; font-weight: 650; margin-top: 6px; }
.research-run { display: grid; gap: 6px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; }
.research-run-head { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: baseline; }
.research-log { margin: 0; padding-left: 18px; display: grid; gap: 2px; font-size: 13px; color: var(--muted); }
.research-log li.ok { color: var(--ink); }
.research-log li.err { color: var(--danger); }

/* Kunden-Fenster */
.dlg-panel { width: min(1040px, calc(100vw - 32px)); }
.panel-body { display: grid; gap: 14px; }
.panel-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.panel-toolbar .tag { margin-left: 4px; }

/* Spalten verschieben */
.col-title[draggable="true"] { cursor: grab; }
.col-title[draggable="true"]:active { cursor: grabbing; }
.col.is-moving { opacity: 0.4; }

/* Notizen als Karten wie Kommentare, @Erwähnungen hervorgehoben. */
.note-card { padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.note-card .comment-head { align-items: center; }
.mention { color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); border-radius: 4px; padding: 0 3px; font-weight: 600; }
.mention-wrap { position: relative; width: 100%; }
.mention-wrap textarea { width: 100%; }
.mention-list { position: absolute; left: 0; top: 100%; z-index: 20; display: grid; min-width: 220px; margin-top: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); }
.mention-list[hidden] { display: none; }
.mention-item { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border: 0; border-radius: 6px; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.mention-item:hover, .mention-item.is-active { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.col-search-note { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; margin: 8px 8px 0; font-size: 12px; color: var(--muted); }

/* Beschreibung mit Formatierung */
.rich { display: grid; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.rich:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.rich-tools { display: flex; flex-wrap: wrap; gap: 2px; padding: 4px; border-bottom: 1px solid var(--line); }
.rich-btn { min-width: 30px; height: 28px; padding: 0 7px; border: 0; border-radius: 6px; background: none; color: var(--ink); font: inherit; font-size: 14px; cursor: pointer; }
.rich-btn:hover { background: var(--sunken); }
.rich-area { position: relative; min-height: 110px; max-height: 420px; overflow: auto; padding: 10px 12px; outline: none; line-height: 1.5; overflow-wrap: anywhere; }
.rich-area.is-empty::before { content: attr(data-placeholder); color: var(--muted); pointer-events: none; position: absolute; }
.rich-area ul, .rich-area ol { margin: 4px 0; padding-left: 22px; }
.rich-area a, .rich-linkbar a { color: var(--accent); text-decoration: underline; }
.rich-linkbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; padding: 6px 12px; border-top: 1px solid var(--line); font-size: 13px; }
.rich-linkbar[hidden] { display: none; }
/* Anhänge */
.attachment-box { display: grid; gap: 6px; margin-top: 8px; }
.attachments { display: grid; gap: 6px; }
.attachments:empty { display: none; }
.attachment { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.attachment-thumb { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 6px; overflow: hidden; background: var(--sunken); text-decoration: none; }
.attachment-thumb img { width: 100%; height: 100%; object-fit: cover; }
.attachment-type { font-size: 11px; font-weight: 700; color: var(--danger); }
.attachment-body { display: grid; min-width: 0; flex: 1; font-size: 13px; }
.attachment-name { font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attachment-name:hover { text-decoration: underline; }

/* Formatierter Text in der Ansicht (Infos bei Leads/Kunden) */
.rich-view { white-space: normal; color: var(--ink); }
.rich-view ul, .rich-view ol { margin: 4px 0; padding-left: 22px; }
.rich-view a { color: var(--accent); text-decoration: underline; }

/* Projekt kopieren: Auswahl, was mitkommt */
.copy-options { display: grid; gap: 6px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--sunken); }
.copy-options[hidden] { display: none; }
.copy-options .muted { font-size: 13px; margin: 0 0 2px; }
.copy-sub { display: grid; gap: 6px; padding-left: 24px; }
/* Tags-Fenster: Zeile zum Anlegen oben abgesetzt */
.tag-create-row { padding-bottom: 12px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.tag-bulk { display: flex; gap: 8px; justify-content: flex-end; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
/* Wiederholung in der Aufgabe */
.repeat-box { display: flex; align-items: center; gap: 8px; }
.repeat-box select { flex: 1 1 auto; width: auto; min-width: 0; }
.repeat-box .repeat-every { flex: 0 0 64px; width: 64px; }
.repeat-hint { margin: -6px 0 0; }
.repeat-hint[hidden], .repeat-box [hidden] { display: none; }
/* Erledigt-Haken auf Karten und im Aufgabenfenster */
.task-head { display: flex; gap: 8px; align-items: flex-start; }
.task-head .task-title { flex: 1; min-width: 0; }
.done-btn { flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 0; border: 0; background: none; color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; }
.done-mark { display: grid; place-items: center; width: 20px; height: 20px; border: 2px solid color-mix(in srgb, var(--muted) 55%, transparent); border-radius: 50%; font-size: 12px; font-weight: 700; line-height: 1; color: transparent; transition: background .15s, border-color .15s, color .15s; }
.done-btn:hover .done-mark { border-color: var(--ok); color: var(--ok); }
.done-btn.is-done .done-mark { background: var(--ok); border-color: var(--ok); color: #fff; }
.done-btn.is-done { color: var(--ok); font-weight: 600; }
.btn-done { display: inline-flex; align-items: center; gap: 8px; }
.btn-done:hover .done-mark { border-color: var(--ok); color: var(--ok); }
/* Checklisten */
.checklists { display: grid; gap: 12px; justify-items: start; }
.checklist { display: grid; gap: 6px; width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.checklist-head { display: flex; align-items: center; gap: 10px; }
.form .checklist-title, .checklist-title { flex: 1; min-width: 0; padding: 2px 4px; border: 1px solid transparent; border-radius: 6px; background: none; font-weight: 650; }
.checklist-title:hover, .checklist-title:focus { border-color: var(--line); background: var(--bg); }
.checklist-count { font-size: 13px; font-variant-numeric: tabular-nums; }
.checklist-bar { height: 4px; border-radius: 4px; background: var(--sunken); overflow: hidden; }
.checklist-bar span { display: block; height: 100%; background: var(--ok); transition: width .2s; }
.checklist-items { display: grid; gap: 2px; }
.checklist-item { display: flex; align-items: center; gap: 8px; min-height: 30px; padding: 2px 4px; border-radius: 6px; }
.checklist-item:hover { background: var(--sunken); }
.checklist-node.is-moving { opacity: .4; }
.checklist-grip { cursor: grab; color: var(--muted); font-size: 12px; letter-spacing: -2px; opacity: .35; user-select: none; }
.checklist-item:hover .checklist-grip { opacity: 1; }
.checklist-check input { width: 17px; height: 17px; accent-color: var(--ok); cursor: pointer; }
.checklist-text { flex: 1; min-width: 0; overflow-wrap: anywhere; cursor: text; }
.checklist-item.is-done .checklist-text { color: var(--muted); text-decoration: line-through; }
.checklist-edit { flex: 1; min-width: 0; }
.checklist-del { opacity: 0; color: var(--muted); }
.checklist-item:hover .checklist-del, .checklist-del:focus { opacity: 1; }
.form .checklist-add, .checklist-add { width: 100%; padding: 5px 8px; border: 1px dashed var(--line); border-radius: 6px; background: none; }
.check-count { color: var(--muted); }
.check-count.is-complete { color: var(--ok); font-weight: 600; }
/* Umschalter hell/dunkel neben dem Logo */
.brand { justify-content: space-between; }
.brand-name { display: flex; align-items: center; gap: 10px; }
.theme-btn { width: 32px; height: 32px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font-size: 16px; line-height: 1; cursor: pointer; }
.theme-btn:hover { border-color: var(--muted); }
.post-actions { display: flex; gap: 8px; justify-content: flex-end; }
.note-card textarea { width: 100%; }
.link-danger:hover { color: var(--danger); }
/* Komplett: abgeschlossen, aber sichtbar */
.task.is-complete, .row.is-complete { opacity: .5; }
.task.is-complete:hover, .row.is-complete:hover { opacity: .8; }
.complete-badge { display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px; border-radius: 4px; background: var(--sunken); color: var(--muted); font-size: 12px; font-weight: 600; }
.complete-toggle { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.complete-toggle input { width: 18px; height: 18px; margin-top: 1px; accent-color: var(--ok); cursor: pointer; }
.complete-toggle.is-on { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 10%, transparent); }
/* Checklisten: Unterpunkte und Zuständige */
.checklist-subwrap { display: grid; gap: 2px; margin: 0 0 4px 34px; padding-left: 10px; border-left: 2px solid var(--line); }
.checklist-sub { display: grid; gap: 2px; }
.checklist-subadd { opacity: 0; font-size: 12px; white-space: nowrap; color: var(--muted); }
.checklist-item:hover .checklist-subadd, .checklist-subadd:focus { opacity: 1; }
.checklist-who { flex: none; min-width: 26px; height: 24px; padding: 0 6px; border: 1px dashed var(--line); border-radius: 999px; background: none; color: var(--muted); font-size: 11px; font-weight: 600; cursor: pointer; opacity: 0; }
.checklist-item:hover .checklist-who, .checklist-who:focus, .checklist-who.is-set { opacity: 1; }
.checklist-who.is-set { border: 0; background: var(--sunken); color: var(--ink); }
.checklist-item { position: relative; }
.who-menu { position: absolute; right: 0; top: 100%; z-index: 30; display: grid; min-width: 200px; max-height: 260px; overflow: auto; padding: 4px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); }
.who-item { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border: 0; border-radius: 6px; background: none; color: inherit; font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
.who-item:hover, .who-item.is-on { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.badge-muted { background: var(--sunken); color: var(--muted); }
/* Projekt-Boards: Spalten ein Drittel breiter (230 → 310 px), damit Karten nicht so hoch werden */
.board.board-tasks { grid-auto-columns: minmax(310px, 1fr); }
/* Seitenleiste: Projekt-Ordner */
.nav-title-row { display: flex; align-items: center; justify-content: space-between; position: relative; }
.nav-plus { width: 24px; height: 24px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); font-size: 16px; line-height: 1; cursor: pointer; letter-spacing: 0; }
.nav-plus:hover { border-color: var(--muted); }
.folder { display: grid; gap: 1px; border-radius: 8px; position: relative; }
.folder-head { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 7px; color: var(--ink); font-weight: 600; cursor: pointer; user-select: none; position: relative; }
.folder-head:hover { background: var(--sunken); }
.folder-caret { width: 12px; color: var(--muted); font-size: 16px; line-height: 1; text-align: center; transition: transform .15s; }
.folder-caret.is-open { transform: rotate(90deg); }
.folder-icon { font-size: 14px; }
.folder-count { margin-left: auto; font-size: 12px; font-weight: 500; color: var(--muted); }
.folder-more { border: 0; background: none; color: var(--muted); font-size: 15px; line-height: 1; padding: 0 4px; border-radius: 4px; cursor: pointer; opacity: 0; }
.folder-head:hover .folder-more, .folder-more:focus { opacity: 1; }
.folder-items { display: grid; gap: 1px; margin-left: 16px; padding-left: 6px; border-left: 1px solid var(--line); }
.folder-empty { font-size: 12px; padding: 4px 8px; }
.folder-loose { display: grid; gap: 2px; min-height: 8px; padding-bottom: 16px; border-radius: 8px; }
.drop-target { outline: 2px dashed var(--accent); outline-offset: 1px; background: color-mix(in srgb, var(--accent) 8%, transparent); }
.nav-link.is-dragging { opacity: .4; }
.pop-menu { position: absolute; right: 0; top: 100%; z-index: 40; display: grid; min-width: 210px; padding: 4px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); text-transform: none; letter-spacing: 0; font-weight: 400; }
.pop-item { padding: 7px 10px; border: 0; border-radius: 6px; background: none; color: var(--ink); font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
.pop-item:hover { background: var(--sunken); }
.pop-item.is-danger { color: var(--danger); }
.col-add-btn { font-size: 18px; font-weight: 500; }
.col-add[hidden] { display: none; }
/* Ablagefläche für Dateien (Beschreibung einer Aufgabe) */
.drop-field { position: relative; border-radius: 10px; }
.drop-field.is-file-over::after { content: attr(data-drop-hint); position: absolute; inset: -6px; z-index: 5; display: grid; place-items: center; padding: 12px;
  border: 2px dashed var(--accent); border-radius: 12px; background: color-mix(in srgb, var(--accent) 14%, var(--surface)); color: var(--accent); font-weight: 650; text-align: center; pointer-events: none; }
/* Aufgabenfenster: Aktionsleiste oben, bleibt beim Scrollen stehen */
.task-actions, .dlg-actions { position: sticky; top: -1px; z-index: 6; margin: -4px -4px 4px; padding: 8px 4px; background: var(--surface); border-bottom: 1px solid var(--line); }
.dlg-head .dlg-close { margin-left: auto; }
.dlg-main { display: inline-flex; gap: 8px; margin-left: auto; white-space: nowrap; }
/* Menü mit Ordnern */
.nav-list { display: grid; gap: 2px; }
.nav-list .nav-link[hidden], .folder-items[hidden] { display: none; }
.nav-folder[hidden] { display: none; }
.crm-hint[hidden] { display: none; }
