:root {
  --bg: #ffffff; --bg2: #f7f7f5; --bg3: #efefec; --fg: #1f1f1d; --fg2: #6b6b67; --line: #e6e6e2;
  --accent: #4f46e5; --accent-fg: #fff; --danger: #dc2626; --ok: #059669; --warn: #d97706;
  --radius: 8px; --shadow: 0 8px 30px rgba(0,0,0,.12);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #191919; --bg2: #202020; --bg3: #2a2a2a; --fg: #e9e9e7; --fg2: #9b9b97; --line: #333;
    --accent: #818cf8; --accent-fg: #111; --danger: #f87171; --ok: #34d399; --warn: #fbbf24;
    --shadow: 0 8px 30px rgba(0,0,0,.5); color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--fg); font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 26px; margin: 0; }
h2 { font-size: 15px; margin: 0 0 10px; }
h3 { font-size: 14px; margin: 16px 0 8px; }
.muted { color: var(--fg2); }
.small { font-size: 12px; }
.grow { flex: 1; min-width: 0; }
.hidden { display: none !important; }
.row { display: flex; gap: 8px; align-items: center; }
.row.end { justify-content: flex-end; }
.row.wrap { flex-wrap: wrap; margin-top: 12px; }
.boot { padding: 40px; color: var(--fg2); }

button, input, select, textarea { font: inherit; color: inherit; }
button { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 6px 12px; cursor: pointer; white-space: nowrap; }
button:hover { background: var(--bg3); }
button.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
button.primary:hover { filter: brightness(1.08); }
button.danger { background: var(--danger); color: #fff; border-color: var(--danger); }
button.ghost { background: transparent; border-color: transparent; }
button.ghost.danger { color: var(--danger); background: transparent; }
button.icon { border: none; background: transparent; padding: 2px 8px; font-size: 16px; color: var(--fg2); }
button.icon:hover { background: var(--bg3); color: var(--fg); }
button.small, button.icon.small { font-size: 12px; padding: 2px 8px; }
button:disabled { opacity: .5; cursor: default; }
input, select, textarea { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; min-width: 0; }
input:focus, select:focus, textarea:focus, button:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea { width: 100%; resize: vertical; }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
input[type=color] { padding: 0; width: 36px; height: 28px; }

/* Shell */
.shell { display: flex; height: 100vh; }
.sidebar { width: 240px; flex-shrink: 0; background: var(--bg2); border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.brand { display: flex; gap: 10px; align-items: center; padding: 16px; }
.brand.big { justify-content: center; font-size: 20px; margin-bottom: 12px; }
.logo { color: var(--accent); font-size: 22px; }
.nav { flex: 1; overflow-y: auto; padding: 0 8px; }
.nav-item { display: flex; gap: 10px; padding: 6px 10px; border-radius: 6px; color: var(--fg); }
.nav-item:hover { background: var(--bg3); text-decoration: none; }
.nav-item.active { background: var(--bg3); font-weight: 600; }
.nav-ic { width: 20px; text-align: center; }
.nav-sep { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--fg2); padding: 14px 10px 4px; }
.me { display: flex; gap: 10px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--line); }
.content { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar { display: flex; gap: 8px; align-items: center; padding: 8px 24px; border-bottom: 1px solid var(--line); }
.menu-btn { display: none; }
.main { flex: 1; overflow: auto; }
.view { padding: 24px 32px 60px; max-width: 1400px; }

.search { position: relative; width: 360px; max-width: 100%; }
.search input { width: 100%; background: var(--bg2); }
.search-results { position: absolute; top: 100%; left: 0; right: 0; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); z-index: 20; max-height: 60vh; overflow: auto; }
.search-results:empty { display: none; }
.search-hit { display: block; width: 100%; text-align: left; border: 0; border-radius: 0; background: transparent; }
.pad { padding: 8px 12px; }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; }
.section-title { margin-top: 28px; }

