/* Flowdesk – Oberfläche
   Farbsystem: kühles Papiergrau, Tinte, Kobalt als Aktion, Signal-Gelb für „hier liegt gerade Arbeit“. */
:root {
  --paper: #edf0f2;
  --surface: #ffffff;
  --surface-2: #f6f8f9;
  --ink: #1a2633;
  --ink-2: #435163;
  --muted: #6b7887;
  --line: #d5dbe0;
  --line-soft: #e6eaed;
  --accent: #2850b8;
  --accent-ink: #1d3c8f;
  --accent-soft: #e5ecfb;
  --signal: #e19a12;
  --signal-soft: #fdf2dc;
  --ok: #2f7d4f;
  --ok-soft: #e1f2e8;
  --danger: #b83a2e;
  --danger-soft: #fbe6e3;
  --side: #1a2633;
  --side-ink: #b9c4cf;
  --side-hover: #24344a;
  --canvas: #f8fafb;
  --grid: #d9dfe4;
  --node: #ffffff;
  --node-line: #8794a1;
  --edge: #677585;
  --radius-s: 6px;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(26, 38, 51, .06), 0 2px 8px rgba(26, 38, 51, .04);
  --shadow-pop: 0 12px 40px rgba(26, 38, 51, .22);
  --font: "Source Sans 3", "Source Sans Pro", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #121a22;
    --surface: #1a242f;
    --surface-2: #202c38;
    --ink: #e4e9ee;
    --ink-2: #c0cad4;
    --muted: #8d9aa8;
    --line: #2f3d4b;
    --line-soft: #273441;
    --accent: #7c9cf0;
    --accent-ink: #a9bdf6;
    --accent-soft: #24345a;
    --signal: #f0b03a;
    --signal-soft: #3d3016;
    --ok: #6cc28e;
    --ok-soft: #1c3527;
    --danger: #ef7c70;
    --danger-soft: #42221f;
    --side: #0d141b;
    --side-ink: #9aa7b4;
    --side-hover: #1a2632;
    --canvas: #151e27;
    --grid: #26323e;
    --node: #1e2a36;
    --node-line: #7d8b99;
    --edge: #8e9cab;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-pop: 0 12px 40px rgba(0, 0, 0, .55);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font); font-size: 15px; line-height: 1.5; color: var(--ink);
  background: var(--paper); -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 1.5rem; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; font-weight: 650; }
h3 { font-size: .95rem; font-weight: 650; }
p { margin: 0 0 .6em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.strong { font-weight: 600; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.nr { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 600; }
.hidden { display: none !important; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--side); color: var(--side-ink); display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; padding: 18px 12px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 22px; color: #fff; font-weight: 700; font-size: 1.1rem; }
.brand svg { width: 28px; height: 28px; flex: none; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-group { margin: 18px 10px 6px; font-size: .8rem; color: #7f8c99; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 8px; color: var(--side-ink);
  text-decoration: none; position: relative;
}
.nav a svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.nav a:hover { background: var(--side-hover); color: #fff; }
.nav a.active { background: var(--side-hover); color: #fff; }
.nav a.active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--signal); }
.nav-badge { margin-left: auto; background: var(--signal); color: #1a2633; border-radius: 99px; font-size: .75rem; font-weight: 700; padding: 0 7px; min-width: 20px; text-align: center; }
.side-foot { border-top: 1px solid #2a3a4e; padding: 14px 6px 0; display: flex; align-items: center; gap: 10px; }
.side-foot .who { flex: 1; min-width: 0; color: #fff; font-size: .9rem; line-height: 1.2; }
.side-foot .who small { display: block; color: #7f8c99; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-foot button { background: none; border: 1px solid #34465b; color: var(--side-ink); border-radius: 6px; padding: 4px 8px; cursor: pointer; font: inherit; font-size: .8rem; }
.side-foot button:hover { color: #fff; border-color: #5a6f86; }

.main-host { min-width: 0; }
.main { padding: 28px 32px 48px; max-width: 1400px; }
.main.main-full { padding: 0; max-width: none; height: 100vh; display: flex; flex-direction: column; }
.loading { padding: 40px; color: var(--muted); }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px; gap: 6px; }
  .brand { padding: 0 8px; }
  .nav { flex-direction: row; flex-wrap: wrap; flex: 1; }
  .nav-group { display: none; }
  .nav a span.label { display: none; }
  .nav a.active::before { display: none; }
  .side-foot { border: 0; padding: 0; }
  .side-foot .who { display: none; }
  .main { padding: 18px 14px 40px; }
  .main.main-full { height: auto; min-height: calc(100vh - 60px); }
}

/* ---------- Seitenkopf, Karten, Raster ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-sub { color: var(--muted); margin: 4px 0 0; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.crumbs { color: var(--muted); font-size: .9rem; margin-bottom: 12px; }
.crumbs a { color: var(--muted); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.card-title { margin-bottom: 12px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; gap: 8px; }
.card-head .card-title { margin: 0; }
.cols { display: grid; gap: 16px; align-items: start; }
.cols-main-side { grid-template-columns: minmax(0, 1fr) 360px; }
.side-col { display: flex; flex-direction: column; gap: 16px; }
.side-col .card + .card { margin-top: 0; }
@media (max-width: 1100px) { .cols-main-side { grid-template-columns: 1fr; } }
.narrow { max-width: 820px; }
.section { margin-top: 22px; }
.section:first-child { margin-top: 0; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.section-title { margin-bottom: 10px; color: var(--ink-2); }
.section-head .section-title { margin: 0; }
.row-end { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 8px; }
.inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.prose { white-space: pre-wrap; color: var(--ink-2); }

/* Kennzahlen: eine Zeile, Zahl links, Text rechts */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; display: flex; align-items: baseline; gap: 10px; }
.stat b { font-size: 1.6rem; font-variant-numeric: tabular-nums; font-weight: 700; }
.stat span { color: var(--muted); }
.stat.s-signal { border-left: 4px solid var(--signal); }
.stat.s-danger b { color: var(--danger); }
@media (max-width: 760px) { .stats { grid-template-columns: repeat(2, 1fr); } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 600;
  font-size: .92rem; padding: 7px 14px; border-radius: var(--radius-s); border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: var(--node-line); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
@media (prefers-color-scheme: dark) { .btn-primary { color: #0e1620; } }
.btn-outline { border-color: var(--accent); color: var(--accent); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--line); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-sm { padding: 4px 10px; font-size: .85rem; }
.btn-block { width: 100%; }
.icon-btn { background: none; border: 1px solid transparent; color: var(--muted); border-radius: 6px; width: 30px; height: 30px; cursor: pointer; font-size: 15px; display: inline-flex; align-items: center; justify-content: center; }
.icon-btn:hover { background: var(--surface-2); border-color: var(--line); color: var(--ink); }
.btn.dirty { box-shadow: 0 0 0 3px var(--signal-soft); }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; font-size: .78rem; font-weight: 600; padding: 1px 8px; border-radius: 99px; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line-soft); white-space: nowrap; }
.badge-ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge-danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.badge-warn { background: var(--signal-soft); color: #93620a; border-color: transparent; }
.badge-accent { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; }
.badge-signal { background: var(--signal); color: #1a2633; border-color: transparent; }
.badge-muted { color: var(--muted); }
@media (prefers-color-scheme: dark) { .badge-warn { color: var(--signal); } }
.case-badges { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.due { font-size: .82rem; color: var(--muted); white-space: nowrap; }
.due.overdue { color: var(--danger); font-weight: 600; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: -4px 0 14px; overflow-x: auto; }
.tab { background: none; border: 0; border-bottom: 2px solid transparent; padding: 8px 12px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; }
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); border-bottom-color: var(--accent); }
.tab-count { background: var(--surface-2); border-radius: 99px; padding: 0 7px; font-size: .78rem; color: var(--ink-2); }

/* ---------- Listen ---------- */
.list { display: flex; flex-direction: column; }
.list-row { display: flex; gap: 14px; align-items: center; padding: 11px 10px; border-radius: 8px; cursor: pointer; border-bottom: 1px solid var(--line-soft); }
.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: var(--surface-2); }
.list-main { flex: 1; min-width: 0; }
.list-title { font-weight: 600; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.list-meta { color: var(--muted); font-size: .87rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-meta .sep { margin: 0 6px; color: var(--line); }
.list-side { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.assignee { display: inline-flex; align-items: center; gap: 6px; font-size: .87rem; color: var(--ink-2); white-space: nowrap; }
.avatar { width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: .7rem; font-weight: 700; color: #fff; flex: none; }
.empty { text-align: center; padding: 34px 16px; color: var(--muted); }
.empty p { margin-bottom: 12px; }

.activity { list-style: none; margin: 0; padding: 0; }
.activity li { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); font-size: .9rem; }
.activity li:last-child { border-bottom: 0; }
.act-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line); margin-top: 7px; flex: none; }
.act-dot.t-task { background: var(--accent); }
.act-dot.t-case, .act-dot.t-process { background: var(--ok); }
.act-dot.t-error { background: var(--danger); }
.act-dot.t-milestone { background: var(--signal); }
.act-body { min-width: 0; }
.act-meta { color: var(--muted); font-size: .8rem; }

/* ---------- Tabellen ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: left; font-weight: 600; color: var(--muted); font-size: .82rem; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 10px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: var(--surface-2); }
.table-compact td { padding: 6px 8px; vertical-align: middle; }
.table input[type=text] { width: 100%; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar input[type=search] { flex: 1; min-width: 220px; }

/* ---------- Formulare ---------- */
input[type=text], input[type=search], input[type=password], input[type=email], input[type=number], input[type=date], select, textarea {
  font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-s);
  padding: 7px 10px; width: 100%; min-width: 0;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input:disabled, select:disabled, textarea:disabled { background: var(--surface-2); color: var(--ink-2); }
.toolbar select { width: auto; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.form-grid > .span-2 { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }
.form-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.form-label { font-weight: 600; font-size: .88rem; color: var(--ink-2); }
.form-label .req { color: var(--danger); margin-left: 3px; }
.form-help { font-size: .82rem; color: var(--muted); }
.form-error { font-size: .82rem; color: var(--danger); min-height: 0; }
.form-field.invalid input, .form-field.invalid select, .form-field.invalid textarea { border-color: var(--danger); }
.form-heading { font-size: 1rem; padding-top: 8px; border-top: 1px solid var(--line-soft); margin-top: 6px; }
.form-grid > .form-heading:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.form-info { background: var(--accent-soft); color: var(--accent-ink); border-radius: var(--radius-s); padding: 10px 12px; font-size: .9rem; white-space: pre-wrap; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; flex-wrap: wrap; }
.radio-group { display: flex; flex-direction: column; gap: 4px; }
.radio { display: flex; gap: 8px; align-items: center; cursor: pointer; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; padding: 4px 0; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track { width: 38px; height: 22px; border-radius: 99px; background: var(--line); position: relative; transition: background .15s; flex: none; }
.switch-track::after { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track::after { transform: translateX(16px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch input:disabled + .switch-track { opacity: .6; }
.file-field { display: flex; flex-direction: column; gap: 6px; }
.file-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.file-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); font-size: .85rem; color: var(--ink); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-chip:hover { border-color: var(--accent); text-decoration: none; }
.dropzone { display: flex; flex-direction: column; align-items: center; gap: 4px; border: 2px dashed var(--line); border-radius: var(--radius); padding: 22px; text-align: center; cursor: pointer; margin-bottom: 14px; transition: border-color .12s, background .12s; }
.dropzone:hover, .dropzone:focus-visible { border-color: var(--accent); }
.dropzone.over { border-color: var(--accent); border-style: solid; background: var(--accent-soft); }
.dropzone input { display: none; }
.dz-icon { font-size: 1.4rem; color: var(--accent); line-height: 1; }
.dz-limit { font-size: .78rem; color: var(--muted); }
.dropzone-compact { flex-direction: row; justify-content: flex-start; gap: 10px; padding: 10px 14px; margin: 0; text-align: left; flex-wrap: wrap; }
.dropzone-compact .dz-icon { font-size: 1.1rem; }
.dropzone-compact .dz-limit { margin-left: auto; }
.file-chip-new { background: var(--accent-soft); border-color: transparent; padding-right: 4px; }
.file-chip-new .chip-x { color: var(--ink-2); }
.add-field { display: grid; grid-template-columns: 1fr 2fr auto; gap: 8px; margin-top: 10px; }

/* ---------- Callouts ---------- */
.callout { border-radius: var(--radius-s); padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--line); margin: 14px 0; }
.callout-danger { background: var(--danger-soft); border-color: transparent; }
.callout-ok { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.callout-signal { background: var(--signal-soft); border-color: transparent; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.token-row { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line-soft); flex-wrap: wrap; }
.token-row select { width: auto; max-width: 260px; }
.error-text { color: var(--danger); font-size: .87rem; }

/* ---------- Fall- und Aufgabenkopf ---------- */
.case-head { display: grid; grid-template-columns: 1fr auto; gap: 8px 24px; margin-bottom: 16px; }
.case-kicker { color: var(--muted); font-size: .88rem; display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 4px; }
.case-head-meta { grid-column: 1 / -1; display: flex; gap: 28px; flex-wrap: wrap; font-size: .88rem; padding-top: 12px; border-top: 1px solid var(--line-soft); margin-top: 6px; }
.meta-item span { color: var(--muted); margin-right: 6px; }
.case-head .page-actions { align-self: start; }
@media (max-width: 760px) { .case-head { grid-template-columns: 1fr; } }
.task-desc { background: var(--surface-2); border-radius: var(--radius-s); padding: 12px 14px; margin-top: 14px; }
.task-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line-soft); }
.kv { display: grid; grid-template-columns: minmax(110px, 40%) 1fr; gap: 6px 12px; margin: 0; font-size: .9rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* ---------- Kommentare / Verlauf ---------- */
.comments { display: flex; flex-direction: column; gap: 12px; max-height: 420px; overflow-y: auto; margin-bottom: 10px; }
.comment { display: flex; gap: 10px; }
.comment-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; font-size: .88rem; }
.comment-text { white-space: pre-wrap; font-size: .92rem; overflow-wrap: anywhere; }
.comment-form textarea { margin-bottom: 0; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 18px; border-left: 2px solid var(--line-soft); }
.timeline li { position: relative; padding: 0 0 14px 10px; font-size: .92rem; }
.timeline li::before { content: ""; position: absolute; left: -24px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--node-line); }
.timeline li.t-task::before { border-color: var(--accent); }
.timeline li.t-error::before { border-color: var(--danger); background: var(--danger); }
.timeline li.t-milestone::before { border-color: var(--signal); background: var(--signal); }
.timeline li.t-case::before, .timeline li.t-process::before { border-color: var(--ok); }
.timeline li.t-flow { color: var(--muted); font-size: .85rem; }
.timeline .when { color: var(--muted); font-size: .8rem; }

/* ---------- Auswahl (Neuer Fall) ---------- */
.choice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.choice { text-align: left; font: inherit; color: inherit; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; cursor: pointer; display: flex; flex-direction: column; gap: 6px; }
.choice:hover { border-color: var(--accent); }
.choice-title { font-weight: 650; font-size: 1.05rem; }
.choice-desc { color: var(--muted); font-size: .9rem; flex: 1; }
.choice-meta { font-size: .82rem; color: var(--ink-2); }
.choice-icon svg { width: 26px; height: 26px; color: var(--accent); }
.choice-adhoc { border-style: dashed; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.card-grid .card + .card { margin-top: 0; }
.proc-card { display: flex; flex-direction: column; gap: 6px; }
.proc-card.archived { opacity: .65; }
.proc-card-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.proc-stats { display: flex; gap: 16px; font-size: .85rem; color: var(--ink-2); }
.proc-card .row-end { margin-top: auto; padding-top: 10px; }

/* ---------- Modal & Toast ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(13, 20, 27, .45); display: flex; align-items: flex-start; justify-content: center; padding: 8vh 16px 16px; z-index: 50; overflow-y: auto; }
.modal { background: var(--surface); border-radius: 12px; box-shadow: var(--shadow-pop); width: 100%; max-width: 520px; animation: pop .14s ease-out; }
.modal-wide { max-width: 760px; }
@keyframes pop { from { transform: translateY(6px); opacity: 0; } }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px 8px; }
.modal-body { padding: 8px 20px 16px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 16px; border-top: 1px solid var(--line-soft); }
.check-list { display: flex; flex-direction: column; gap: 4px; max-height: 220px; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius-s); padding: 8px 10px; }
.check-list label { display: flex; gap: 8px; align-items: center; cursor: pointer; }
#toast-host { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: var(--ink); color: var(--surface); padding: 10px 16px; border-radius: 8px; box-shadow: var(--shadow-pop); max-width: 380px; border-left: 4px solid var(--ok); transition: opacity .25s, transform .25s; }
.toast-error { border-left-color: var(--danger); }
.toast-warn { border-left-color: var(--signal); }
.toast.out { opacity: 0; transform: translateY(6px); }

/* ---------- Login ---------- */
.login-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: var(--side); }
.login-card { background: var(--surface); border-radius: 14px; padding: 32px; width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 12px; box-shadow: var(--shadow-pop); }
.login-card .brand { color: var(--ink); padding: 0 0 8px; }
.login-error { color: var(--danger); font-size: .9rem; min-height: 1.2em; }
.login-hint { font-size: .82rem; color: var(--muted); text-align: center; }

/* ---------- Diagramm ---------- */
.diagram { width: 100%; height: 100%; display: block; background: var(--canvas); cursor: grab; outline: none; user-select: none; touch-action: none; }
.diagram:active { cursor: grabbing; }
.diagram .grid-dot { fill: var(--grid); }
.diagram-box { height: 360px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.diagram-box.small { height: 240px; }
.node { cursor: pointer; }
.node .shape { fill: var(--node); stroke: var(--node-line); stroke-width: 1.5; }
.n-start .shape { stroke: var(--ok); stroke-width: 2; }
.n-end .shape { stroke: var(--ink); stroke-width: 4; }
.n-end .end-fill { fill: var(--ink); }
.n-exclusiveGateway .shape, .n-parallelGateway .shape { stroke: var(--ink-2); }
.n-milestone .shape { stroke: var(--signal); stroke-width: 2; }
.node .glyph { stroke: var(--ink-2); stroke-width: 3; stroke-linecap: round; fill: none; }
.node .task-icon { stroke: var(--muted); stroke-width: 1.5; fill: none; }
.node .label { font-size: 12.5px; fill: var(--ink); font-family: var(--font); font-weight: 600; pointer-events: none; }
.node .sub { font-size: 10.5px; fill: var(--muted); font-family: var(--font); pointer-events: none; }
.node .outer-label { font-weight: 500; fill: var(--ink-2); }
.node.selected .shape { stroke: var(--accent); stroke-width: 2.5; }
.node.st-done .shape { fill: var(--ok-soft); }
.node.st-active .shape { stroke: var(--signal); stroke-width: 3; fill: var(--signal-soft); }
.node.st-error .shape { stroke: var(--danger); stroke-width: 3; fill: var(--danger-soft); }
.node .pulse { fill: none; stroke: var(--signal); stroke-width: 2; opacity: .7; animation: pulse 1.8s ease-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes pulse { from { transform: scale(1); opacity: .7; } to { transform: scale(1.18); opacity: 0; } }
.node .handle { fill: var(--accent); stroke: var(--surface); stroke-width: 2; opacity: 0; cursor: crosshair; transition: opacity .12s; }
.node:hover .handle, .node.selected .handle { opacity: 1; }
.node.drop-target .shape { stroke: var(--accent); stroke-width: 3; }
.edge-line { fill: none; stroke: var(--edge); stroke-width: 1.5; }
.edge-hit { fill: none; stroke: transparent; stroke-width: 14; cursor: pointer; }
.edge.selected .edge-line { stroke: var(--accent); stroke-width: 2.5; }
.edge .default-mark { stroke: var(--edge); stroke-width: 1.5; }
.edge-label-bg { fill: var(--canvas); }
.edge-label { font-size: 11px; fill: var(--ink-2); font-family: var(--font); pointer-events: none; }
.arrowhead { fill: var(--edge); }
.arrowhead-sel { fill: var(--accent); }
.temp-edge { stroke: var(--accent); stroke-width: 2; stroke-dasharray: 5 4; fill: none; pointer-events: none; }
.diagram.ro .node { cursor: default; }
.legend { display: flex; gap: 14px; font-size: .82rem; color: var(--muted); flex-wrap: wrap; }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; border: 2px solid var(--node-line); }
.legend .l-active::before { border-color: var(--signal); background: var(--signal-soft); }
.legend .l-done::before { border-color: var(--node-line); background: var(--ok-soft); }
.legend .l-error::before { border-color: var(--danger); background: var(--danger-soft); }

/* ---------- Editoren (Prozess & Formular) ---------- */
.editor { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.editor-toolbar { display: flex; align-items: center; gap: 8px; padding: 10px 14px; background: var(--surface); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.editor-toolbar .spacer { flex: 1; }
.title-input { font-size: 1.1rem !important; font-weight: 650; border-color: transparent !important; max-width: 360px; background: transparent !important; }
.title-input:hover { border-color: var(--line) !important; }
.title-input:focus { border-color: var(--accent) !important; background: var(--surface) !important; }
.save-status { font-size: .85rem; color: var(--muted); }
.save-status.dirty { color: #93620a; font-weight: 600; }
@media (prefers-color-scheme: dark) { .save-status.dirty { color: var(--signal); } }
.editor-body { flex: 1; display: grid; grid-template-columns: 190px minmax(0, 1fr) 320px; min-height: 0; }
.editor-palette, .editor-props { background: var(--surface); overflow-y: auto; padding: 14px; }
.editor-palette { border-right: 1px solid var(--line); }
.editor-props { border-left: 1px solid var(--line); }
.editor-center { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.editor-canvas { flex: 1; min-height: 300px; position: relative; }
.editor-issues { max-height: 150px; overflow-y: auto; border-top: 1px solid var(--line); background: var(--surface); font-size: .87rem; }
.editor-issues:empty { display: none; }
.issue { display: flex; gap: 8px; padding: 6px 14px; border-bottom: 1px solid var(--line-soft); cursor: pointer; align-items: baseline; }
.issue:hover { background: var(--surface-2); }
.issue-ok { color: var(--ok); cursor: default; }
.palette-title, .props-title { font-weight: 650; margin-bottom: 10px; }
.palette-item { display: flex; align-items: center; gap: 10px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 6px; cursor: grab; background: var(--surface); font-size: .9rem; user-select: none; }
.palette-item:hover { border-color: var(--accent); }
.palette-item svg { width: 30px; height: 22px; flex: none; }
.palette-item svg .p-shape { fill: var(--node); stroke: var(--node-line); stroke-width: 1.5; }
.palette-help { font-size: .8rem; color: var(--muted); margin-top: 14px; line-height: 1.45; }
.pfield { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.pfield > span { font-size: .84rem; font-weight: 600; color: var(--ink-2); }
.pfield small { color: var(--muted); font-size: .8rem; }
.pcheck { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; font-size: .9rem; cursor: pointer; }
.props-hint { font-size: .85rem; color: var(--muted); background: var(--surface-2); border-radius: var(--radius-s); padding: 10px; margin: 8px 0 12px; }
.props-id { font-size: .8rem; color: var(--muted); margin: -6px 0 12px; }
.cond-grid { display: grid; grid-template-columns: 1fr; gap: 6px; }
.link-list { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.link-list button { text-align: left; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; font: inherit; font-size: .87rem; cursor: pointer; color: var(--ink); }
.link-list button:hover { border-color: var(--accent); }
@media (max-width: 1000px) {
  .editor-body { grid-template-columns: 1fr; grid-template-rows: auto minmax(420px, 1fr) auto; }
  .editor-palette { border-right: 0; border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 6px; }
  .editor-palette .palette-title, .editor-palette .palette-help { display: none; }
  .palette-item { margin: 0; }
  .editor-props { border-left: 0; border-top: 1px solid var(--line); }
}

/* Formular-Designer */
.fd { display: grid; grid-template-columns: 230px minmax(0, 1fr) 320px; flex: 1; min-height: 0; }
.fd-center { overflow-y: auto; padding: 18px 22px; background: var(--paper); }
.fd-paper { max-width: 760px; margin: 0 auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; min-height: 300px; }
.fd-canvas { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; min-height: 200px; }
.fd-card { overflow: hidden; grid-column: 1 / -1; border: 1px dashed transparent; border-radius: 8px; padding: 8px 10px 10px; cursor: pointer; position: relative; background: var(--surface); }
.fd-card.half { grid-column: auto; }
.fd-card:hover { border-color: var(--line); }
.fd-card.selected { border: 1px solid var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.fd-card.drop-before { box-shadow: inset 0 3px 0 var(--accent); }
.fd-card.dragging { opacity: .4; }
.fd-card-head { display: flex; gap: 8px; align-items: center; font-size: .78rem; color: var(--muted); margin-bottom: 4px; }
.fd-card-head .fd-key { font-variant-numeric: tabular-nums; }
.fd-card-actions { margin-left: auto; display: flex; gap: 2px; opacity: 0; }
.fd-card:hover .fd-card-actions, .fd-card.selected .fd-card-actions { opacity: 1; }
.fd-card-actions .icon-btn { width: 24px; height: 24px; font-size: 12px; }
.fd-preview { pointer-events: none; }
.fd-preview .form-grid { grid-template-columns: 1fr; }
.fd-canvas.drop-end::after { content: ""; grid-column: 1 / -1; height: 3px; background: var(--accent); border-radius: 2px; }
.empty-drop { grid-column: 1 / -1; border: 2px dashed var(--line); border-radius: var(--radius); padding: 40px 20px; text-align: center; color: var(--muted); }
.fd-mode { display: flex; gap: 4px; justify-content: center; margin-bottom: 14px; }
@media (max-width: 1000px) { .fd { grid-template-columns: 1fr; } }

/* ---------- Variablen & Zustände ---------- */
.seg { display: flex; gap: 2px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 3px; margin-bottom: 14px; }
.seg button { flex: 1; font: inherit; font-size: .88rem; font-weight: 600; border: 0; background: transparent; color: var(--muted); padding: 5px 8px; border-radius: 6px; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; justify-content: center; }
.seg button.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.states-editor { display: flex; flex-direction: column; gap: 8px; }
.state-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.state-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px 2px 10px; border-radius: 99px; background: var(--accent-soft); color: var(--accent-ink); font-size: .85rem; font-weight: 600; cursor: grab; user-select: none; }
.state-chip.readonly { padding-right: 10px; cursor: default; font-weight: 500; }
.chip-x { border: 0; background: transparent; color: inherit; width: 20px; height: 20px; border-radius: 50%; cursor: pointer; font-size: 14px; line-height: 1; opacity: .7; }
.chip-x:hover { opacity: 1; background: rgba(0, 0, 0, .08); }
.state-add { display: flex; gap: 6px; }
.state-add input { flex: 1; }
.var-list { display: flex; flex-direction: column; gap: 8px; }
.var-card { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; background: var(--surface); }
.var-card.system { background: var(--surface-2); }
.var-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.var-key { font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; margin-top: -4px; }
.var-meta { font-size: .8rem; color: var(--muted); }
.var-actions { display: flex; gap: 4px; justify-content: flex-end; }
.cond-box { border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin: 6px 0 12px; background: var(--surface-2); }
.cond-title { font-weight: 650; margin-bottom: 10px; }
.cond-box .pfield:last-of-type { margin-bottom: 8px; }
.cond-preview { font-size: .85rem; color: var(--ink-2); border-top: 1px solid var(--line); padding-top: 8px; }
.with-inserter { display: flex; flex-direction: column; gap: 4px; }
.insert-var { font-size: .82rem !important; padding: 3px 8px !important; color: var(--muted) !important; width: auto !important; max-width: 100%; align-self: flex-start; }

/* ---------- Mehrfachauswahl, Bilder, Lookup ---------- */
.check-group { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.thumb { position: relative; width: 84px; height: 84px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); display: block; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-new { outline: 2px solid var(--accent-soft); }
.thumb .chip-x { position: absolute; top: 3px; right: 3px; background: rgba(13, 20, 27, .65); color: #fff; opacity: 1; }
.lookup-field { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.lookup-field select { flex: 1; min-width: 160px; }
.lookup-editor { display: flex; flex-direction: column; gap: 2px; border: 1px solid var(--line); border-radius: 8px; padding: 10px; background: var(--surface-2); }
.lookup-test-out { margin-top: 4px; min-height: 1em; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.check-list.compact { max-height: 140px; padding: 6px 8px; font-size: .88rem; }

/* ---------- Formulardesigner im Prozesskontext ---------- */
.palette-item .pi-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-item .pi-used { color: var(--ok); font-weight: 700; }
.palette-item.used { opacity: .7; }
.fd-card.outside { border: 1px dashed var(--danger); }
.var-info { display: flex; flex-direction: column; gap: 6px; padding: 10px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); margin-bottom: 12px; font-size: .88rem; }
.var-info .btn { align-self: flex-start; }
.var-card.derived { border-style: dashed; }
.var-group { font-size: .8rem; font-weight: 650; color: var(--muted); margin: 10px 0 2px; }
.chip-lock { color: var(--muted); padding: 0 6px; }

/* ---------- Teams ---------- */
.clickable-card { cursor: pointer; }
.clickable-card:hover { border-color: var(--accent); }
.team-card { display: flex; flex-direction: column; gap: 8px; }
.avatar-row { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.avatar-wrap { border-radius: 50%; padding: 2px; display: inline-flex; }
.avatar-wrap.lead { box-shadow: 0 0 0 2px var(--signal); }
.avatar-wrap .avatar { width: 30px; height: 30px; font-size: .75rem; }
.card-head select { width: auto; max-width: 240px; }

/* ---------- Auswertung ---------- */
.results td { white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.json-view { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 12px; font-size: .8rem; max-height: 360px; overflow: auto; white-space: pre-wrap; }
.plain-list { margin: 0; padding-left: 18px; font-size: .9rem; }

/* ---------- Geldbetrag, Tabellen-Felder ---------- */
.money-field { display: flex; align-items: stretch; }
.money-field input { border-top-right-radius: 0; border-bottom-right-radius: 0; text-align: right; }
.money-cur { display: inline-flex; align-items: center; padding: 0 10px; border: 1px solid var(--line); border-left: 0; border-radius: 0 var(--radius-s) var(--radius-s) 0; background: var(--surface-2); color: var(--ink-2); font-size: .85rem; font-weight: 600; }
.grid-field { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.grid-field .table-wrap { width: 100%; }
.grid-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.grid-table th { text-align: left; font-size: .8rem; font-weight: 600; color: var(--muted); padding: 4px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.grid-table td { padding: 3px 4px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.grid-table td input[type=text], .grid-table td input[type=number], .grid-table td input[type=date], .grid-table td select { padding: 5px 7px; min-width: 70px; }
.grid-table td input[type=number] { text-align: right; }
.grid-table .num { text-align: right; }
.grid-table td.computed { color: var(--ink-2); font-variant-numeric: tabular-nums; padding-right: 10px; background: var(--surface-2); }
.grid-table tfoot td { font-weight: 700; border-top: 2px solid var(--line); border-bottom: 0; padding: 6px; font-variant-numeric: tabular-nums; }
.grid-table.readonly td { padding: 5px 6px; }
.col-editor input, .col-editor select { min-width: 80px; }

/* ---------- Bedingungs-Baukasten ---------- */
.cond-group { border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 8px; padding: 8px; margin: 4px 0; background: var(--surface); display: flex; flex-direction: column; gap: 4px; }
.cond-group.depth-1 { border-left-color: var(--signal); background: var(--surface-2); }
.cond-group.depth-2 { border-left-color: var(--ok); }
.cond-group-head { display: flex; gap: 6px; align-items: center; }
.cond-group-head select { width: auto; flex: 1; font-size: .85rem; padding: 4px 6px; }
.cond-paren { font-weight: 700; color: var(--muted); font-size: 1.1rem; }
.cond-paren-close { align-self: flex-start; }
.inline-check { margin: 0; font-size: .85rem; }
.cond-leaf { display: flex; gap: 4px; align-items: flex-start; padding: 6px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line-soft); }
.cond-group.depth-1 .cond-leaf { background: var(--surface); }
.cond-leaf-fields { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.cond-leaf-fields select, .cond-leaf-fields input { font-size: .85rem; padding: 5px 7px; }
.cond-expr { flex-direction: column; align-items: stretch; }
.cond-leaf-head { display: flex; justify-content: space-between; align-items: center; }
.cond-join { font-size: .75rem; font-weight: 700; text-transform: uppercase; color: var(--accent-ink); padding-left: 8px; letter-spacing: .04em; }
.cond-add { display: flex; flex-wrap: wrap; gap: 2px; }
.cond-add .btn { font-size: .8rem; padding: 3px 8px; }
.ok-text { color: var(--ok); }

/* ---------- Berechnung ---------- */
.step-card { border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin-bottom: 10px; background: var(--surface-2); }
.step-head { display: flex; align-items: center; gap: 4px; margin-bottom: 8px; }
.step-head .spacer { flex: 1; }
.step-card textarea { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85rem; }
.map-list { display: flex; flex-direction: column; gap: 4px; margin-bottom: 4px; }
.map-row { display: grid; grid-template-columns: 1fr auto 1fr auto; gap: 4px; align-items: center; }
.map-row input, .map-row select { font-size: .85rem; padding: 5px 7px; }
.node .node-glyph { font-size: 12px; font-style: italic; font-weight: 700; fill: var(--muted); pointer-events: none; }
.n-compute .shape { stroke: var(--accent); stroke-dasharray: 0; }
.n-decisionTable .shape { stroke: var(--ink-2); }

/* ---------- Entscheidungstabelle ---------- */
.modal-wide:has(.dt-wrap) { max-width: 1200px; }
.dt-table th, .dt-table td { padding: 6px; vertical-align: top; }
.dt-table select, .dt-table input { font-size: .85rem; padding: 5px 7px; min-width: 110px; }
.dt-table th.dt-in, .dt-table td.dt-in { background: var(--accent-soft); }
.dt-table th.dt-out, .dt-table td.dt-out { background: var(--signal-soft); }
.dt-table th { white-space: nowrap; }
.dt-table th.dt-in, .dt-table th.dt-out { min-width: 170px; }
.dt-table th .icon-btn { margin-left: 2px; }
.dt-cell { display: flex; flex-direction: column; gap: 4px; }
.dt-num { width: 28px; color: var(--muted); font-variant-numeric: tabular-nums; }
.dt-sep { width: 8px; padding: 0 !important; background: var(--line-soft); }
.nowrap { white-space: nowrap; }
.palette-item span { hyphens: auto; overflow-wrap: anywhere; }
.dt-table th.dt-in select, .dt-table th.dt-out select { width: calc(100% - 34px); display: inline-block; vertical-align: middle; }
.dt-table th.dt-add { background: var(--line-soft); white-space: nowrap; }

/* ---------- Inbox-Aktualisierung ---------- */
.refresh-stamp { font-size: .8rem; color: var(--muted); }
.list-row.is-new { animation: flash-new 2.4s ease-out; }
@keyframes flash-new { 0% { background: var(--signal-soft); box-shadow: inset 3px 0 0 var(--signal); } 100% { background: transparent; box-shadow: inset 3px 0 0 transparent; } }

/* ---------- JSON / Antwort-Explorer ---------- */
textarea.mono, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85rem; }
.jx-box { border: 1px solid var(--line); border-radius: 8px; background: var(--surface); margin-top: 8px; }
.jx-head { display: flex; gap: 8px; align-items: center; padding: 6px 8px; border-bottom: 1px solid var(--line-soft); }
.jx-head .muted { flex: 1; }
.jx { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .8rem; padding: 6px 8px; max-height: 320px; overflow: auto; }
.jx details > summary { cursor: pointer; list-style: none; display: flex; gap: 6px; align-items: center; padding: 2px 0; }
.jx details > summary::-webkit-details-marker { display: none; }
.jx details > summary::before { content: "▸"; color: var(--muted); width: 10px; }
.jx details[open] > summary::before { content: "▾"; }
.jx-children { padding-left: 14px; border-left: 1px dashed var(--line); margin-left: 4px; }
.jx-leaf { display: flex; gap: 6px; align-items: center; padding: 2px 0 2px 10px; }
.jx-key { color: var(--accent-ink); font-weight: 600; }
.jx-meta { color: var(--muted); }
.jx-val { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.jx-string { color: var(--ok); }
.jx-number { color: #b45309; }
.jx-boolean, .jx-null { color: #8a4fb3; }
.jx-pick { font: inherit; font-family: var(--font); font-size: .72rem; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-2); border-radius: 99px; padding: 0 8px; cursor: pointer; opacity: 0; }
.jx-leaf:hover .jx-pick, .jx summary:hover .jx-pick, .jx-pick:focus { opacity: 1; }
.jx-pick:hover { border-color: var(--accent); color: var(--accent); }
.map-item { display: flex; flex-direction: column; gap: 2px; }
.map-preview { padding-left: 4px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.editor-body.wide-props { grid-template-columns: 190px minmax(0, 1fr) 480px; }
@media (max-width: 1000px) { .editor-body.wide-props { grid-template-columns: 1fr; } }
.jx summary > span, .jx-leaf > span { white-space: nowrap; }
.jx-meta { font-size: .72rem; }

/* ---------- Sofortsuche ---------- */
.filter-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; position: relative; }
.filter-icon { position: absolute; left: 11px; color: var(--muted); pointer-events: none; font-size: 1rem; }
.filter-bar .filter-input { padding-left: 30px; max-width: 460px; }
.filter-count { font-size: .82rem; color: var(--muted); white-space: nowrap; }

/* ---------- Sicherheit ---------- */
.role-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 16px; }
.lock-mark { font-size: .8rem; }
.audit-wrap { max-height: 420px; overflow-y: auto; }
.audit-warn td { background: var(--danger-soft); }

/* ---------- Audit-Trail ---------- */
.trail-cols { grid-template-columns: 290px minmax(0, 1fr); }
@media (max-width: 1100px) { .trail-cols { grid-template-columns: 1fr; } }
.trail-side { position: sticky; top: 16px; max-height: calc(100vh - 140px); overflow-y: auto; }
.trail-filters { flex-direction: column; }
.trail-filters select, .trail-filters input { width: 100%; }
.trail-case { text-decoration: none; color: inherit; }
.trail-case:hover { text-decoration: none; }
.trail-case.active { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.trail-facts { display: flex; gap: 24px; flex-wrap: wrap; font-size: .88rem; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.trail-detail { margin-top: 16px; }
.chip-filter { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.chip { font: inherit; font-size: .85rem; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); border-radius: 99px; padding: 3px 12px; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.chip:hover { border-color: var(--accent); }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip-n { font-size: .75rem; opacity: .8; font-variant-numeric: tabular-nums; }
.trail { display: flex; flex-direction: column; }
.trail-day { font-size: .8rem; font-weight: 700; color: var(--muted); margin: 14px 0 4px; padding-bottom: 4px; border-bottom: 1px solid var(--line-soft); }
.trail-day:first-child { margin-top: 0; }
.trail-item { border-radius: 8px; }
.trail-item > summary, .trail-row { display: flex; gap: 10px; align-items: center; padding: 7px 8px; font-size: .9rem; flex-wrap: wrap; }
.trail-item > summary { cursor: pointer; list-style: none; }
.trail-item > summary::-webkit-details-marker { display: none; }
.trail-item.expandable > summary::after { content: "▸"; color: var(--muted); margin-left: auto; }
.trail-item.expandable[open] > summary::after { content: "▾"; }
.trail-item.expandable:hover, .trail-item[open] { background: var(--surface-2); }
.trail-item[open] { border: 1px solid var(--line); margin: 4px 0; }
.trail-time { font-variant-numeric: tabular-nums; color: var(--muted); font-size: .82rem; width: 40px; flex: none; }
.trail-icon { width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: .75rem; font-weight: 700; flex: none; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }
.ti-task { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; }
.ti-data { background: var(--signal-soft); color: #93620a; border-color: transparent; }
.ti-case, .ti-process { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.ti-error { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.ti-compute { font-style: italic; }
.trail-msg { flex: 1; min-width: 180px; }
.trail-who { font-size: .85rem; color: var(--ink-2); }
.trail-preview { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trail-flow .trail-row { color: var(--muted); font-size: .84rem; padding-top: 3px; padding-bottom: 3px; }
.trail-error { background: var(--danger-soft); }
.trail-comment { padding: 4px 12px 12px 82px; }
.change-table { margin: 0 8px 10px; width: calc(100% - 16px); }
.change-table td { vertical-align: top; }
.change-table td.old { color: var(--muted); text-decoration: line-through; text-decoration-color: rgba(184, 58, 46, .45); }
.change-table td.old .grid-table, .change-table td.old .file-chips { text-decoration: none; opacity: .7; }
.change-table td.new { color: var(--ink); }
.path { list-style: none; margin: 0; padding: 0; position: relative; }
.path-step { display: flex; gap: 10px; padding: 0 0 12px; position: relative; }
.path-step:not(:last-child)::before { content: ""; position: absolute; left: 11px; top: 24px; bottom: 0; width: 2px; background: var(--line); }
.path-icon { width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: .72rem; flex: none; background: var(--surface-2); border: 2px solid var(--line); color: var(--ink-2); z-index: 1; }
.ps-userTask .path-icon { border-color: var(--accent); color: var(--accent); }
.ps-start .path-icon { border-color: var(--ok); color: var(--ok); }
.ps-end .path-icon { border-color: var(--ink); color: var(--ink); }
.ps-milestone .path-icon { border-color: var(--signal); color: #93620a; }
.ps-open .path-icon { background: var(--signal-soft); border-color: var(--signal); }
.path-title { font-weight: 600; font-size: .9rem; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.path-meta { font-size: .8rem; color: var(--muted); }
.path-meta .sep, .list-meta .sep { margin: 0 5px; color: var(--line); }
.people { display: flex; flex-direction: column; gap: 10px; }
.person { display: flex; gap: 10px; align-items: center; }

/* ---------- Statistik ---------- */
.stat-filters { margin-bottom: 16px; padding: 14px 20px; }
.stats-6 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.stat-two { grid-template-columns: 1fr 1fr; margin-bottom: 16px; }
.stat-two .card + .card { margin-top: 0; }
@media (max-width: 1000px) { .stat-two { grid-template-columns: 1fr; } }
.barlist { display: flex; flex-direction: column; gap: 6px; }
.bar-row { display: grid; grid-template-columns: minmax(110px, 38%) 1fr auto; gap: 10px; align-items: center; font-size: .88rem; }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 12px; background: var(--surface-2); border-radius: 99px; overflow: hidden; border: 1px solid var(--line-soft); }
.bar-fill { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.bars-b .bar-fill { background: var(--ok); }
.bars-c .bar-fill { background: var(--signal); }
.bar-value { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; }
.bar-value .muted { font-weight: 400; }
.chart-scroll { overflow-x: auto; }
.colchart { width: 100%; min-width: 320px; height: 190px; display: block; }
.colchart .grid { stroke: var(--line-soft); }
.colchart .axis { font-size: 10px; fill: var(--muted); font-family: var(--font); }
.colchart .c-a { fill: var(--accent); }
.colchart .c-b { fill: var(--ok); }
.legend .lg-c-a::before { border-color: var(--accent); background: var(--accent); }
.legend .lg-c-b::before { border-color: var(--ok); background: var(--ok); }
tr.bottleneck td { background: var(--signal-soft); }
.danger-text { color: var(--danger); font-weight: 600; }
.var-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.var-stat { border: 1px solid var(--line); border-radius: 8px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.trail-detail { grid-template-columns: minmax(0, 1fr) 300px; }
@media (max-width: 1250px) { .trail-detail { grid-template-columns: 1fr; } }
.trail-item > summary, .trail-row { flex-wrap: nowrap; align-items: flex-start; }
.trail-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.trail-msg { min-width: 0; }
.trail-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: .82rem; color: var(--ink-2); }
.trail-time, .trail-icon { margin-top: 1px; }
.trail-item.expandable > summary::after { margin-top: 3px; }
.trail-flow .trail-meta { display: none; }
.trail-comment { padding: 0 12px 12px 82px; }
.stats-6 .stat { flex-direction: column; align-items: flex-start; gap: 2px; }
.stats-6 .stat b { font-size: 1.35rem; white-space: nowrap; }

/* ---------- Prozessfehler ---------- */
.error-card { border-color: var(--danger); border-left: 4px solid var(--danger); margin-bottom: 16px; }
.error-card .card-title { color: var(--danger); }
.error-row { text-decoration: none; color: inherit; }
.error-row:hover { text-decoration: none; }
.nav-badge-danger { background: var(--danger); color: #fff; }
.palette-item svg circle[fill=none] { color: var(--ink-2); }