/* Avatare & Tags */
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; color: #fff; font-size: 10px; font-weight: 700; flex-shrink: 0; }
.avatar.empty { background: var(--bg3); color: var(--fg2); }
.person { display: inline-flex; gap: 6px; align-items: center; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 10px; background: var(--bg3); font-size: 12px; white-space: nowrap; }
.tag[data-v="Hoch"], .tag[data-v="Verloren"] { background: #fde2e2; color: #9b1c1c; }
.tag[data-v="Kritisch"] { background: #dc2626; color: #fff; }
.tag[data-v="In Arbeit"], .tag[data-v="Gespräch"], .tag[data-v="Geplant"] { background: #dbeafe; color: #1e40af; }
.tag[data-v="Review"], .tag[data-v="Angebot"], .tag[data-v="Freigabe"] { background: #fef3c7; color: #92400e; }
.tag[data-v="Erledigt"], .tag[data-v="Gewonnen"], .tag[data-v="Veröffentlicht"], .tag[data-v="Aktiv"], .tag[data-v="Beschlossen"] { background: #d1fae5; color: #065f46; }
.date { font-size: 12px; color: var(--fg2); white-space: nowrap; }
.date.overdue, .overdue { color: var(--danger); font-weight: 600; }
.warn-text { color: var(--warn); }

/* KPIs & Panels */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 20px; }
.kpi { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; background: var(--bg); }
.kpi-label { font-size: 12px; color: var(--fg2); }
.kpi-value { font-size: 26px; font-weight: 700; margin: 2px 0; }
.kpi-sub { font-size: 12px; color: var(--fg2); }
.kpi.warn { border-left: 4px solid var(--warn); }
.kpi.ok { border-left: 4px solid var(--ok); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 16px; margin-bottom: 16px; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; background: var(--bg); min-width: 0; }
.grid2 .panel { margin-bottom: 0; }
.list { list-style: none; margin: 0; padding: 0; }
.list-item { display: flex; gap: 10px; align-items: center; padding: 7px 6px; border-radius: 6px; cursor: pointer; }
.list-item:hover { background: var(--bg2); }
.list-item.static { cursor: default; }
.list-item.is-done .grow { text-decoration: line-through; color: var(--fg2); }
.activity { list-style: none; padding: 0; margin: 0; }
.activity li { display: flex; gap: 4px; align-items: center; padding: 5px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.team { display: flex; flex-direction: column; gap: 10px; }
.member { display: flex; gap: 10px; align-items: flex-start; }
.member .avatar { width: 32px; height: 32px; font-size: 12px; }
.member-stats { display: flex; flex-direction: column; align-items: flex-end; font-size: 12px; }
.mini-road { display: flex; flex-direction: column; gap: 8px; }
.mini-row { display: grid; grid-template-columns: 180px 1fr; gap: 10px; align-items: center; font-size: 13px; }
.mini-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.progress { position: relative; height: 8px; background: var(--bg3); border-radius: 4px; overflow: visible; margin: 8px 0; }
.progress-fill { height: 100%; background: var(--accent); border-radius: 4px; }
.progress-exp { position: absolute; top: -3px; width: 2px; height: 14px; background: var(--fg); opacity: .5; }
.alert { background: #fef3c7; color: #78350f; border-radius: var(--radius); padding: 10px 14px; margin-bottom: 14px; }
.conflict { background: #fee2e2; color: #7f1d1d; border-radius: var(--radius); padding: 10px 14px; margin-bottom: 14px; }

/* Filter & Seg */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.filters input[type=search] { width: 200px; }
label.check { display: inline-flex; gap: 6px; align-items: center; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--bg3); font-weight: 600; }

/* Tabelle */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.table-wrap.scroll { max-height: 480px; overflow-y: auto; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-weight: 500; color: var(--fg2); font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--line); cursor: pointer; user-select: none; white-space: nowrap; background: var(--bg2); position: sticky; top: 0; }
.tbl th.sorted { color: var(--fg); }
.tbl td { padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr { cursor: pointer; }
.tbl tbody tr:hover { background: var(--bg2); }
.tbl tr.is-done td { color: var(--fg2); }
.tbl tr.bad td { color: var(--danger); }
.tbl td input:not([type=color]), .tbl td select { width: 100%; }
.tbl.small td { font-size: 12px; padding: 4px 8px; }
.empty { text-align: center; color: var(--fg2); padding: 24px; }

/* Board */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(240px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 12px; }
.col { background: var(--bg2); border-radius: var(--radius); padding: 8px; min-height: 200px; }
.col.over { outline: 2px dashed var(--accent); }
.col-head { display: flex; gap: 6px; align-items: center; padding: 4px 4px 10px; }
.card { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; margin-bottom: 8px; cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.card:hover { border-color: var(--accent); }
.card.dragging { opacity: .4; }
.card.blocked { border-left: 3px solid var(--danger); }
.panel.attention { border-color: var(--warn); border-left: 4px solid var(--warn); }
.tag[data-v="Blockiert"] { background: #fde2e2; color: #9b1c1c; }
.card-title { font-weight: 500; margin-bottom: 6px; word-break: break-word; }
.card-meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 12px; }

/* Gantt */
.gantt { border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; max-height: calc(100vh - 230px); position: relative; }
.g-head { display: flex; position: sticky; top: 0; z-index: 4; background: var(--bg2); border-bottom: 1px solid var(--line); width: max-content; min-width: 100%; }
.g-side { width: 300px; flex-shrink: 0; position: sticky; left: 0; z-index: 3; background: var(--bg); display: flex; gap: 6px; align-items: center; padding: 0 8px; border-right: 1px solid var(--line); overflow: hidden; }
.g-side.head { background: var(--bg2); font-size: 12px; color: var(--fg2); z-index: 5; }
.g-headtrack { position: relative; }
.g-months, .g-ticks { position: relative; height: 22px; }
.g-month { position: absolute; top: 0; height: 22px; font-size: 12px; font-weight: 600; padding: 2px 6px; border-left: 1px solid var(--line); white-space: nowrap; overflow: hidden; }
.g-tick { position: absolute; top: 0; height: 22px; font-size: 10px; color: var(--fg2); text-align: center; line-height: 22px; border-left: 1px solid var(--line); overflow: hidden; }
.g-tick.we { background: var(--bg3); }
.g-body { position: relative; width: max-content; min-width: 100%; }
.g-gridwrap { position: absolute; inset: 0 0 0 300px; pointer-events: none; }
.g-grid { position: relative; height: 100%; }
.g-line { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line); }
.g-line.strong { background: var(--fg2); opacity: .3; }
.g-weekend { position: absolute; top: 0; bottom: 0; background: var(--bg2); }
.g-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--danger); z-index: 2; }
.g-row { display: flex; height: 34px; border-bottom: 1px solid var(--line); }
.g-row.phase { background: color-mix(in srgb, var(--bg2) 60%, transparent); }
.g-row.phase .g-side { background: var(--bg2); }
.g-row.task .g-side { padding-left: 34px; cursor: pointer; }
.g-row.done .g-name { text-decoration: line-through; color: var(--fg2); }
.g-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; font-size: 13px; cursor: pointer; }
.g-name.strong { font-weight: 600; }
.g-track { position: relative; flex-shrink: 0; }
.g-bar { position: absolute; top: 6px; height: 22px; border-radius: 5px; background: color-mix(in srgb, var(--c) 30%, var(--bg)); border: 1px solid var(--c); cursor: grab; overflow: hidden; touch-action: none; user-select: none; z-index: 1; }
.g-bar.phase { top: 5px; height: 24px; }
.g-bar.task { top: 8px; height: 18px; }
.g-bar.late { border: 2px solid var(--danger); }
.g-bar.conflict { outline: 2px dashed var(--danger); }
.g-bar:active { cursor: grabbing; }
.g-prog { position: absolute; inset: 0 auto 0 0; background: var(--c); opacity: .75; }
.g-label { position: relative; font-size: 11px; padding: 0 6px; white-space: nowrap; line-height: 20px; font-weight: 500; pointer-events: none; }
.g-bar.task .g-label { line-height: 16px; }
.g-handle { position: absolute; right: 0; top: 0; bottom: 0; width: 8px; cursor: ew-resize; }
.g-handle:hover { background: rgba(0,0,0,.15); }
.g-diamond { position: absolute; top: 9px; width: 16px; height: 16px; background: var(--warn); transform: rotate(45deg); cursor: pointer; z-index: 1; }
.warn-icon { color: var(--danger); cursor: help; }
.row.done { opacity: .6; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--fg2); margin: 8px 0 12px; align-items: center; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 5px; vertical-align: -2px; }
.legend i.exp { display: none; }
.legend i.in, .bar.in { background: var(--ok); }
.legend i.out, .bar.out { background: var(--danger); }

/* Finanzen */
.bars { display: flex; gap: 6px; height: 180px; align-items: flex-end; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; }
.bar-pair { flex: 1; display: flex; gap: 2px; align-items: flex-end; width: 100%; justify-content: center; }
.bar { width: 40%; max-width: 16px; border-radius: 3px 3px 0 0; min-height: 1px; opacity: .85; }
.bar-lbl { font-size: 11px; color: var(--fg2); margin-top: 4px; }
.hbars { display: flex; flex-direction: column; gap: 8px; }
.hbar { display: grid; grid-template-columns: 140px 1fr 80px; gap: 8px; align-items: center; font-size: 13px; }
.hbar-t { background: var(--bg3); height: 10px; border-radius: 5px; }
.hbar-f { background: var(--accent); height: 100%; border-radius: 5px; }
.hbar-v { text-align: right; }

/* Kalender */
.cal-nav { margin-bottom: 10px; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.cal-hd { background: var(--bg2); font-size: 12px; color: var(--fg2); padding: 6px 8px; border-bottom: 1px solid var(--line); }
.cal-cell { min-height: 110px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 4px; overflow: hidden; }
.cal-cell:nth-child(7n) { border-right: 0; }
.cal-cell.other { background: var(--bg2); opacity: .6; }
.cal-cell.today .cal-day { background: var(--danger); color: #fff; border-radius: 50%; width: 22px; text-align: center; }
.cal-day { font-size: 12px; margin-bottom: 4px; }
.cal-item { display: flex; gap: 4px; align-items: center; font-size: 11px; padding: 2px 4px; border-radius: 4px; background: var(--bg3); margin-bottom: 3px; cursor: pointer; white-space: nowrap; overflow: hidden; }
.cal-item .avatar { width: 16px; height: 16px; font-size: 8px; }
.cal-item span:last-child { overflow: hidden; text-overflow: ellipsis; }
.cal-item[data-v="Veröffentlicht"] { background: #d1fae5; color: #065f46; }
.cal-item[data-v="Geplant"] { background: #dbeafe; color: #1e40af; }

/* Wiki */
.wiki { display: grid; grid-template-columns: 240px 1fr; gap: 24px; }
.wiki-tree { border-right: 1px solid var(--line); padding-right: 12px; }
.tree-item { display: flex; align-items: center; border-radius: 6px; }
.tree-item a { flex: 1; padding: 4px 6px; color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tree-item.active { background: var(--bg3); font-weight: 600; }
.tree-item:hover { background: var(--bg2); }
.tree-item button { visibility: hidden; }
.tree-item:hover button { visibility: visible; }
.wiki-page { max-width: 820px; min-width: 0; }
.wiki-head { display: flex; gap: 8px; align-items: center; margin: 6px 0; }
.wiki-title { font-size: 32px; font-weight: 700; border: 0; background: transparent; flex: 1; padding: 4px 0; }
.wiki-icon { font-size: 28px; width: 56px; border: 0; background: transparent; text-align: center; }
.wiki-actions { margin-bottom: 16px; flex-wrap: wrap; }
.wiki-editor { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 14px; line-height: 1.6; border: 1px solid var(--line); padding: 16px; min-height: 400px; resize: none; overflow: hidden; }
.wiki-view { min-height: 200px; }

/* Markdown */
.md { line-height: 1.7; word-wrap: break-word; }
.md h1 { font-size: 26px; margin: 20px 0 8px; }
.md h2 { font-size: 20px; margin: 18px 0 6px; }
.md h3 { font-size: 16px; margin: 14px 0 4px; }
.md p { margin: 6px 0; }
.md code { background: var(--bg3); padding: 1px 5px; border-radius: 4px; font-size: 13px; }
.md pre { background: var(--bg2); padding: 12px; border-radius: 6px; overflow-x: auto; }
.md pre code { background: none; padding: 0; }
.md blockquote { border-left: 3px solid var(--line); margin: 8px 0; padding-left: 12px; color: var(--fg2); }
.md ul.tasks { list-style: none; padding-left: 4px; }
.md ul.tasks li { display: flex; gap: 8px; align-items: baseline; }
.md ul.tasks li.done span { text-decoration: line-through; color: var(--fg2); }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }

/* Modal & Formular */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; z-index: 50; overflow-y: auto; }
.modal { background: var(--bg); border-radius: 12px; box-shadow: var(--shadow); width: 480px; max-width: 100%; }
.modal.wide { width: 760px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px 0; }
.modal-head h2 { font-size: 18px; margin: 0; word-break: break-word; }
.modal-body { padding: 16px 20px 20px; }
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.form.narrow { max-width: 520px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.field > span { color: var(--fg2); font-weight: 500; }
.field.full, .full { grid-column: 1 / -1; }
.field.check { flex-direction: row-reverse; justify-content: flex-end; align-items: center; gap: 8px; }
.form-error { color: var(--danger); grid-column: 1 / -1; font-size: 13px; }
.form-error:empty { display: none; }
.meta { font-size: 12px; margin-top: 12px; }
.comments { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 4px; }
.comment { padding: 8px 0; border-bottom: 1px solid var(--line); }
.comment .md { font-size: 13px; }
.comments textarea { margin-top: 8px; }
.secret { font-size: 18px; letter-spacing: .08em; background: var(--bg2); padding: 10px 14px; border-radius: 6px; user-select: all; word-break: break-all; white-space: pre-wrap; }

/* Login */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg2); padding: 16px; }
.login-card { background: var(--bg); padding: 32px; border-radius: 12px; box-shadow: var(--shadow); width: 380px; max-width: 100%; display: flex; flex-direction: column; gap: 14px; }
.login-card h2 { margin: 0; font-size: 20px; }

/* Toasts */
#toasts { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: 8px; box-shadow: var(--shadow); max-width: 380px; }
.toast.error { background: var(--danger); color: #fff; }

/* Baukasten */
.button-link { display: inline-block; padding: 6px 12px; border: 1px solid var(--line); border-radius: 6px; color: var(--fg); white-space: nowrap; }
.button-link:hover { background: var(--bg3); text-decoration: none; }
.icon-input { width: 52px; text-align: center; font-size: 18px; }
.full-w { width: 100%; margin-bottom: 8px; }
.nowrap { white-space: nowrap; }
.tree-item.is-deleted a { color: var(--fg2); text-decoration: line-through; }
.builder-panel { min-width: 0; }
.tbl.builder td { cursor: default; }
.tbl.builder tbody tr { cursor: default; }
.tbl.builder td input:not([type=checkbox]) { min-width: 160px; }
.opt-list { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; max-height: 50vh; overflow: auto; }
.opt-row input { min-width: 0; }
.lock { width: 28px; text-align: center; cursor: help; }
.deleted-fields { margin-top: 12px; }

/* Diagramme – Farben in fester Reihenfolge (farbenblind-geprüfte Palette), hell/dunkel getrennt gestuft */
:root {
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100;
  --series-5: #e87ba4; --series-6: #008300; --series-7: #4a3aa7; --series-8: #e34948;
  --c-grid: #e1e0d9; --c-axis: #c3c2b7; --c-muted: #898781; --delta-up: #006300; --delta-down: #d03b3b;
}
@media (prefers-color-scheme: dark) {
  :root {
    --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500;
    --series-5: #d55181; --series-6: #008300; --series-7: #9085e9; --series-8: #e66767;
    --c-grid: #2c2c2a; --c-axis: #383835; --delta-up: #0ca30c; --delta-down: #e66767;
  }
}
.chart { position: relative; }
.chart-plot { position: relative; width: 100%; }
.chart-svg { display: block; overflow: visible; }
.c-grid { stroke: var(--c-grid); stroke-width: 1; }
.c-axis { stroke: var(--c-axis); stroke-width: 1; }
.c-tick { fill: var(--c-muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.c-label { fill: var(--fg2); font-size: 11px; }
.c-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.c-area { opacity: .1; }
.c-dot { stroke: var(--bg); stroke-width: 2; }
.c-cross { stroke: var(--c-axis); stroke-width: 1; pointer-events: none; }
.chart-empty { color: var(--fg2); font-size: 12px; padding: 14px 0; }
.chart.compact .chart-empty { padding: 12px 0; }
.chart-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--fg2); margin-bottom: 6px; }
.chart-legend i, .chart-tip i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.chart-tip { position: absolute; display: none; pointer-events: none; background: var(--bg); border: 1px solid var(--line); border-radius: 6px;
  box-shadow: var(--shadow); padding: 6px 10px; font-size: 12px; white-space: nowrap; z-index: 5; }
.chart-tip-head { color: var(--fg2); margin-bottom: 2px; }
.chart-tip b { font-weight: 600; margin-left: 4px; }

/* Dokumente */
.docs-tree .count { margin-left: auto; padding-right: 6px; }
.docs-tree .tree-item.over, .folder-card.over { outline: 2px dashed var(--accent); }
.docs-tree .storage { margin-top: 14px; padding: 0 6px; }
.docs-panel { min-width: 0; }
.docs-head { margin: 4px 0 12px; }
.docs-head h2 { margin: 0; font-size: 20px; }
.folder-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; margin-bottom: 14px; }
.folder-card { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); color: var(--fg); }
.folder-card:hover { background: var(--bg2); text-decoration: none; }
.folder-icon { font-size: 18px; }
.dropzone { border: 2px dashed transparent; border-radius: var(--radius); padding: 2px; }
.dropzone.over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, var(--bg)); }
.dropzone-hint { border: 2px dashed var(--line); border-radius: var(--radius); padding: 40px 16px; }
.docs-tbl tbody tr { cursor: default; }
.docs-tbl td { vertical-align: top; }
.doc-name { display: inline-flex; gap: 8px; align-items: baseline; word-break: break-word; }
.icon-link { padding: 2px 8px; color: var(--fg2); }
.icon-link:hover { text-decoration: none; color: var(--fg); }

/* Online-Räume */
.joinbox { margin-left: auto; position: relative; display: flex; align-items: center; gap: 2px; }
.join-btn { display: inline-flex; align-items: center; gap: 6px; background: var(--accent); color: var(--accent-fg); border-radius: 6px; padding: 6px 12px; font-weight: 600; white-space: nowrap; }
.join-btn:hover { filter: brightness(1.08); text-decoration: none; }
.join-btn.ghost { background: transparent; color: var(--accent); border: 1px dashed var(--accent); font-weight: 500; }
.join-more { padding: 4px 6px; }
.join-menu { position: absolute; right: 0; top: 110%; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); z-index: 30; min-width: 220px; padding: 4px; }
.join-item { display: block; padding: 7px 10px; border-radius: 6px; color: var(--fg); white-space: nowrap; }
.join-item:hover { background: var(--bg2); text-decoration: none; }
.join-mini { font-size: 11px; padding: 1px 6px; border-radius: 4px; background: var(--accent); color: var(--accent-fg); white-space: nowrap; }
.join-mini:hover { text-decoration: none; }
.online-banner { display: flex; align-items: center; gap: 12px; padding: 12px 16px; margin-bottom: 16px; border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent) 10%, var(--bg)); border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--bg)); font-weight: 500; flex-wrap: wrap; }
.room-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin-bottom: 16px; }
.room-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; }
.room-card.default { border-color: var(--accent); }
.room-icon { font-size: 18px; }
.room-actions { margin-top: 6px; flex-wrap: wrap; }
@media (max-width: 860px) { .joinbox .join-btn { padding: 6px 8px; font-size: 13px; } }

/* Finanzen: gestapelte Monatsbalken (Laufend unten, Einmalig oben, 2px Lücke) */
.bar-stack { width: 40%; max-width: 16px; display: flex; flex-direction: column-reverse; gap: 2px; min-height: 0; }
.bar-stack .seg { min-height: 2px; flex-basis: 0; }
.bar-stack .seg:last-child { border-radius: 3px 3px 0 0; }
.seg.rec, .legend i.rec { background: var(--series-1); }
.seg.once, .legend i.once { background: var(--series-2); }
.bar.in, .legend i.in { background: var(--series-3); }
.kpi .progress { margin: 4px 0; }

/* Checkliste & Entscheidungen */
.checklist-bar { align-items: center; gap: 14px; margin-bottom: 4px; }
.row-tools { display: inline-flex; gap: 0; opacity: .35; }
.list-item:hover .row-tools, .row-tools:focus-within { opacity: 1; }
.clamp { max-width: 640px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Assistent */
.as-wrap { max-width: 900px; display: flex; flex-direction: column; gap: 10px; }
.as-log { display: flex; flex-direction: column; gap: 14px; max-height: calc(100vh - 330px); min-height: 160px; overflow-y: auto; padding: 4px 2px; }
.as-empty { padding: 30px 10px; text-align: center; }
.as-entry { display: flex; flex-direction: column; gap: 6px; }
.as-q { align-self: flex-end; display: flex; gap: 8px; align-items: baseline; background: color-mix(in srgb, var(--accent) 12%, var(--bg)); border-radius: 12px 12px 2px 12px; padding: 7px 12px; max-width: 80%; word-break: break-word; }
.as-res { align-self: flex-start; border: 1px solid var(--line); border-radius: 12px 12px 12px 2px; padding: 10px 14px; max-width: 92%; min-width: 280px; background: var(--bg); display: flex; flex-direction: column; gap: 8px; }
.as-res.as-confirm { border-color: var(--accent); }
.as-res.as-error { background: var(--bg2); }
.as-res .list { margin: 0; }
.as-fields td { padding: 2px 12px 2px 0; vertical-align: top; }
.as-fields td:first-child { white-space: nowrap; }
.as-sec { border-top: 1px solid var(--line); padding-top: 6px; }
.as-sec-h { font-weight: 600; font-size: 13px; margin-bottom: 2px; }
.as-res.as-summary { max-width: 100%; width: 100%; }
.as-choices { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.as-help { margin: 4px 0; padding-left: 18px; }
.as-help li { margin: 3px 0; }
.linklike { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; text-align: left; }
.linklike:hover { text-decoration: underline; background: none; }
.as-bar { display: flex; gap: 8px; }
.as-inputwrap { flex: 1; position: relative; }
.as-input { width: 100%; font-size: 15px; padding: 10px 12px; }
.as-sugg { position: absolute; bottom: 110%; left: 0; right: 0; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); z-index: 20; padding: 4px; }
.as-sugg-item { display: flex; justify-content: space-between; gap: 12px; width: 100%; border: 0; text-align: left; background: transparent; }
.as-sugg-item:hover { background: var(--bg2); }
.as-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 12px; padding: 4px 10px; border-radius: 14px; background: var(--bg2); }

/* Pitch-Countdown */
.kpi.pitch { cursor: pointer; user-select: none; }
.kpi.pitch:hover { background: var(--bg2); }
.pitch-switch { font-size: 11px; color: var(--accent); white-space: nowrap; }

/* Kennzahl-Kacheln */
.metric-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 4px; }
.metric-tile { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; background: var(--bg); min-width: 0; }
.metric-row { align-items: baseline; gap: 10px; }
.delta { font-size: 12px; font-weight: 600; color: var(--fg2); }
.delta.up { color: var(--delta-up); }
.delta.down { color: var(--delta-down); }

/* Bereichs-Überblick */
.area-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin-bottom: 16px; }
.area-card { border: 1px solid var(--line); border-top: 3px solid var(--c); border-radius: var(--radius); padding: 12px 14px; cursor: pointer; background: var(--bg); min-width: 0; }
.area-card:hover { background: var(--bg2); }
.area-head { display: flex; align-items: center; gap: 6px; }
.area-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.area-lines { list-style: none; padding: 0; margin: 4px 0 0; font-size: 13px; color: var(--fg2); }
.area-lines li { padding: 2px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.away { color: var(--warn); }

/* Team-Kalender */
.cal-item.ev { border-left: 3px solid var(--c); background: color-mix(in srgb, var(--c) 14%, var(--bg)); }
.cal-item.ev.absent { background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--c) 22%, var(--bg)) 0 6px, color-mix(in srgb, var(--c) 8%, var(--bg)) 6px 12px); font-weight: 600; }
.cal-day-row { display: flex; align-items: center; gap: 4px; margin-bottom: 4px; }
.cal-day-row .cal-day { margin-bottom: 0; }
.cal-session { font-size: 10px; color: var(--fg2); margin-left: auto; white-space: nowrap; }
.goal { margin-top: 6px; }
.goal .progress { margin: 4px 0; }
.cal-item.extra { background: transparent; color: var(--fg2); border: 1px dashed var(--line); }

/* Mobil */
@media (max-width: 860px) {
  .sidebar { position: fixed; left: -260px; top: 0; bottom: 0; z-index: 40; transition: left .2s; box-shadow: var(--shadow); }
  body.nav-open .sidebar { left: 0; }
  .menu-btn { display: inline-block; }
  .view { padding: 16px; }
  .topbar { padding: 8px 12px; }
  .grid2 { grid-template-columns: 1fr; }
  .form { grid-template-columns: 1fr; }
  .wiki { grid-template-columns: 1fr; }
  .wiki-tree { border-right: 0; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
  .g-side { width: 170px; }
  .g-gridwrap { left: 170px; }
  .cal-cell { min-height: 70px; }
  .cal-item span:last-child { display: none; }
  .mini-row { grid-template-columns: 110px 1fr; }
  .hbar { grid-template-columns: 100px 1fr 70px; }
}
@media (prefers-color-scheme: dark) {
  .tag[data-v="Hoch"], .tag[data-v="Verloren"] { background: #4c1d1d; color: #fecaca; }
  .tag[data-v="In Arbeit"], .tag[data-v="Gespräch"], .tag[data-v="Geplant"], .cal-item[data-v="Geplant"] { background: #1e3a5f; color: #bfdbfe; }
  .tag[data-v="Review"], .tag[data-v="Angebot"], .tag[data-v="Freigabe"] { background: #4a3a10; color: #fde68a; }
  .tag[data-v="Erledigt"], .tag[data-v="Gewonnen"], .tag[data-v="Veröffentlicht"], .tag[data-v="Aktiv"], .tag[data-v="Beschlossen"], .cal-item[data-v="Veröffentlicht"] { background: #064e3b; color: #a7f3d0; }
  .alert { background: #4a3a10; color: #fde68a; }
  .conflict { background: #4c1d1d; color: #fecaca; }
}

/* Passwort-Regeln */
.pw-rules { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--fg2); }
.pw-rules li::before { content: "○ "; }
.pw-rules li.ok { color: var(--ok); }
.pw-rules li.ok::before { content: "✓ "; }

/* Dokumente: Ordner ein-/ausklappen */
.tree-item .tree-toggle { visibility: visible; flex: none; width: 20px; height: 20px; padding: 0; border: 0; background: none; color: var(--fg2); font-size: 12px; line-height: 20px; cursor: pointer; border-radius: 4px; }
.tree-item .tree-toggle:hover { background: var(--bg3); color: var(--fg); }
.tree-item .tree-toggle.placeholder { display: inline-block; cursor: default; }
.tree-tools { gap: 4px; margin: 4px 0 6px; }
.tree-tools button { visibility: visible; font-size: 12px; }

/* Plan-/Soll-Linien in Diagrammen */
.c-line.c-plan { stroke-dasharray: 6 5; stroke-width: 1.5; opacity: .75; }
.chart-legend i.dashed { background: none !important; border-top: 2px dashed; height: 0; width: 14px; align-self: center; }
.plan-ok { color: var(--ok); }
.plan-late { color: var(--warn); }

/* Nutzerplan / Ziele */
.plan-status { gap: 8px; margin: 4px 0 10px; }
.tg-state { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; background: var(--bg3); white-space: nowrap; }
.tg-state.tg-ok { color: var(--ok); }
.tg-state.tg-warn { color: var(--warn); }
.tg-state.tg-late { color: var(--danger); }
.targets-tbl tr { cursor: pointer; }
.targets-tbl tr.group-start td { border-top: 2px solid var(--line); }
.targets-tbl td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Sprint */
a.kpi { color: inherit; text-decoration: none; }
.sprint-kpi .progress { margin: 6px 0 2px; }
.sprint-head { display: flex; flex-direction: column; gap: 10px; }
.sprint-goal { display: flex; flex-direction: column; gap: 2px; }
.sprint-goal strong { font-size: 16px; }
.sprint-targets { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.sprint-targets li { display: flex; gap: 8px; align-items: center; justify-content: space-between; cursor: pointer; padding: 4px 6px; border-radius: 6px; }
.sprint-targets li:hover { background: var(--bg2); }
.sprint-targets li.tg-ok .tag { color: var(--ok); }
.sprint-targets li.tg-warn .tag { color: var(--warn); }
.sprint-targets li.tg-late .tag { color: var(--danger); }
.sprint-layout { display: grid; grid-template-columns: minmax(260px, 340px) 1fr; gap: 16px; align-items: start; margin: 16px 0; }
.sprint-layout .panel { margin: 0; }
.backlog .filters { flex-wrap: wrap; }
.backlog .filters input, .backlog .filters select { flex: 1 1 120px; min-width: 0; }
.backlog-list { display: flex; flex-direction: column; gap: 4px; max-height: 70vh; overflow: auto; }
.bl-item { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); cursor: grab; font-size: 13px; }
.bl-item:hover { background: var(--bg2); }
.backlog.over, .sprint-board.over { outline: 2px dashed var(--accent); outline-offset: 2px; }
.sprint-board .board { overflow-x: auto; }
.list-item.active { background: var(--bg3); }
.mini-prog { width: 80px; }
@media (max-width: 900px) { .sprint-layout { grid-template-columns: 1fr; } }

/* Gantt: Sprints & Ziele */
.g-row.sprints .g-bar.sprint { background: var(--bg3); color: var(--fg); border: 1px solid var(--line); }
.g-row.sprints .g-bar.sprint.now { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.g-sprintband { position: absolute; top: 0; bottom: 0; background: var(--fg); opacity: .025; pointer-events: none; }
.g-target { position: absolute; top: 50%; width: 12px; height: 12px; margin: -6px 0 0 -6px; transform: rotate(45deg); background: var(--c, var(--accent)); border: 2px solid var(--bg); cursor: pointer; }
.g-target.ok { --c: var(--ok); }
.g-target.warn { --c: var(--warn); }
.g-target.late { --c: var(--danger); }
.g-target-label { position: absolute; top: 50%; transform: translate(10px, -50%); font-size: 11px; white-space: nowrap; color: var(--fg2); pointer-events: none; }

/* Wiki: Ordner & Drag & Drop */
.wiki-tree .tree-item[draggable="true"] { cursor: grab; }
.wiki-tree .tree-item.over, .wiki-root.over, .wiki-children.over { outline: 2px dashed var(--accent); outline-offset: 1px; background: var(--bg2); }
.wiki-root { border-radius: 6px; padding: 2px 4px; gap: 4px; }
.wiki-root .drop-hint { display: none; }
.wiki-tree.dragging .wiki-root .drop-hint { display: inline; }
.tree-help { margin: 2px 0 6px; font-size: 11px; }
.wiki-children { border: 1px solid var(--line); border-radius: var(--radius, 10px); padding: 10px 12px; margin: 8px 0 14px; }
.wiki-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; margin-top: 8px; }
.wiki-card { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; color: var(--fg); text-decoration: none; background: var(--bg); }
.wiki-card:hover { background: var(--bg2); }
.wiki-card-icon { font-size: 18px; }

/* Bilder im Wiki (nur aus der eigenen Ablage) */
.md-img { margin: 10px 0; }
.md-img img { max-width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--line); }
.md-img figcaption { margin-top: 4px; }

/* Roadmap: Meilenstein-Leiste */
.ms-strip { margin: 4px 0 12px; }
.ms-strip-head { display: flex; gap: 10px; align-items: baseline; margin-bottom: 6px; }
.ms-list { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.ms-chip { flex: 0 0 190px; border: 1px solid var(--line); border-left: 4px solid var(--fg2); border-radius: 8px; padding: 6px 8px; background: var(--bg); cursor: pointer; }
.ms-chip:hover { background: var(--bg2); }
.ms-chip.ok { border-left-color: var(--ok); }
.ms-chip.warn { border-left-color: var(--warn); }
.ms-chip.late { border-left-color: var(--danger); }
.ms-date { font-size: 12px; color: var(--fg2); }
.ms-title { font-weight: 600; font-size: 13px; line-height: 1.3; margin: 2px 0 4px; }
.ms-foot { gap: 6px; align-items: center; font-size: 12px; }
.ms-chip.ok .ms-state { color: var(--ok); }
.ms-chip.warn .ms-state { color: var(--warn); }
.ms-chip.late .ms-state { color: var(--danger); }
.ms-chip .icon { visibility: visible; }

/* Tresor */
.vault-link a { font-weight: 600; }
.vault-head { gap: 8px; margin-bottom: 4px; }
.vault-unlock { gap: 8px; max-width: 460px; }
.vault-unlock input { flex: 1; }
.vault-group h3 { margin: 14px 0 6px; font-size: 13px; color: var(--fg2); text-transform: uppercase; letter-spacing: .04em; }
.vault-item { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin-bottom: 6px; background: var(--bg); }
.vault-item.broken { border-color: var(--warn); }
.vault-line { gap: 8px; align-items: center; font-size: 13px; padding: 2px 0; }
.vault-line > .muted { width: 70px; flex: none; }
.vault-pw { word-break: break-all; }
.vault-notes { white-space: pre-wrap; margin: 4px 0; padding: 6px 8px; background: var(--bg2); border-radius: 6px; }
.vault-item .icon { visibility: visible; }
