/* ═══════════════════════════════════════════════════════════════
   STRUCTON Suite — Hauptstylesheet
   Swiss International: eckige Container, runde Mono-Badges,
   farblich differenzierte Sidebar-Bereiche
   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;700&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');
@import url('./tokens.css');

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  font-family: var(--f-body);
  font-size: 14px;
  line-height: 1.5;
  color: var(--c-ink);
  background: var(--c-soft);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--c-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

button { font-family: var(--f-body); cursor: pointer; }

/* ── App-Layout ─────────────────────────────────────────────── */

.app { display: none; min-height: 100vh; }
.app.is-active { display: grid; grid-template-columns: var(--sidebar-width) 1fr; grid-template-rows: var(--topbar-height) 1fr; }

/* Sidebar bleibt statisch, Inhalt scrollt unabhängig.
   Höhe = Viewport - Topbar, eigene Scrollbar. Position sticky damit
   sie beim Seitenscroll oben fest sitzt. */
.sidebar {
  position: sticky;
  top: var(--topbar-height);
  height: calc(100vh - var(--topbar-height));
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--c-line) transparent;
  padding-right: env(safe-area-inset-right);
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb {
  background: var(--c-line);
  border-radius: 3px;
}
.sidebar::-webkit-scrollbar-thumb:hover { background: var(--c-mid-soft); }


/* ── Topbar ─────────────────────────────────────────────────── */

.topbar {
  grid-column: 1 / -1;
  background: #0b1220;
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0) 50%),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 0%, rgba(255, 255, 255, 0) 100%);
  color: #f8fafc;
  height: var(--topbar-height);
  display: grid;
  grid-template-columns: minmax(180px, auto) minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--s-5);
  padding-block: 0;
  padding-left: max(var(--s-5), env(safe-area-inset-left));
  padding-right: max(var(--s-5), env(safe-area-inset-right));
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.4), 0 6px 16px -8px rgba(0, 0, 0, 0.3);
}

.topbar .brand { display: flex; align-items: center; gap: var(--s-3); }
.topbar .brand img { height: 26px; width: auto; }
.topbar .brand .name {
  font-family: var(--f-display);
  font-weight: 800;
  font-size: 16px;
  letter-spacing: -0.02em;
  color: #f8fafc;
}
.topbar .brand .sub {
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: rgba(248, 250, 252, 0.55);
  margin-left: var(--s-2);
}

.topbar .topbar-right { display: flex; align-items: center; gap: var(--s-3); justify-self: end; }
.topbar .user {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--c-mid-soft);
}
.topbar .user strong { color: var(--c-surface); margin-left: var(--s-2); }
.topbar .role-badge {
  display: inline-block;
  font-family: var(--f-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 2px 8px;
  background: var(--c-accent);
  color: var(--c-surface);
  border-radius: var(--radius-pill);
  margin-left: var(--s-2);
}
.topbar .role-badge.external { background: var(--c-tools); }
.topbar .role-badge.agent { background: var(--c-kunden); }
.topbar .logout-btn {
  background: transparent;
  border: 1px solid var(--c-mid);
  color: var(--c-surface);
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 6px 12px;
  border-radius: 0;
}
.topbar .logout-btn:hover { background: var(--c-mid); }

/* ── Sidebar ────────────────────────────────────────────────── */

.sidebar {
  background: var(--c-surface);
  border-right: 1px solid var(--c-line);
  padding: var(--s-4) 0;
}

.sidebar .nav-section { margin-bottom: var(--s-6); }
.sidebar .nav-section-title {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-2) var(--s-5);
  font-family: var(--f-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--c-mid);
}
.sidebar .nav-section-title .dot {
  width: 8px;
  height: 8px;
  display: inline-block;
}

.sidebar .nav-section[data-cat="sales"] .nav-section-title .dot { background: var(--c-sales); }
.sidebar .nav-section[data-cat="kunden"] .nav-section-title .dot { background: var(--c-kunden); }
.sidebar .nav-section[data-cat="tools"] .nav-section-title .dot { background: var(--c-tools); }
.sidebar .nav-section[data-cat="communication"] .nav-section-title .dot { background: var(--c-comm); }
.sidebar .nav-section[data-cat="marketing"] .nav-section-title .dot { background: #C8102E; }
.sidebar .nav-section[data-cat="admin"] .nav-section-title .dot { background: var(--c-accent); }

.sidebar .nav-link {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: 9px var(--s-5);
  font-size: 13px;
  font-weight: 500;
  color: var(--c-ink-soft);
  border-left: 3px solid transparent;
  cursor: pointer;
  transition: background 0.1s, color 0.1s, border-color 0.1s;
}
.sidebar .nav-link:hover {
  background: var(--c-soft);
  color: var(--c-ink);
}
.sidebar .nav-link.is-active {
  background: var(--c-soft);
  font-weight: 700;
  color: var(--c-ink);
}
.sidebar .nav-section[data-cat="sales"] .nav-link.is-active { border-left-color: var(--c-sales); }
.sidebar .nav-section[data-cat="kunden"] .nav-link.is-active { border-left-color: var(--c-kunden); }
.sidebar .nav-section[data-cat="tools"] .nav-link.is-active { border-left-color: var(--c-tools); }
.sidebar .nav-section[data-cat="communication"] .nav-link.is-active { border-left-color: var(--c-comm); }
.sidebar .nav-section[data-cat="admin"] .nav-link.is-active { border-left-color: var(--c-admin); }

.sidebar .nav-link .icon {
  width: 18px; height: 18px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--c-mid);
  transition: color 180ms ease;
  flex-shrink: 0;
}
.sidebar .nav-link .icon svg { width: 18px; height: 18px; display: block; }
.sidebar .nav-link:hover .icon { color: var(--c-accent); }
.sidebar .nav-link.is-active .icon { color: var(--c-accent); }
.sidebar .nav-link .baustelle {
  margin-left: auto;
  font-family: var(--f-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 2px 6px;
  background: var(--c-warning);
  color: var(--c-ink);
  border-radius: var(--radius-pill);
}

/* ── Main ───────────────────────────────────────────────────── */

.main {
  padding: var(--s-8);
  overflow-y: auto;
  overflow-x: hidden; /* Guard: keine versehentliche horizontale Body-Scrollbar durch überbreite Children */
  background: var(--c-soft);
}

/* ── Responsive Basis-Guards (C1) ───────────────────────────── */
/* Formularzeilen: nebeneinander, auf Mobil gestapelt (partnerUI/knowledgeUI) */
.form-row { display: flex; gap: var(--s-4); width: 100%; }
@media (max-width: 600px) { .form-row { flex-direction: column; gap: var(--s-2); } }

.section-header {
  margin-bottom: var(--s-6);
  padding-bottom: var(--s-4);
  border-bottom: 1px solid var(--c-line);
}

.section-header h1 {
  font-family: var(--f-display);
  font-weight: 800;
  font-size: 30px;
  letter-spacing: -0.03em;
  color: var(--c-ink);
  line-height: 1.1;
}

.section-header .subtitle {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--c-mid);
  margin-top: var(--s-2);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--s-2);
}

/* ── Cards ─────────────────────────────────────────────────── */

.card {
  background: var(--c-surface);
  border: 1px solid var(--c-line-soft);
  padding: var(--s-6);
  margin-bottom: var(--s-4);
  border-radius: 0;
  transition: border-color 0.12s;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  margin-bottom: var(--s-5);
  padding-bottom: var(--s-4);
  border-bottom: 1px solid var(--c-line-soft);
}
.card-header h3 {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
  color: var(--c-ink);
  margin: 0;
}
.card-header .btn.small {
  flex-shrink: 0;
}

/* ── KPI-Stat-Cards ─────────────────────────────────────────── */

.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--s-4);
  margin-bottom: var(--s-6);
}
.stat {
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  padding: var(--s-5);
  border-left: 4px solid var(--c-accent);
  border-radius: 0;
}
.stat .stat-label {
  font-family: var(--f-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--c-mid);
  margin-bottom: var(--s-2);
}
.stat .stat-value {
  font-family: var(--f-display);
  font-weight: 800;
  font-size: 28px;
  letter-spacing: -0.03em;
  color: var(--c-ink);
}
.stat .stat-sub { font-size: 12px; color: var(--c-mid); margin-top: var(--s-1); }
.stat.sales { border-left-color: var(--c-sales); }
.stat.kunden { border-left-color: var(--c-kunden); }
.stat.tools { border-left-color: var(--c-tools); }
.stat.comm { border-left-color: var(--c-comm); }

/* ── Tabellen ───────────────────────────────────────────────── */

.table-wrap { background: var(--c-surface); border: 1px solid var(--c-line); overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: var(--s-3) var(--s-4); text-align: left; font-size: 13px; white-space: nowrap; }
th {
  background: var(--c-ink);
  color: var(--c-surface);
  font-family: var(--f-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  position: sticky;
  top: 0;
  z-index: 5;
}
/* Mindest-Lesbarkeit für Mono-Kleintext in Zellen (keine <11px) */
.table-wrap small { font-size: max(11px, 0.85em); }
tbody tr { border-bottom: 1px solid var(--c-line-soft); }
tbody tr:hover { background: var(--c-soft); }
tbody tr:last-child { border-bottom: none; }

/* ── Mono-Badges (Pille) ────────────────────────────────────── */

.badge {
  display: inline-block;
  font-family: var(--f-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--c-ink);
  color: var(--c-surface);
}
.badge.outline { background: transparent; color: var(--c-ink); border: 1px solid var(--c-ink); }
.badge.sales { background: var(--c-sales); }
.badge.kunden { background: var(--c-kunden); }
.badge.tools { background: var(--c-tools); }
.badge.comm { background: var(--c-comm); }
.badge.admin { background: var(--c-admin); }
.badge.priority-critical { background: var(--c-danger); }
.badge.priority-high { background: var(--c-accent); }
.badge.priority-medium { background: var(--c-warning); color: var(--c-ink); }
.badge.priority-normal { background: var(--c-mid); }

/* ── Buttons ────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 13px;
  padding: 10px 18px;
  border: 1px solid var(--c-ink);
  background: var(--c-ink);
  color: var(--c-surface);
  border-radius: 0;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s, box-shadow 0.12s;
  white-space: nowrap;
}
.btn:hover {
  background: #000;
  box-shadow: 0 2px 6px rgba(10, 10, 10, 0.15);
}
.btn:active { box-shadow: none; transform: translateY(1px); }

.btn.secondary {
  background: var(--c-accent);
  border-color: var(--c-accent);
}
.btn.secondary:hover {
  background: #D52F3D;
  border-color: #D52F3D;
  box-shadow: 0 2px 6px rgba(230, 57, 70, 0.25);
}

.btn.ghost {
  background: var(--c-surface);
  color: var(--c-ink);
  border-color: var(--c-line);
}
.btn.ghost:hover {
  background: var(--c-soft);
  border-color: var(--c-ink);
  box-shadow: none;
}

.btn.small { padding: 7px 12px; font-size: 11px; }

/* Button-Gruppen mit klarer Hierarchie */
.btn:focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: 2px;
}

/* ── Login ──────────────────────────────────────────────────── */

.login {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; background: var(--c-soft);
}
.login.is-hidden { display: none; }
.login .login-card {
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-top: 4px solid var(--c-ink);
  padding: var(--s-10);
  width: 380px;
}
.login .brand {
  display: flex; flex-direction: column; align-items: center;
  margin-bottom: var(--s-8);
}
.login .brand img { height: 48px; margin-bottom: var(--s-3); }
.login .brand .name {
  font-family: var(--f-display); font-weight: 800; font-size: 22px;
  letter-spacing: -0.03em;
}
.login .brand .sub {
  font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.15em;
  text-transform: uppercase; color: var(--c-mid); margin-top: var(--s-1);
}
.login h2 {
  font-family: var(--f-display); font-weight: 700; font-size: 16px;
  margin-bottom: var(--s-4);
}
.field { margin-bottom: var(--s-4); }
.field label {
  display: block;
  font-family: var(--f-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--c-mid);
  margin-bottom: var(--s-2);
}
.field input, .field select, .field textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--c-line);
  font-family: var(--f-body);
  font-size: 14px;
  line-height: 1.4;
  border-radius: 0;
  background: var(--c-surface);
  color: var(--c-ink);
  transition: border-color 0.12s, box-shadow 0.12s;
}
.field input::placeholder, .field textarea::placeholder { color: var(--c-mid-soft); }
.field input:hover, .field select:hover, .field textarea:hover { border-color: var(--c-mid); }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--c-ink);
  box-shadow: 0 0 0 3px rgba(10, 10, 10, 0.06);
}
.field input:disabled, .field select:disabled, .field textarea:disabled {
  background: var(--c-soft);
  color: var(--c-mid);
  cursor: not-allowed;
}
.field input[required]:invalid:not(:placeholder-shown):not(:focus) {
  border-color: var(--c-accent);
}
.field label {
  margin-bottom: 6px;
}
.login .btn { width: 100%; }
.error-msg {
  background: var(--c-accent-soft);
  border-left: 3px solid var(--c-accent);
  padding: var(--s-3);
  font-size: 13px;
  color: var(--c-danger);
  margin-bottom: var(--s-3);
}

/* ── Baustellen-Hinweis ─────────────────────────────────────── */

.baustelle-banner {
  background: repeating-linear-gradient(
    45deg,
    var(--c-warning),
    var(--c-warning) 8px,
    var(--c-ink) 8px,
    var(--c-ink) 16px
  );
  height: 8px;
  margin-bottom: var(--s-4);
}
.baustelle-content {
  background: var(--c-surface);
  border: 2px dashed var(--c-warning);
  padding: var(--s-8);
  text-align: center;
}
.baustelle-content .icon { font-size: 48px; display: block; margin-bottom: var(--s-3); }
.baustelle-content h2 {
  font-family: var(--f-display); font-weight: 800; font-size: 22px;
  margin-bottom: var(--s-2); color: var(--c-ink);
}
.baustelle-content p {
  font-size: 14px; color: var(--c-mid); max-width: 480px;
  margin: 0 auto var(--s-4);
}
.baustelle-content .phase {
  display: inline-block;
  font-family: var(--f-mono); font-size: 10px; font-weight: 700;
  letter-spacing: 0.15em; text-transform: uppercase;
  padding: 4px 10px;
  background: var(--c-ink); color: var(--c-warning);
  border-radius: var(--radius-pill);
}

/* ── Tools-Grid ─────────────────────────────────────────────── */

.tools-cat-header {
  display: flex; align-items: center; gap: var(--s-3);
  margin: var(--s-8) 0 var(--s-4);
  padding-bottom: var(--s-2);
  border-bottom: 2px solid var(--c-line);
}
.tools-cat-header:first-child { margin-top: 0; }
.tools-cat-header .dot { width: 12px; height: 12px; }
.tools-cat-header h2 {
  font-family: var(--f-display); font-weight: 800; font-size: 16px;
  letter-spacing: -0.01em;
}
.tools-cat-header[data-cat="sales"] .dot { background: var(--c-sales); }
.tools-cat-header[data-cat="build"] .dot { background: var(--c-tools); }
.tools-cat-header[data-cat="communication"] .dot { background: var(--c-comm); }
.tools-cat-header[data-cat="admin"] .dot { background: var(--c-admin); }

.tools-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--s-4);
}
.tool-card {
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  padding: var(--s-5);
  border-left: 4px solid var(--c-mid);
  cursor: pointer;
  position: relative;
}
.tool-card[data-cat="sales"] { border-left-color: var(--c-sales); }
.tool-card[data-cat="build"] { border-left-color: var(--c-tools); }
.tool-card[data-cat="communication"] { border-left-color: var(--c-comm); }
.tool-card[data-cat="admin"] { border-left-color: var(--c-admin); }
.tool-card:hover { background: var(--c-soft); }
.tool-card .tool-icon { font-size: 24px; margin-bottom: var(--s-2); }
.tool-card .tool-name {
  font-family: var(--f-display); font-weight: 700; font-size: 14px;
  margin-bottom: var(--s-1); color: var(--c-ink);
}
.tool-card .tool-desc {
  font-size: 12px; color: var(--c-mid); line-height: 1.4;
}
.tool-card .tool-status {
  position: absolute; top: var(--s-3); right: var(--s-3);
  font-family: var(--f-mono); font-size: 9px; font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase;
  padding: 2px 6px; border-radius: var(--radius-pill);
}
.tool-card .tool-status.active { background: var(--c-success); color: var(--c-surface); }
.tool-card .tool-status.planned { background: var(--c-warning); color: var(--c-ink); }
.tool-card .tool-status.in_development { background: var(--c-info); color: var(--c-surface); }

/* ── Utilities ──────────────────────────────────────────────── */

.text-mono { font-family: var(--f-mono); }
.text-mid { color: var(--c-mid); }
.text-right { text-align: right; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-2 { gap: var(--s-2); }
.gap-3 { gap: var(--s-3); }
.mt-2 { margin-top: var(--s-2); }
.mt-4 { margin-top: var(--s-4); }
.mb-4 { margin-bottom: var(--s-4); }

.loading {
  font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.15em;
  text-transform: uppercase; color: var(--c-mid); padding: var(--s-8);
  text-align: center;
}

.empty {
  padding: var(--s-12); text-align: center; color: var(--c-mid);
  font-family: var(--f-mono); font-size: 11px;
  letter-spacing: 0.15em; text-transform: uppercase;
}
.empty-small {
  padding: var(--s-4); text-align: center; color: var(--c-mid);
  font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ── Section-Header mit Actions ─────────────────────────────── */

.section-header {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: var(--s-4);
  flex-wrap: wrap;
}
.section-header .header-actions {
  display: flex; gap: var(--s-2);
  flex-wrap: wrap;        /* WP2: Action-Cluster darf auf Mobile umbrechen */
  min-width: 0;
}
.section-header .breadcrumb {
  font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.15em;
  text-transform: uppercase; color: var(--c-mid); margin-bottom: var(--s-2);
}
.section-header .breadcrumb a { color: var(--c-mid); }
.section-header .breadcrumb a:hover { color: var(--c-ink); }
.section-header .breadcrumb .bc-sep { margin: 0 var(--s-2); }

/* ── Clickable Tables ───────────────────────────────────────── */

table.clickable tbody tr { cursor: pointer; transition: background 0.1s; }
table.clickable tbody tr:hover { background: var(--c-soft); }
table.clickable tbody tr:hover td:first-child { border-left: 3px solid var(--c-accent); padding-left: calc(var(--s-4) - 3px); }

/* ── Detail-Views (Lead / Customer / Ticket) ────────────────── */

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: var(--s-5);
}
@media (max-width: 1100px) {
  .detail-grid { grid-template-columns: 1fr; }
}
.detail-main, .detail-aside { display: flex; flex-direction: column; gap: var(--s-4); }

.detail-rows { display: flex; flex-direction: column; gap: 0; }
.detail-row {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: var(--s-4);
  padding: var(--s-3) 0;
  border-bottom: 1px solid var(--c-line-soft);
  align-items: center;
}
.detail-row:last-child { border-bottom: none; }
.detail-row .detail-label {
  font-family: var(--f-mono); font-size: 10px; font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--c-mid);
}
.detail-row .detail-value { font-size: 14px; color: var(--c-ink); line-height: 1.4; }
.detail-row .detail-value code {
  font-family: var(--f-mono); font-size: 13px;
  background: var(--c-soft); padding: 2px 6px;
}
.detail-row .detail-value a { color: var(--c-accent); text-decoration: none; border-bottom: 1px solid transparent; transition: border-color 0.1s; }
.detail-row .detail-value a:hover { border-bottom-color: var(--c-accent); }

.inline-select {
  font-family: var(--f-body);
  font-size: 13px;
  padding: 4px 8px;
  border: 1px solid var(--c-line);
  background: var(--c-surface);
  border-radius: 0;
  cursor: pointer;
}
.inline-select:focus { outline: none; border-color: var(--c-ink); }

.prose { line-height: 1.6; color: var(--c-ink); font-size: 14px; }

.package-list { list-style: none; padding: 0; }
.package-list li {
  padding: var(--s-3); border-bottom: 1px solid var(--c-line-soft);
  font-size: 13px;
}
.package-list li:last-child { border-bottom: none; }
.package-list li .badge { margin-left: var(--s-2); }

.contact-card {
  padding: var(--s-3) var(--s-4);
  background: var(--c-soft);
  border-left: 3px solid var(--c-kunden);
  margin-bottom: var(--s-3);
  font-size: 13px;
}
.contact-card:last-child { margin-bottom: 0; }
.contact-card-head {
  display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap;
  margin-bottom: 4px;
}
.contact-card-head strong { color: var(--c-ink); }
.contact-position {
  font-size: 12px; color: var(--c-mid);
  margin-bottom: var(--s-2);
}
.contact-card .contact-meta {
  font-size: 12px;
  color: var(--c-mid);
  display: flex; flex-direction: column; gap: 2px;
}
.contact-card .contact-meta a { color: var(--c-accent); }

/* ─── Deal Mini-Liste (Dashboard, behebt Tabellen-Überlappung WP1) ──── */
.deal-mini-list { display: flex; flex-direction: column; }
.deal-mini-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--s-3);
  padding: 10px 0;
  border-bottom: 1px solid var(--c-line-soft);
  cursor: pointer;
  transition: background 120ms ease;
}
.deal-mini-row:last-child { border-bottom: none; }
.deal-mini-row:hover { background: var(--c-soft); }
.deal-mini-status { flex-shrink: 0; }
.deal-mini-main { min-width: 0; overflow: hidden; }
.deal-mini-name {
  font-weight: 600; font-size: 13px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.deal-mini-company {
  font-size: 11px; margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.deal-mini-meta {
  display: flex; flex-direction: column; align-items: flex-end;
  gap: 3px; font-size: 11px; flex-shrink: 0;
}
@media (max-width: 600px) {
  .deal-mini-row { grid-template-columns: 1fr auto; gap: var(--s-2); }
  .deal-mini-status { grid-column: 1; }
  .deal-mini-main { grid-column: 1 / -1; grid-row: 2; }
  .deal-mini-meta { grid-row: 1; }
}

.mini-row {
  display: flex; align-items: center; gap: var(--s-2);
  padding: var(--s-3); border-bottom: 1px solid var(--c-line-soft);
  font-size: 13px; cursor: pointer;
}
.mini-row:hover { background: var(--c-soft); }
.mini-row:last-child { border-bottom: none; }

/* ── Timeline (Activities) ──────────────────────────────────── */

.timeline { position: relative; padding-left: 0; }
.timeline-item {
  position: relative;
  padding-left: var(--s-5);
  padding-bottom: var(--s-4);
  border-left: 2px solid var(--c-line);
  margin-left: 8px;
}
.timeline-item:last-child { padding-bottom: 0; border-left-color: transparent; }
.timeline-marker {
  position: absolute;
  left: -7px; top: 4px;
  width: 12px; height: 12px;
  background: var(--c-accent);
  border: 2px solid var(--c-surface);
  border-radius: 50%;
}
.timeline-content { padding-bottom: var(--s-2); }
.timeline-meta { margin-bottom: var(--s-1); display: flex; gap: var(--s-2); align-items: center; }
.timeline-body { font-size: 13px; line-height: 1.5; color: var(--c-ink); margin-bottom: var(--s-1); }
.timeline-foot { font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; }

/* ── Workflow-Stepper (Ticket-Detail) ───────────────────────── */

.workflow { display: flex; flex-direction: column; gap: var(--s-2); }
.workflow-step {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-2) var(--s-3);
  font-size: 13px;
  color: var(--c-mid);
  border-left: 3px solid var(--c-line);
}
.workflow-step .step-dot {
  width: 12px; height: 12px;
  background: var(--c-line);
  border-radius: 50%;
  flex-shrink: 0;
}
.workflow-step.is-done { color: var(--c-ink); border-left-color: var(--c-kunden); }
.workflow-step.is-done .step-dot { background: var(--c-kunden); }
.workflow-step.is-current {
  color: var(--c-ink); font-weight: 700;
  background: var(--c-soft); border-left-color: var(--c-accent);
}
.workflow-step.is-current .step-dot { background: var(--c-accent); }

/* ── Kanban-Board ───────────────────────────────────────────── */

.kanban-board {
  display: grid;
  grid-auto-columns: 260px;
  grid-auto-flow: column;
  gap: var(--s-3);
  overflow-x: auto;
  padding-bottom: var(--s-4);
}
.kanban-col {
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  display: flex; flex-direction: column;
  min-height: 400px;
}
.kanban-col-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--s-3); border-bottom: 1px solid var(--c-line);
  background: var(--c-soft);
}
.kanban-count {
  font-family: var(--f-mono); font-size: 11px; font-weight: 700;
  color: var(--c-mid);
}
.kanban-cards {
  flex: 1;
  padding: var(--s-2);
  display: flex; flex-direction: column; gap: var(--s-2);
  min-height: 200px;
}
.kanban-cards.is-drop-target { background: var(--c-soft); outline: 2px dashed var(--c-accent); outline-offset: -2px; }
.kanban-empty { text-align: center; color: var(--c-line); font-size: 24px; padding: var(--s-4); }
.kanban-card {
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-left: 3px solid var(--c-sales);
  padding: var(--s-3);
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
}
.kanban-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.08); transform: translateY(-1px); }
.kanban-card.is-dragging { opacity: 0.5; }
.kanban-card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--s-2); }
.kanban-card-name { font-size: 13px; margin-bottom: 2px; }
.kanban-card-company { font-size: 12px; margin-bottom: var(--s-2); }
.kanban-card-foot {
  display: flex; justify-content: space-between;
  padding-top: var(--s-2); border-top: 1px solid var(--c-line-soft);
  font-size: 11px;
}

/* ── Modal-System ───────────────────────────────────────────── */

.modal { display: none; }
.modal.is-open { display: block; }
.modal .modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 1000;
}
.modal .modal-dialog {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-top: 3px solid var(--c-accent);
  width: 90vw; max-width: 680px;
  max-height: 92vh;
  display: flex; flex-direction: column;
  z-index: 1001;
  box-shadow: 0 24px 60px rgba(10, 10, 10, 0.18), 0 4px 12px rgba(10, 10, 10, 0.08);
}
.modal .modal-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: var(--s-5) var(--s-6);
  border-bottom: 1px solid var(--c-line-soft);
  flex-shrink: 0;
}
.modal .modal-head h3 {
  font-family: var(--f-display); font-weight: 700; font-size: 17px;
  letter-spacing: -0.01em; color: var(--c-ink);
}
.modal .modal-close {
  background: none; border: none; font-size: 24px;
  color: var(--c-mid); cursor: pointer; line-height: 1;
  padding: 4px 8px;
  transition: color 0.1s;
}
.modal .modal-close:hover { color: var(--c-ink); }
.modal .modal-body {
  padding: var(--s-6);
  overflow-y: auto;
  flex: 1;
  display: flex; flex-direction: column;
  gap: var(--s-5);
}
.modal .modal-foot {
  display: flex; justify-content: flex-end; gap: var(--s-3);
  padding: var(--s-4) var(--s-6);
  border-top: 1px solid var(--c-line-soft);
  background: var(--c-soft);
  flex-shrink: 0;
}

/* Form-Sections im Modal */
.form-section {
  padding-bottom: var(--s-4);
  border-bottom: 1px solid var(--c-line-soft);
}
.form-section:last-child { padding-bottom: 0; border-bottom: none; }
.form-section-title {
  font-family: var(--f-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--c-mid);
  margin: 0 0 var(--s-4) 0;
  padding-bottom: var(--s-2);
  border-bottom: 1px solid var(--c-line);
  position: relative;
}
.form-section-title::before {
  content: '';
  position: absolute;
  bottom: -1px; left: 0;
  width: 24px; height: 1px;
  background: var(--c-accent);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-4) var(--s-4);
}
.form-grid .field { margin-bottom: 0; }
.form-grid .field.span-2 { grid-column: 1 / -1; }
.form-grid .field textarea { resize: vertical; min-height: 80px; }

/* ── Projekte ───────────────────────────────────────────────── */

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--s-4);
}

.project-card {
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-top: 4px solid var(--area-color, var(--c-kunden));
  padding: var(--s-4);
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
  display: flex; flex-direction: column; gap: var(--s-2);
}
.project-card-phase {
  font-size: 12px;
  color: var(--c-mid);
  background: var(--c-soft);
  padding: 4px 8px;
  border-left: 2px solid var(--area-color, var(--c-accent));
}
.project-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.08); transform: translateY(-2px); }

.project-card-head { display: flex; justify-content: space-between; gap: var(--s-2); }
.project-card-title {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
  color: var(--c-ink);
  margin: 0;
}
.project-card-customer {
  font-size: 12px; color: var(--c-mid);
  font-family: var(--f-mono);
  text-transform: uppercase; letter-spacing: 0.08em;
}
.project-card-foot {
  display: flex; justify-content: space-between;
  padding-top: var(--s-2);
  border-top: 1px solid var(--c-line-soft);
  font-size: 12px;
}

/* ── Progress-Bar ───────────────────────────────────────────── */

.progress-bar {
  height: 6px;
  background: var(--c-line);
  border-radius: 0;
  overflow: hidden;
  margin: var(--s-1) 0;
}
.progress-bar-large { height: 12px; margin: var(--s-2) 0 var(--s-3); }
.progress-fill {
  height: 100%;
  background: var(--c-kunden);
  transition: width 0.3s ease;
}
.progress-meta {
  display: flex; justify-content: space-between;
  font-size: 11px;
}
.progress-meta-large {
  display: flex; justify-content: space-between;
  font-size: 13px; color: var(--c-ink);
  padding-bottom: var(--s-2);
}

.deadline-overdue {
  color: var(--c-danger);
  font-weight: 700;
  font-family: var(--f-mono);
}
.deadline-today {
  color: var(--c-warning);
  font-weight: 700;
  font-family: var(--f-mono);
  background: var(--c-ink);
  padding: 2px 6px;
}

/* ── Task-Item (Projekt-Subtasks) ───────────────────────────── */

.task-item {
  display: flex; gap: var(--s-3); align-items: flex-start;
  padding: var(--s-3);
  border-bottom: 1px solid var(--c-line-soft);
  transition: opacity 0.15s;
}
.task-item:last-child { border-bottom: none; }
.task-item:hover { background: var(--c-soft); }
.task-item.is-done { opacity: 0.55; }
.task-item.is-done .task-title { text-decoration: line-through; color: var(--c-mid); }

.task-checkbox {
  position: relative;
  display: inline-block;
  width: 18px; height: 18px;
  flex-shrink: 0;
  margin-top: 2px;
  cursor: pointer;
}
.task-checkbox input {
  position: absolute;
  opacity: 0;
  width: 100%; height: 100%;
  cursor: pointer;
  margin: 0;
}
.task-checkbox span {
  position: absolute; inset: 0;
  border: 2px solid var(--c-ink);
  background: var(--c-surface);
  transition: background 0.1s;
}
.task-checkbox input:checked + span {
  background: var(--c-kunden);
  border-color: var(--c-kunden);
}
.task-checkbox input:checked + span::after {
  content: '';
  position: absolute;
  left: 4px; top: 0px;
  width: 6px; height: 11px;
  border: solid var(--c-surface);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.task-body { flex: 1; min-width: 0; }
.task-title { font-size: 14px; font-weight: 500; color: var(--c-ink); margin-bottom: 2px; }
.task-meta {
  font-size: 11px;
  letter-spacing: 0.05em;
  color: var(--c-mid);
}

.wizard-skill-warning {
  font-size: 11px;
  color: #b95c2a;
  background: #fef3e2;
  border: 1px solid #f5d4a8;
  padding: 4px 8px;
  border-radius: 3px;
  margin-top: 4px;
  display: inline-block;
}
.btn-link {
  background: none; border: none; color: var(--c-accent);
  cursor: pointer; padding: 0; font: inherit; text-decoration: underline;
}
.btn-link:hover { color: var(--c-fg); }

.btn.danger {
  background: #b95c2a;
  color: #fff;
  border: 1px solid #b95c2a;
}
.btn.danger:hover { background: #9c4a1f; border-color: #9c4a1f; }

/* ═══ Link-Picker (existierenden Kontakt zuweisen) ═══════════════ */
.link-results {
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--c-line-soft);
  border-radius: 6px;
  background: var(--c-soft);
}
.link-result {
  padding: 8px 12px;
  border-bottom: 1px solid var(--c-line-soft);
  cursor: pointer;
  transition: background .1s ease;
}
.link-result:last-child { border-bottom: none; }
.link-result:hover { background: var(--c-line-soft); }
.link-result.is-selected { background: var(--c-accent-soft); border-left: 3px solid var(--c-accent); }

/* ═══ Domain-Cards in Company-Detail ═════════════════════════════ */
.domain-list { display: flex; flex-direction: column; gap: 8px; }
.domain-card {
  padding: var(--s-3);
  background: var(--c-soft);
  border-left: 3px solid var(--c-tools);
  border-radius: 4px;
}
.domain-card-head {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.domain-name {
  font-family: var(--f-mono);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  color: var(--c-ink);
}
.domain-name:hover { color: var(--c-accent); }
.domain-meta { font-family: var(--f-mono); }

/* ═══ Projekt: Multi-Betreuer Team-Leiste ═════════════════════ */
.project-team-bar {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  background: var(--c-soft);
  border: 1px solid var(--c-line-soft);
  border-radius: 8px;
  margin: var(--s-3) 0 var(--s-4);
}
.project-team-label {
  font: 600 11px/1 var(--f-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--c-mid);
}
.project-team-avatars {
  display: flex;
  align-items: center;
  flex: 1;
  flex-wrap: wrap;
  gap: 4px;
}
.project-owner-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--c-ink);
  color: var(--c-surface);
  display: flex; align-items: center; justify-content: center;
  font: 700 11px/1 var(--f-mono);
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease;
  border: 2px solid var(--c-surface);
}
.project-owner-avatar:hover { transform: scale(1.1); box-shadow: 0 0 0 2px var(--c-accent); }
.project-owner-avatar.is-lead { background: var(--c-accent); }

/* ═══ Task Quick-Reassign Button ════════════════════════════════ */
.task-assignee-btn {
  background: none; border: none; padding: 0;
  margin-left: auto; cursor: pointer;
  display: inline-flex; align-items: center;
  transition: opacity .12s ease;
}
.task-assignee-avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--c-soft);
  color: var(--c-ink);
  font: 700 10px/1 var(--f-mono);
  border: 1px solid var(--c-line);
  transition: transform .12s ease, border-color .12s ease;
}
.task-assignee-empty {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--c-surface);
  color: var(--c-mid);
  font-size: 16px; font-weight: 400;
  border: 1px dashed var(--c-line);
  transition: border-color .12s ease, color .12s ease;
}
.task-assignee-btn:hover .task-assignee-avatar { transform: scale(1.1); border-color: var(--c-accent); }
.task-assignee-btn:hover .task-assignee-empty { border-color: var(--c-accent); color: var(--c-accent); }

/* ═══ KI-Update-Chat im Projekt-Detail ════════════════════════ */
.project-ai-update-card {
  border-left: 3px solid var(--c-accent);
}
.ai-chat-thread {
  max-height: 360px;
  overflow-y: auto;
  padding: var(--s-3) 0;
  display: flex; flex-direction: column; gap: 12px;
}
.ai-chat-msg {
  display: flex;
  animation: ai-msg-in .25s ease both;
}
@keyframes ai-msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.ai-chat-msg-user { justify-content: flex-end; }
.ai-chat-msg-ai { justify-content: flex-start; }
.ai-chat-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.55;
  max-width: 80%;
  white-space: pre-wrap;
  word-break: break-word;
}
.ai-chat-msg-user .ai-chat-bubble {
  background: var(--c-accent);
  color: var(--c-surface);
  border-bottom-right-radius: 4px;
}
.ai-chat-msg-ai .ai-chat-bubble {
  background: var(--c-soft);
  border: 1px solid var(--c-line-soft);
  border-bottom-left-radius: 4px;
}
.ai-chat-bubble.is-error { background: #FEE2E2; border-color: #FCA5A5; color: #991B1B; }
.ai-chat-interp {
  font-size: 11px;
  color: var(--c-mid);
  font-style: italic;
  margin-bottom: 6px;
  padding-bottom: 6px;
  border-bottom: 1px dashed var(--c-line);
}
.ai-chat-changes {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--c-line);
}
.ai-chat-changes-h {
  font: 600 10px/1 var(--f-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--c-mid);
  margin-bottom: 6px;
}
.ai-chat-changes-list {
  list-style: none;
  padding: 0; margin: 0 0 var(--s-2);
}
.ai-chat-changes-list li {
  font-size: 12px;
  padding: 6px 0;
  border-bottom: 1px dashed var(--c-line-soft);
}
.ai-chat-changes-list li:last-child { border-bottom: none; }
.ai-change-action {
  font: 600 11px/1 inherit;
  display: inline-block;
  background: var(--c-surface);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--c-line-soft);
}
.ai-change-why { font-size: 11px; color: var(--c-mid); margin-top: 2px; }
.ai-chat-actions {
  display: flex; gap: 6px; justify-content: flex-end;
  padding-top: 6px;
}
.ai-chat-applied {
  font: 600 11px/1 var(--f-mono);
  color: var(--c-tools);
  text-align: right;
  padding-top: 4px;
}
.ai-chat-input-row {
  display: flex;
  gap: 8px;
  padding-top: var(--s-2);
  border-top: 1px solid var(--c-line-soft);
  align-items: flex-end;
}
.ai-chat-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--c-line);
  background: var(--c-surface);
  font: inherit;
  font-size: 13px;
  color: var(--c-ink);
  border-radius: 6px;
  resize: none;
  min-height: 38px;
}
.ai-chat-input:focus {
  outline: none;
  border-color: var(--c-accent);
  box-shadow: 0 0 0 3px var(--c-accent-soft);
}
.ai-chat-dots::after { content: ''; animation: ai-dots 1.4s steps(4, end) infinite; }
.dots::after { content: '...'; animation: ai-dots 1.4s steps(4, end) infinite; }
@keyframes ai-dots {
  0%, 20% { content: ''; }
  40% { content: '.'; }
  60% { content: '..'; }
  80%, 100% { content: '...'; }
}

/* ═══ Projekt Vergütungs-Card ═══════════════════════════════════ */
.payout-card { background: var(--c-soft); }
.payout-row {
  display: grid;
  grid-template-columns: 90px 1fr 80px;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
}
.payout-label { font-size: 12px; font-weight: 600; }
.payout-bar {
  height: 8px;
  background: var(--c-line-soft);
  border-radius: 4px;
  overflow: hidden;
}
.payout-fill { height: 100%; border-radius: 4px; transition: width .3s ease; }
.payout-value { font-size: 12px; text-align: right; font-weight: 600; }

/* ═══ Toast-Notifications ═════════════════════════════════════ */
.toast-container {
  position: fixed;
  top: var(--s-4);
  right: var(--s-4);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-left: 3px solid var(--c-mid);
  border-radius: 8px;
  min-width: 240px;
  max-width: 380px;
  font-size: 13px;
  font-weight: 500;
  color: var(--c-ink);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  cursor: pointer;
  pointer-events: auto;
  opacity: 0;
  transform: translateX(20px);
  transition: opacity .22s ease, transform .22s ease;
}
.toast.is-visible { opacity: 1; transform: translateX(0); }
.toast-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px;
  border-radius: 50%;
  font-weight: 700;
  font-size: 12px;
  flex-shrink: 0;
  background: var(--c-soft);
  color: var(--c-mid);
}
.toast-msg { flex: 1; line-height: 1.4; word-break: break-word; }
.toast.toast-success { border-left-color: #16A34A; }
.toast.toast-success .toast-icon { background: #DCFCE7; color: #166534; }
.toast.toast-error { border-left-color: #DC2626; }
.toast.toast-error .toast-icon { background: #FEE2E2; color: #991B1B; }
.toast.toast-warn { border-left-color: #D97706; }
.toast.toast-warn .toast-icon { background: #FEF3C7; color: #92400E; }
.toast.toast-info { border-left-color: #2563EB; }
.toast.toast-info .toast-icon { background: #DBEAFE; color: #1E40AF; }

/* ═══════════════════════════════════════════════════════════════
   EINSTELLUNGEN-HUB V2
   Refined Minimalism · inspiriert von Linear / Vercel / GitHub
   ═══════════════════════════════════════════════════════════════ */
.settings-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: 12px;
  overflow: hidden;
  min-height: calc(100vh - 160px);
  margin-top: var(--s-2);
}
@media (max-width: 880px) {
  .settings-shell { grid-template-columns: 1fr; min-height: auto; }
}

/* ─── Left Rail ────────────────────────────────────────────── */
.settings-nav {
  background: var(--c-soft);
  border-right: 1px solid var(--c-line-soft);
  padding: var(--s-4) 0 var(--s-6);
  font-size: 13px;
}
.settings-nav-head {
  padding: var(--s-2) var(--s-5) var(--s-4);
  border-bottom: 1px solid var(--c-line-soft);
  margin-bottom: var(--s-4);
}
.settings-nav-title {
  font: 700 11px/1 var(--f-mono);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--c-mid);
  margin-bottom: var(--s-3);
}
.settings-nav-user {
  display: flex;
  align-items: center;
  gap: 10px;
}
.settings-nav-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--c-ink);
  color: var(--c-surface);
  display: flex; align-items: center; justify-content: center;
  font: 700 12px/1 var(--f-mono);
  letter-spacing: 0.02em;
}
.settings-nav-uname { font-weight: 600; font-size: 13px; }
.settings-nav-urole { font: 500 10px/1 var(--f-mono); text-transform: uppercase; letter-spacing: 0.06em; color: var(--c-mid); margin-top: 2px; }

.settings-nav-group { margin-bottom: var(--s-3); }
.settings-nav-group.is-danger { margin-top: var(--s-4); padding-top: var(--s-3); border-top: 1px solid var(--c-line-soft); }
.settings-nav-group-label {
  font: 700 10px/1 var(--f-mono);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--c-mid);
  padding: 0 var(--s-5) 6px;
}
.settings-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: none;
  border: none;
  padding: 7px var(--s-5);
  font: 500 13px/1.2 inherit;
  color: var(--c-ink);
  text-align: left;
  cursor: pointer;
  position: relative;
  transition: background .12s ease, color .12s ease;
}
.settings-nav-item:hover { background: rgba(0,0,0,0.04); }
.settings-nav-item.is-active {
  background: var(--c-surface);
  font-weight: 600;
  box-shadow: inset 2px 0 0 var(--c-accent);
}
.settings-nav-item.is-danger { color: var(--c-danger, #C42B3A); }
.settings-nav-item.is-danger.is-active { box-shadow: inset 2px 0 0 var(--c-danger, #C42B3A); }
.settings-nav-icon {
  width: 16px; height: 16px;
  flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--c-mid);
}
.settings-nav-item.is-active .settings-nav-icon { color: var(--c-accent); }
.settings-nav-item.is-danger .settings-nav-icon { color: var(--c-danger, #C42B3A); }
.settings-nav-icon svg { width: 16px; height: 16px; }
.settings-nav-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ─── Right Pane ──────────────────────────────────────────── */
.settings-pane {
  padding: var(--s-8) clamp(var(--s-5), 4vw, var(--s-12)) var(--s-12);
  overflow-y: auto;
  max-width: 920px;
}
@media (max-width: 880px) { .settings-pane { padding: var(--s-5) var(--s-4) var(--s-8); } }

.settings-loading {
  padding: var(--s-12) 0;
  display: flex;
  justify-content: center;
}
.settings-spinner {
  width: 24px; height: 24px;
  border: 2px solid var(--c-line);
  border-top-color: var(--c-accent);
  border-radius: 50%;
  animation: set-spin 0.7s linear infinite;
}
@keyframes set-spin { to { transform: rotate(360deg); } }

.settings-error {
  padding: var(--s-4);
  background: var(--c-danger-soft, #FEE2E2);
  border-left: 3px solid var(--c-danger, #C42B3A);
  font-size: 13px;
}

.settings-section-head {
  margin-bottom: var(--s-5);
}
.settings-section-head h2 {
  font: 700 26px/1.15 var(--f-display, var(--f-body));
  letter-spacing: -0.02em;
  margin: 0 0 6px;
}
.settings-section-head p {
  font-size: 14px;
  color: var(--c-mid);
  margin: 0;
  max-width: 60ch;
  line-height: 1.55;
}

/* ─── Cards ──────────────────────────────────────────────── */
.set-card {
  background: var(--c-surface);
  border: 1px solid var(--c-line-soft);
  border-radius: 10px;
  padding: var(--s-5);
  margin-bottom: var(--s-4);
}
.set-card-info { background: var(--c-soft); border-color: var(--c-line-soft); }
.set-card-h {
  font: 600 11px/1 var(--f-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--c-mid);
  margin-bottom: var(--s-3);
}
.set-card-h-with-action {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s-3);
}
.set-card-foot {
  padding-top: var(--s-3);
  margin-top: var(--s-3);
  border-top: 1px solid var(--c-line-soft);
}
.set-card-row { display: flex; align-items: center; gap: var(--s-4); }
.set-card-row-hero {
  gap: var(--s-5);
}

/* Hero / Avatar */
.set-avatar-big {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--c-ink);
  color: var(--c-surface);
  display: flex; align-items: center; justify-content: center;
  font: 700 22px/1 var(--f-mono);
  flex-shrink: 0;
}
.set-hero-meta { flex: 1; min-width: 0; }
.set-hero-name { font-size: 18px; margin: 0 0 4px; }
.set-hero-sub { color: var(--c-mid); font-size: 13px; margin: 0 0 8px; }
.set-hero-pills { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 0; }

.role-pill {
  font: 600 10px/1 var(--f-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 4px 8px;
  border-radius: 99px;
  background: var(--c-soft);
  border: 1px solid var(--c-line-soft);
}
.role-pill.role-admin { background: #FEE2E2; color: #991B1B; border-color: #FCA5A5; }
.role-pill.role-agent { background: #DBEAFE; color: #1E40AF; border-color: #93C5FD; }
.role-pill.role-external { background: #F3F4F6; color: #4B5563; border-color: #D1D5DB; }
.theme-tag {
  font: 500 10px/1 var(--f-mono);
  padding: 4px 8px;
  border-radius: 4px;
  background: var(--c-soft);
  color: var(--c-mid);
}

/* KV Lists (dl) */
.set-kv {
  display: grid;
  grid-template-columns: minmax(140px, max-content) 1fr;
  gap: 8px var(--s-4);
  margin: 0;
}
.set-kv dt { font: 500 12px/1 var(--f-mono); text-transform: uppercase; letter-spacing: 0.04em; color: var(--c-mid); padding: 4px 0; }
.set-kv dd { margin: 0; font-size: 14px; padding: 4px 0; }

/* KV-Row mit Action (Linear-Style) */
.set-kv-row {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  padding: var(--s-3) 0;
  border-top: 1px solid var(--c-line-soft);
}
.set-card > .set-kv-row:first-of-type,
.set-card-h + .set-kv-row { border-top: none; padding-top: 0; }
.set-kv-info { flex: 1; min-width: 0; }
.set-kv-title { font-weight: 600; font-size: 14px; margin-bottom: 2px; }
.set-kv-desc { font-size: 12px; color: var(--c-mid); line-height: 1.5; }
.set-kv-meta { font-size: 11px; color: var(--c-mid); margin-top: 4px; }
.set-kv-action {
  display: flex; align-items: center; gap: 10px;
  flex-shrink: 0;
}
.set-kv-value { font-size: 13px; color: var(--c-ink); }

/* Forms */
.set-form { display: flex; flex-direction: column; gap: var(--s-3); max-width: 480px; }
.set-form-row { display: flex; flex-direction: column; gap: 6px; }
.set-form-row label {
  font: 500 12px/1 var(--f-mono);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--c-mid);
}
.set-form-row input,
.set-form-row select,
.set-form-row textarea {
  padding: 10px 12px;
  border: 1px solid var(--c-line);
  background: var(--c-surface);
  font: inherit;
  color: var(--c-ink);
  border-radius: 6px;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.set-form-row input:focus,
.set-form-row select:focus,
.set-form-row textarea:focus {
  outline: none;
  border-color: var(--c-accent);
  box-shadow: 0 0 0 3px var(--c-accent-soft);
}
.set-form-hint { font-size: 11px; color: var(--c-mid); }
.set-form-actions { margin-top: var(--s-2); display: flex; gap: var(--s-2); }

/* Buttons (Set-spezifisch) */
.set-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font: 500 13px/1 inherit;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
  text-decoration: none;
}
.set-btn.xs { padding: 5px 10px; font-size: 12px; }
.set-btn.primary { background: var(--c-ink); color: var(--c-surface); border-color: var(--c-ink); }
.set-btn.primary:hover { background: var(--c-accent); border-color: var(--c-accent); }
.set-btn.ghost { background: transparent; color: var(--c-ink); border-color: var(--c-line); }
.set-btn.ghost:hover { background: var(--c-soft); border-color: var(--c-mid); }
.set-btn.danger { background: var(--c-surface); color: var(--c-danger, #C42B3A); border-color: #FCA5A5; }
.set-btn.danger:hover { background: #FEE2E2; border-color: #C42B3A; }

/* Status pills */
.status-pill {
  font: 600 10px/1 var(--f-mono);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 8px;
  border-radius: 99px;
  border: 1px solid transparent;
  display: inline-block;
}
.status-pill.status-ok { background: #DCFCE7; color: #166534; border-color: #BBF7D0; }
.status-pill.status-warn { background: #FEF3C7; color: #92400E; border-color: #FDE68A; }
.status-pill.status-off { background: var(--c-soft); color: var(--c-mid); border-color: var(--c-line-soft); }
.status-pill.status-error { background: #FEE2E2; color: #991B1B; border-color: #FCA5A5; }

/* Info Strip */
.set-info-strip {
  background: var(--c-soft);
  padding: 10px var(--s-3);
  border-radius: 6px;
  font-size: 12px;
  color: var(--c-mid);
  border-left: 3px solid var(--c-accent);
}
.set-info-strip strong { color: var(--c-ink); }

/* Density Toggle Cards */
.set-density-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-3);
}
.set-density-card {
  padding: var(--s-3);
  border: 1px solid var(--c-line);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color .12s ease, background .12s ease;
}
.set-density-card:hover { border-color: var(--c-mid); }
.set-density-card.is-active { border-color: var(--c-accent); background: var(--c-accent-soft); }
.set-density-card input { display: none; }
.set-density-label { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.set-density-desc { font-size: 12px; color: var(--c-mid); }

/* Toggle Switch (iOS-Style) */
.set-toggles { display: flex; flex-direction: column; }
.set-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s-3) 0;
  border-top: 1px solid var(--c-line-soft);
  cursor: pointer;
}
.set-card > .set-toggles > .set-toggle-row:first-of-type { border-top: none; padding-top: 0; }
.set-toggle-meta { flex: 1; }
.set-toggle-label { font-weight: 600; font-size: 14px; margin-bottom: 2px; }
.set-toggle-desc { font-size: 12px; color: var(--c-mid); line-height: 1.5; }
.set-switch {
  width: 36px; height: 20px;
  background: var(--c-line);
  border-radius: 999px;
  position: relative;
  cursor: pointer;
  transition: background .15s ease;
  flex-shrink: 0;
}
.set-switch-knob {
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  background: var(--c-surface);
  border-radius: 50%;
  transition: left .15s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,0.15);
}
.set-switch.is-on { background: var(--c-accent); }
.set-switch.is-on .set-switch-knob { left: 18px; }

/* Skills */
.set-cat-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.set-cat-count {
  margin-left: auto;
  font: 600 10px/1 var(--f-mono);
  background: var(--c-soft);
  padding: 3px 7px;
  border-radius: 99px;
  color: var(--c-mid);
}
.set-skill-list { display: flex; flex-direction: column; }
.set-skill-row {
  display: flex; align-items: center; gap: var(--s-3);
  padding: 10px 0;
  border-top: 1px solid var(--c-line-soft);
}
.set-skill-row:first-child { border-top: none; padding-top: 0; }
.set-skill-info { flex: 1; min-width: 0; }
.set-skill-name { font-weight: 600; font-size: 13px; }
.set-skill-notes { font-size: 11px; color: var(--c-mid); margin-top: 2px; }
.set-skill-bars {
  font: 700 14px/1 var(--f-mono);
  letter-spacing: 1px;
  color: var(--c-accent);
}

/* Empty State */
.set-empty { text-align: center; padding: var(--s-8) var(--s-4); }
.set-empty-icon { width: 40px; height: 40px; margin: 0 auto var(--s-3); color: var(--c-mid); }
.set-empty-icon svg { width: 40px; height: 40px; }
.set-empty h4 { font-size: 16px; margin: 0 0 6px; }
.set-empty p { color: var(--c-mid); font-size: 13px; margin: 0 0 var(--s-3); max-width: 360px; margin-left: auto; margin-right: auto; }
.set-empty-inline {
  padding: var(--s-3);
  background: var(--c-soft);
  border-radius: 6px;
  font-size: 13px;
  color: var(--c-mid);
  display: flex; align-items: center; gap: 8px;
}
.set-empty-inline svg { width: 16px; height: 16px; flex-shrink: 0; }

/* Tables */
.set-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.set-table th {
  text-align: left;
  font: 600 10px/1 var(--f-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--c-mid);
  padding: 10px 8px;
  border-bottom: 1px solid var(--c-line);
}
.set-table td {
  padding: 12px 8px;
  border-bottom: 1px solid var(--c-line-soft);
  vertical-align: middle;
}
.set-table tr:last-child td { border-bottom: none; }
.set-table tr.is-inactive { opacity: 0.5; }

.set-user-cell { display: flex; align-items: center; gap: 10px; }
.set-user-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--c-soft);
  color: var(--c-ink);
  display: flex; align-items: center; justify-content: center;
  font: 700 10px/1 var(--f-mono);
}
.set-user-name { font-weight: 600; font-size: 13px; }
.set-user-mail { font-size: 11px; color: var(--c-mid); }

/* Role Grid */
.set-role-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--s-3);
}
.set-role-card {
  padding: var(--s-3);
  background: var(--c-surface);
  border-radius: 6px;
  border: 1px solid var(--c-line-soft);
}
.set-role-badge {
  display: inline-block;
  font: 600 10px/1 var(--f-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 4px 8px;
  border-radius: 99px;
  margin-bottom: 8px;
}
.set-role-badge.admin { background: #FEE2E2; color: #991B1B; }
.set-role-badge.agent { background: #DBEAFE; color: #1E40AF; }
.set-role-badge.external { background: #F3F4F6; color: #4B5563; }
.set-role-card p { font-size: 12px; color: var(--c-mid); margin: 0; line-height: 1.5; }

/* Briefkopf Preview */
.set-letterhead-preview {
  display: flex;
  gap: var(--s-5);
  padding: var(--s-5);
  background: #fff;
  border: 1px dashed var(--c-line);
  border-radius: 6px;
  align-items: flex-start;
  color: #1A1A1A;
}
.set-letterhead-logo { width: 80px; height: 80px; object-fit: contain; }
.set-letterhead-text { flex: 1; }
.set-letterhead-name { font-weight: 700; font-size: 16px; margin-bottom: 8px; }
.set-letterhead-addr { font: 400 12px/1.5 inherit; white-space: pre-wrap; margin: 0 0 6px; color: #444; }
.set-letterhead-contact { font: 500 12px/1 var(--f-mono); color: var(--c-mid); }

/* Integration Cards */
.set-integration-list { display: flex; flex-direction: column; }
.set-integration-row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) 0;
  border-top: 1px solid var(--c-line-soft);
}
.set-card > .set-integration-list > .set-integration-row:first-of-type { border-top: none; padding-top: 0; }
.set-integration-meta { flex: 1; min-width: 0; }
.set-integration-name {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 2px;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.set-integration-desc { font-size: 12px; color: var(--c-mid); line-height: 1.5; margin-bottom: 4px; }
.set-integration-value { font-size: 11px; color: var(--c-mid); margin-top: 4px; }
.set-integration-actions { display: flex; gap: 6px; flex-shrink: 0; }

.set-coming-soon { display: flex; flex-direction: column; }
.set-coming-soon-item {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) 0;
  border-top: 1px solid var(--c-line-soft);
}
.set-card > .set-coming-soon > .set-coming-soon-item:first-of-type { border-top: none; padding-top: 0; }
.set-coming-soon-name { font-weight: 600; font-size: 14px; }
.set-coming-soon-desc { font-size: 12px; color: var(--c-mid); flex: 1; }

/* Taxonomy Grid */
.set-tax-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--s-3);
}
.set-tax-cat {
  padding: var(--s-3);
  background: var(--c-soft);
  border-radius: 6px;
  border: 1px solid var(--c-line-soft);
}
.set-tax-cat-h {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px;
  margin-bottom: var(--s-2);
  padding-bottom: var(--s-2);
  border-bottom: 1px solid var(--c-line-soft);
}
.set-tax-skills { display: flex; flex-direction: column; gap: 4px; }
.set-tax-skill {
  display: flex; justify-content: space-between;
  font-size: 12px;
  padding: 3px 0;
}

/* Gap Pills */
.gap-pill {
  font: 600 10px/1 var(--f-mono);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 8px;
  border-radius: 99px;
}
.gap-pill.critical { background: #FEE2E2; color: #991B1B; }
.gap-pill.warn { background: #FEF3C7; color: #92400E; }

/* Stats Grid (Backup, Health) */
.set-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--s-3);
  margin-bottom: var(--s-4);
}
.set-stat-card {
  background: var(--c-surface);
  border: 1px solid var(--c-line-soft);
  border-radius: 10px;
  padding: var(--s-4);
}
.set-stat-label {
  font: 600 10px/1 var(--f-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--c-mid);
  margin-bottom: 8px;
}
.set-stat-value {
  font: 700 24px/1.1 var(--f-display, var(--f-body));
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}
.set-stat-value-small { font-size: 16px; }
.set-stat-unit { font-size: 13px; color: var(--c-mid); font-weight: 500; }
.set-stat-sub { font-size: 11px; color: var(--c-mid); line-height: 1.4; }

/* Backup Reason Pills */
.backup-reason {
  font: 500 10px/1 var(--f-mono);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 7px;
  border-radius: 4px;
  background: var(--c-soft);
}
.backup-reason-scheduled { background: #DBEAFE; color: #1E40AF; }
.backup-reason-pre-migrate { background: #FEF3C7; color: #92400E; }
.backup-reason-manual { background: #DCFCE7; color: #166534; }
.backup-reason-startup { background: #F3F4F6; color: #4B5563; }

/* Danger Zone */
.set-danger-card { border-color: #FCA5A5; background: #FEF2F2; }
.set-danger-row {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  padding: var(--s-3) 0;
  border-top: 1px solid #FCA5A5;
}
.set-danger-card > .set-danger-row:first-of-type { border-top: none; padding-top: 0; }
.set-danger-meta { flex: 1; }
.set-danger-title { font-weight: 700; color: #991B1B; font-size: 14px; margin-bottom: 2px; }
.set-danger-desc { font-size: 12px; color: #7F1D1D; line-height: 1.5; }

.set-readonly {
  padding: 10px 12px;
  background: var(--c-soft);
  border: 1px solid var(--c-line-soft);
  border-radius: 6px;
  font-size: 14px;
}

/* Density-Aware (für Compact-Mode) */
:root[data-density="compact"] .set-card { padding: var(--s-3) var(--s-4); margin-bottom: var(--s-3); }
:root[data-density="compact"] .set-form-row input,
:root[data-density="compact"] .set-form-row select { padding: 7px 10px; }
:root[data-density="compact"] .set-table td { padding: 8px; }

/* ── AI-Brain Dashboard (E7) ────────────────────────────────── */
.ai-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--s-3);
  margin-bottom: var(--s-3);
}
.ai-kpi-card { padding: var(--s-3); }
.kpi-label {
  font: 600 11px/1 var(--f-mono);
  text-transform: uppercase; letter-spacing: .05em;
  color: var(--c-mid);
  margin-bottom: var(--s-2);
}
.kpi-value {
  font: 700 28px/1 var(--f-sans);
  margin-bottom: var(--s-2);
}
.kpi-unit { font-size: 14px; color: var(--c-mid); font-weight: 500; }
.kpi-big {
  font: 700 36px/1 var(--f-sans);
  margin-bottom: var(--s-2);
}
.budget-bar {
  height: 6px;
  background: var(--c-border);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 4px;
}
.budget-bar-fill {
  height: 100%;
  background: #7da896;
  transition: width .3s ease;
}
.budget-bar.warn .budget-bar-fill { background: #e8b86b; }
.budget-bar.danger .budget-bar-fill { background: #f87171; }

.ai-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-3);
  margin-bottom: var(--s-3);
}
@media (max-width: 800px) { .ai-row-2 { grid-template-columns: 1fr; } }

.card-h3 {
  font: 600 14px/1 var(--f-sans);
  margin-bottom: var(--s-2);
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--c-mid);
}
.ai-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.ai-table th {
  text-align: left;
  font: 600 10px/1.5 var(--f-mono);
  text-transform: uppercase; letter-spacing: .05em;
  color: var(--c-mid);
  padding: 6px 8px;
  border-bottom: 1px solid var(--c-border);
}
.ai-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--c-border);
}
.ai-table tr:last-child td { border-bottom: none; }

/* ── Knowledge-Base (E5) ────────────────────────────────────── */
.kb-search-card { padding: var(--s-3); margin-bottom: var(--s-4); }
.kb-search-row {
  display: flex; gap: var(--s-2); align-items: center; flex-wrap: wrap;
}
.kb-search-input {
  flex: 1; min-width: 240px;
  padding: var(--s-2) var(--s-3);
  border: 1px solid var(--c-border);
  background: var(--c-surface);
  font: inherit;
}
.kb-type-filter {
  padding: var(--s-2);
  border: 1px solid var(--c-border);
  background: var(--c-surface);
  font: inherit;
}
.kb-list { display: grid; gap: var(--s-3); }
.kb-entry {
  cursor: pointer;
  transition: transform .1s ease, box-shadow .1s ease;
}
.kb-entry:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,.06); }
.kb-entry-head { display: flex; align-items: center; gap: var(--s-2); margin-bottom: var(--s-2); }
.kb-type-pill {
  font: 600 10px/1 var(--f-mono);
  text-transform: uppercase; letter-spacing: .05em;
  padding: 4px 8px; border-radius: 99px;
}
.kb-score {
  font: 700 11px/1 var(--f-mono);
  color: var(--c-accent);
}
.kb-source-link { font-size: 11px; }
.kb-entry-title { margin: 0 0 var(--s-1); font-size: 16px; }
.kb-entry-snippet { color: var(--c-mid); margin: 0 0 var(--s-2); line-height: 1.5; font-size: 14px; }
.kb-entry-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.kb-tag {
  font: 500 10px/1 var(--f-mono);
  padding: 3px 7px;
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: 99px;
}
.kb-view-meta { display: flex; gap: var(--s-2); align-items: center; margin-bottom: var(--s-3); }
.kb-view-content {
  white-space: pre-wrap; line-height: 1.6;
  padding: var(--s-3); background: var(--c-bg);
  border-left: 3px solid var(--c-accent);
  margin-bottom: var(--s-3);
}
.kb-view-tags { display: flex; flex-wrap: wrap; gap: 6px; }

/* ── Multi-Betreuer Avatare ─────────────────────────────────── */
.task-avatars {
  display: inline-flex; align-items: center;
  margin-left: var(--s-2);
}
.avatar {
  width: 22px; height: 22px;
  background: var(--c-mid);
  color: var(--c-surface);
  font-family: var(--f-mono);
  font-size: 9px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  border: 2px solid var(--c-surface);
  margin-left: -6px;
  border-radius: 50%;
  z-index: 1;
}
.avatar:first-child { margin-left: 0; }
.avatar.avatar-lead { background: var(--c-accent); z-index: 5; }
.avatar.avatar-collab { background: var(--c-kunden); }

/* ── AI-Wizard Chat (Schritt 2) ───────────────────────────── */
.wiz-chat {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: var(--s-3) 0;
  max-height: 56vh;
  overflow-y: auto;
}
.wiz-msg {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  animation: wiz-msg-in .25s ease both;
}
@keyframes wiz-msg-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.wiz-msg-user { flex-direction: row-reverse; }
.wiz-msg-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font: 700 10px/1 var(--f-mono);
  letter-spacing: 0.04em;
  background: var(--c-soft);
  color: var(--c-mid);
  border: 1px solid var(--c-line-soft);
}
.wiz-msg-ai .wiz-msg-avatar {
  background: var(--c-ink);
  color: var(--c-surface);
  border-color: var(--c-ink);
}
.wiz-msg-user .wiz-msg-avatar {
  background: var(--c-accent-soft);
  color: var(--c-accent);
  border-color: var(--c-accent);
}
.wiz-msg-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  background: var(--c-soft);
  max-width: 78%;
  font-size: 14px;
  line-height: 1.55;
  border: 1px solid var(--c-line-soft);
}
.wiz-msg-user .wiz-msg-bubble {
  background: var(--c-accent-soft);
  border-color: var(--c-accent-soft);
  border-bottom-right-radius: 4px;
}
.wiz-msg-ai .wiz-msg-bubble {
  border-bottom-left-radius: 4px;
}
.wiz-msg-label {
  font: 600 10px/1 var(--f-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--c-mid);
  margin-bottom: 6px;
}
.wiz-msg-text { white-space: pre-wrap; word-break: break-word; }
.wiz-msg-why {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed var(--c-line-soft);
  font-size: 11px;
  color: var(--c-mid);
  font-style: italic;
}
.wiz-q-num {
  display: inline-block;
  font: 600 11px/1 var(--f-mono);
  color: var(--c-accent);
  margin-right: 6px;
}

/* User-Input-Bubble (Textarea oder Quick-Replies) */
.wiz-msg-user-input .wiz-msg-bubble-input {
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  padding: 8px 10px;
  max-width: 100%;
  width: 78%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.wiz-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.wiz-chip {
  font: 500 12px/1 inherit;
  padding: 5px 10px;
  background: var(--c-soft);
  border: 1px solid var(--c-line);
  border-radius: 999px;
  cursor: pointer;
  color: var(--c-ink);
  transition: background .12s ease, border-color .12s ease, color .12s ease;
}
.wiz-chip:hover { background: var(--c-line-soft); }
.wiz-chip.is-active {
  background: var(--c-accent);
  color: var(--c-surface);
  border-color: var(--c-accent);
}
.wiz-msg-input {
  width: 100%;
  background: transparent;
  border: none;
  font: inherit;
  font-size: 13px;
  color: var(--c-ink);
  resize: none;
  outline: none;
  padding: 4px 0;
  line-height: 1.5;
  min-height: 22px;
}
.wiz-msg-input-single { padding: 6px 8px; }
.wiz-msg-input::placeholder { color: var(--c-mid-soft); }

/* Extras: Free-Text Zusatzkontext */
.wiz-extras {
  margin-top: var(--s-3);
  border: 1px solid var(--c-line);
  border-radius: 10px;
  padding: var(--s-3);
  background: var(--c-surface);
}
.wiz-extras-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font: 600 11px/1 var(--f-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--c-mid);
  margin-bottom: 8px;
}
.wiz-extras-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--c-accent-soft);
  color: var(--c-accent);
  font-weight: 700;
  font-size: 13px;
}
.wiz-extras-hint { font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--c-mid-soft); }
.wiz-extras-input {
  width: 100%;
  background: var(--c-soft);
  border: 1px solid var(--c-line-soft);
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
  font-size: 13px;
  color: var(--c-ink);
  resize: none;
  line-height: 1.55;
  min-height: 60px;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.wiz-extras-input:focus {
  outline: none;
  border-color: var(--c-accent);
  box-shadow: 0 0 0 3px var(--c-accent-soft);
}

/* ── AI-Wizard ──────────────────────────────────────────────── */
.wizard-stepper {
  display: flex; gap: var(--s-1);
  background: var(--c-soft); padding: var(--s-2);
  margin-bottom: var(--s-4);
  border: 1px solid var(--c-line-soft);
}
.wizard-step {
  flex: 1; padding: var(--s-2) var(--s-3);
  font-family: var(--f-mono); font-size: 10px; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--c-mid); border-bottom: 2px solid transparent;
}
.wizard-step.is-done { color: var(--c-kunden); border-bottom-color: var(--c-kunden); }
.wizard-step.is-current { color: var(--c-accent); border-bottom-color: var(--c-accent); }

.wizard-task-row {
  padding: var(--s-2) 0;
  border-bottom: 1px dashed var(--c-line-soft);
  font-size: 13px;
}
.wizard-task-row:last-child { border-bottom: none; }
.wizard-task-row code {
  font-family: var(--f-mono); font-size: 11px;
  background: var(--c-soft); padding: 1px 4px; margin-right: 2px;
}

.wizard-spinner {
  display: inline-block;
  animation: wizard-rotate 2s linear infinite;
}
@keyframes wizard-rotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.phase-card-preview {
  border-left: 3px solid var(--c-accent);
  margin-bottom: var(--s-3);
}

/* ── Skill-System (Mein Skillkasten + Taxonomie) ────────────── */
.skill-list { display: flex; flex-direction: column; }
.skill-row {
  display: grid;
  grid-template-columns: 1fr 220px 80px;
  gap: var(--s-3);
  padding: var(--s-3) 0;
  border-bottom: 1px solid var(--c-line-soft);
  align-items: center;
}
.skill-row:last-child { border-bottom: none; }
.skill-row.no-prefer { opacity: 0.6; }
.skill-row-name strong { font-size: 14px; }
.skill-row-level { display: flex; flex-direction: column; gap: 2px; align-items: flex-start; }
.skill-bars { font-family: monospace; font-size: 14px; letter-spacing: 1px; color: var(--c-accent); }
.skill-bars[data-level="1"] { color: var(--c-mid); }
.skill-bars[data-level="2"] { color: var(--c-warning); }
.skill-bars[data-level="3"] { color: var(--c-tools); }
.skill-bars[data-level="4"] { color: var(--c-kunden); }
.skill-bars[data-level="5"] { color: var(--c-accent); }
.skill-row-actions { display: flex; gap: 4px; justify-content: flex-end; }
@media (max-width: 768px) {
  .skill-row { grid-template-columns: 1fr; gap: var(--s-2); }
  .skill-row-actions { justify-content: flex-start; }
}

/* ── User-Management ────────────────────────────────────────── */
tr.is-inactive td { opacity: 0.55; }
tr.is-inactive td:first-child { border-left: 3px solid var(--c-mid); padding-left: calc(var(--s-4) - 3px); }

/* ── Dashboard-Cockpit ──────────────────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--s-4);
}
@media (max-width: 1024px) {
  .dashboard-grid { grid-template-columns: 1fr; }
}

.dash-tasks, .dash-projects { display: flex; flex-direction: column; }
.dash-row {
  display: flex; gap: var(--s-3); align-items: flex-start;
  padding: var(--s-2) 0;
  border-bottom: 1px solid var(--c-line-soft);
  cursor: pointer;
}
.dash-row:last-child { border-bottom: none; }
.dash-row:hover { background: var(--c-soft); }
.dash-row-icon {
  width: 28px; height: 28px;
  background: var(--c-line);
  color: var(--c-ink);
  font-family: var(--f-mono);
  font-weight: 700; font-size: 11px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.dash-row-icon.is-overdue { background: var(--c-danger); color: #fff; }
.dash-row-icon.project { color: #fff; font-size: 10px; }
.dash-row-body { flex: 1; min-width: 0; }
.dash-row-body strong { display: block; font-size: 13px; }

/* ── Workflow-Board ─────────────────────────────────────────── */

.workflow-cols {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--s-3);
}
@media (max-width: 1024px) {
  .workflow-cols { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .workflow-cols { grid-template-columns: 1fr; }
}
.workflow-col {
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  min-height: 200px;
  display: flex; flex-direction: column;
}
.workflow-col-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: var(--s-3);
  border-top: 4px solid var(--c-ink);
  border-bottom: 1px solid var(--c-line);
  background: var(--c-soft);
  font-size: 13px;
}
.workflow-cards {
  flex: 1;
  padding: var(--s-2);
  display: flex; flex-direction: column; gap: var(--s-2);
}
.workflow-card {
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-left: 3px solid var(--area-color, var(--c-mid));
  padding: var(--s-3);
  cursor: pointer;
  transition: box-shadow 0.1s, transform 0.1s;
  display: flex; flex-direction: column; gap: 4px;
}
.workflow-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.08); transform: translateY(-1px); }
.workflow-card-head { display: flex; justify-content: space-between; align-items: center; }
.workflow-card strong { font-size: 13px; }

/* ── Phasen-Stepper im Projekt-Detail ───────────────────────── */

.phase-stepper {
  display: grid;
  grid-auto-columns: 1fr;
  grid-auto-flow: column;
  gap: var(--s-1);
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  padding: var(--s-3);
  margin-bottom: var(--s-4);
  overflow-x: auto;
}
@media (max-width: 768px) {
  .phase-stepper { grid-auto-flow: row; grid-auto-columns: unset; }
}
.phase-step {
  display: flex; align-items: center; gap: var(--s-2);
  padding: var(--s-2);
  border-left: 3px solid var(--c-line);
  background: var(--c-soft);
  cursor: pointer;
  transition: background 0.1s;
  min-width: 0;
}
.phase-step:hover { background: var(--c-surface); }
.phase-step.is-done { border-left-color: var(--c-kunden); }
.phase-step.is-current { border-left-color: var(--c-accent); background: var(--c-surface); font-weight: 700; }
.phase-step.is-skipped { opacity: 0.4; }

.phase-step-num {
  width: 28px; height: 28px;
  background: var(--c-line);
  color: var(--c-ink);
  font-family: var(--f-mono);
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.phase-step.is-done .phase-step-num { background: var(--c-kunden); color: #fff; }
.phase-step.is-current .phase-step-num { background: var(--c-accent); color: #fff; }
.phase-step-info { min-width: 0; flex: 1; }
.phase-step-info strong {
  display: block; font-size: 12px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Phase-Card im Detail */
.phase-card { position: relative; }
.phase-card.phase-done { opacity: 0.7; }
.phase-card.phase-in_progress { border-left: 4px solid var(--c-accent); padding-left: calc(var(--s-5) - 4px); }
.phase-card.phase-pending .phase-tasks { opacity: 0.6; }
.phase-tasks { display: flex; flex-direction: column; margin-bottom: var(--s-3); }

/* ── Service-Katalog ────────────────────────────────────────── */

.service-areas { display: flex; flex-direction: column; gap: var(--s-5); }

.service-area {
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-top: 4px solid var(--area-color, var(--c-ink));
}
.service-area-header {
  display: grid;
  grid-template-columns: 60px 1fr auto;
  gap: var(--s-3);
  padding: var(--s-4) var(--s-5);
  align-items: center;
  border-bottom: 1px solid var(--c-line);
  background: var(--c-soft);
}
.service-area-code {
  font-family: var(--f-mono);
  font-size: 28px;
  font-weight: 800;
  color: var(--area-color, var(--c-ink));
  letter-spacing: -0.03em;
}
.service-area-name {
  font-family: var(--f-display);
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -0.02em;
  color: var(--c-ink);
  margin: 0;
}
.service-area-desc { font-size: 13px; color: var(--c-mid); margin-top: 2px; }
.service-area-count {
  font-family: var(--f-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--c-mid);
}

.service-list { display: flex; flex-direction: column; }
.service-item {
  padding: var(--s-3) var(--s-5);
  border-bottom: 1px solid var(--c-line-soft);
  cursor: pointer;
  transition: background 0.1s;
}
.service-item:last-child { border-bottom: none; }
.service-item:hover { background: var(--c-soft); }
.service-item-head { display: flex; align-items: center; gap: var(--s-2); margin-bottom: 2px; flex-wrap: wrap; }
.service-item-code {
  font-family: var(--f-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--area-color, var(--c-ink));
  background: var(--c-soft);
  padding: 2px 6px;
  min-width: 30px;
  text-align: center;
}
.service-item-name { font-size: 14px; color: var(--c-ink); }
.service-item-meta { font-size: 11px; color: var(--c-mid); padding-left: 38px; }

/* Phasen-Template-Anzeige */
.phase-template { display: flex; flex-direction: column; }
.phase-template-row {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: var(--s-3);
  padding: var(--s-3) 0;
  border-bottom: 1px solid var(--c-line-soft);
  align-items: center;
}
.phase-template-row:last-child { border-bottom: none; }
.phase-num {
  font-family: var(--f-mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--c-accent);
  background: var(--c-soft);
  padding: 4px 0;
  text-align: center;
}
.phase-info strong { font-size: 14px; }
.phase-days {
  font-size: 12px;
  color: var(--c-mid);
  background: var(--c-soft);
  padding: 2px 8px;
}

/* Was-wir-liefern Liste */
.deliverables-list {
  list-style: none;
  padding: 0;
}
.deliverables-list li {
  padding: var(--s-2) 0;
  padding-left: var(--s-4);
  border-bottom: 1px solid var(--c-line-soft);
  position: relative;
  font-size: 13px;
}
.deliverables-list li:last-child { border-bottom: none; }
.deliverables-list li::before {
  content: '—';
  position: absolute;
  left: 0;
  color: var(--c-accent);
  font-weight: 700;
}

/* ── Settings ───────────────────────────────────────────────── */
.settings-list { display: flex; flex-direction: column; gap: 0; }
.setting-row {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: var(--s-4);
  padding: var(--s-3) 0;
  border-bottom: 1px solid var(--c-line-soft);
  align-items: center;
}
.setting-row:last-child { border-bottom: none; }
.setting-key {
  display: flex; align-items: center; gap: var(--s-2);
  margin-bottom: 2px;
}
.setting-key code {
  font-family: var(--f-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--c-ink);
  background: var(--c-soft);
  padding: 2px 6px;
}
.setting-desc { font-size: 13px; color: var(--c-mid); margin-bottom: 2px; }
.setting-updated { font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; }
.setting-value {
  display: flex; gap: var(--s-2); align-items: center;
}
.setting-value input[type="text"], .setting-value select {
  flex: 1;
  padding: 6px 8px;
  border: 1px solid var(--c-line);
  font-family: var(--f-mono);
  font-size: 13px;
  background: var(--c-surface);
  border-radius: 0;
}
.setting-value input[type="text"]:focus { outline: none; border-color: var(--c-ink); }

@media (max-width: 768px) {
  .setting-row { grid-template-columns: 1fr; gap: var(--s-2); }
}

/* ═══════════════════════════════════════════════════════════════
   MOBILE / RESPONSIVE  —  Mobile-first additive Overrides
   Bestehende Desktop-Styles werden NICHT verändert.
   ═══════════════════════════════════════════════════════════════ */

/* ── Sidebar-Toggle (Hamburger) — default versteckt ─────────── */

.sidebar-toggle {
  display: none;
  width: 36px; height: 36px;
  flex-direction: column; justify-content: center; align-items: center;
  gap: 4px;
  background: transparent;
  border: 1px solid var(--c-mid);
  color: var(--c-surface);
  padding: 0;
  margin-right: var(--s-3);
  cursor: pointer;
  flex-shrink: 0;
}
.sidebar-toggle span {
  display: block;
  width: 18px; height: 2px;
  background: var(--c-surface);
  transition: transform 0.2s, opacity 0.2s;
}
body.sidebar-open .sidebar-toggle span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
body.sidebar-open .sidebar-toggle span:nth-child(2) { opacity: 0; }
body.sidebar-open .sidebar-toggle span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* Backdrop — default unsichtbar */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: var(--topbar-height) 0 0 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 80;
}

/* ── TABLET ≤ 1024px ─────────────────────────────────────────── */

@media (max-width: 1024px) {
  .main { padding: var(--s-5); }
  .section-header h1 { font-size: 24px; }

  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--s-3);
  }
  .stat { padding: var(--s-4); }
  .stat .stat-value { font-size: 24px; }

  .project-grid { gap: var(--s-3); }
}

/* ── PHONE ≤ 768px ───────────────────────────────────────────── */

@media (max-width: 768px) {

  /* Body-Padding zur Topbar */
  html, body { font-size: 14px; }

  /* App-Layout: keine Spalten mehr, Sidebar wird Overlay */
  .app.is-active {
    grid-template-columns: 1fr;
    grid-template-rows: var(--topbar-height) 1fr;
  }

  /* Topbar — kompakter */
  .topbar { padding: 0 var(--s-3); gap: var(--s-2); position: sticky; top: 0; z-index: 90; }
  .sidebar-toggle { display: inline-flex; }

  .topbar .brand img { height: 24px; }
  .topbar .brand .name { font-size: 14px; }
  .topbar .brand .sub { display: none; }

  .topbar .user { display: none; }                /* "Eingeloggt als …" weg */
  .topbar .role-badge { margin-left: 0; font-size: 9px; padding: 2px 6px; }
  .topbar .logout-btn { padding: 4px 8px; font-size: 10px; }

  /* Sidebar — als Drawer (off-screen) */
  .sidebar {
    position: fixed;
    top: var(--topbar-height);
    left: 0;
    bottom: 0;
    width: clamp(240px, 88vw, 300px);
    max-width: none;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 100;
    box-shadow: 2px 0 12px rgba(0,0,0,0.1);
  }
  body.sidebar-open .sidebar { transform: translateX(0); }
  body.sidebar-open .sidebar-backdrop { display: block; }

  /* Main — kompakter */
  .main { padding: var(--s-4); grid-column: 1 / -1; }

  .section-header {
    flex-direction: column;
    align-items: stretch;
    gap: var(--s-3);
  }
  .section-header h1 { font-size: 20px; letter-spacing: -0.02em; }
  .section-header .subtitle { font-size: 10px; }
  .section-header .header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s-2);
  }
  .section-header .header-actions .btn { flex: 1; min-width: 0; }

  /* Stats: 1-2 Spalten je nach Breite */
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: var(--s-2); }
  .stat { padding: var(--s-3); border-left-width: 3px; }
  .stat .stat-value { font-size: 22px; }
  .stat .stat-label { font-size: 9px; }

  /* Cards */
  .card { padding: var(--s-4); }
  .card-header h3 { font-size: 13px; }

  /* Detail-Grid stapelt schon ab 1100px */
  .detail-row { grid-template-columns: 110px 1fr; gap: var(--s-2); }
  .detail-row .detail-label { font-size: 9px; }
  .detail-row .detail-value { font-size: 13px; }

  /* Form-Grid: 1 Spalte */
  .form-grid {
    grid-template-columns: 1fr;
    gap: var(--s-3);
  }
  .form-grid .field.span-2 { grid-column: 1; }

  /* Modal — fast Vollbild */
  .modal .modal-dialog {
    width: 96vw;
    max-width: 96vw;
    max-height: 92vh;
    top: 50%;
    transform: translate(-50%, -50%);
  }
  .modal .modal-head { padding: var(--s-3) var(--s-4); }
  .modal .modal-head h3 { font-size: 14px; }
  .modal .modal-body { padding: var(--s-4); }
  .modal .modal-foot { padding: var(--s-3) var(--s-4); }

  /* Tabellen: scrollbar + kompakter */
  th, td { padding: var(--s-2) var(--s-3); font-size: 12px; }
  table.clickable tbody tr:hover td:first-child { padding-left: calc(var(--s-3) - 3px); }
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .badge { font-size: 9px; padding: 2px 6px; }

  /* Project-Grid: 1 Spalte */
  .project-grid { grid-template-columns: 1fr; }

  /* Kanban: kompakter + Touch-Target-Kartenhöhe */
  .kanban-board { grid-auto-columns: 240px; }
  .kanban-col { min-height: 240px; }
  .kanban-card { min-height: 48px; }

  /* Login — etwas kleiner */
  .login .login-card {
    width: 92vw;
    max-width: 380px;
    padding: var(--s-6);
  }

  /* Tool-Cards */
  .tools-grid { grid-template-columns: 1fr; }

  /* Workflow-Stepper: kompakter */
  .workflow-step { padding: var(--s-1) var(--s-2); font-size: 12px; }
  .workflow-step .step-dot { width: 10px; height: 10px; }

  /* Baustellen-Banner */
  .baustelle-content { padding: var(--s-5); }
  .baustelle-content .icon { font-size: 32px; }
  .baustelle-content h2 { font-size: 18px; }
}

/* ═══════════════════════════════════════════════════════════════
   PRINT-STYLES — saubere Druck-Ausgabe für Briefings + Checklisten
   ═══════════════════════════════════════════════════════════════ */

@media print {
  /* App-Layout aufbrechen, nur Hauptinhalt */
  .topbar, .sidebar, .sidebar-toggle, .sidebar-backdrop,
  .header-actions, .modal, .baustelle-banner,
  .nav-link, .nav-section { display: none !important; }

  .app.is-active {
    display: block !important;
    grid-template-columns: 1fr !important;
  }
  .main {
    padding: 0 !important;
    overflow: visible !important;
    background: #fff !important;
  }
  body { background: #fff !important; }

  /* Print-Header (wir injizieren ihn via CSS direkt vor Section-Header) */
  .section-header::before {
    content: 'STRUCTON · Digital Solutions · Briefing';
    display: block;
    font-family: var(--f-mono);
    font-size: 10px;
    letter-spacing: 0.2em;
    color: #888;
    text-transform: uppercase;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #000;
  }

  .section-header {
    page-break-after: avoid;
    flex-direction: column !important;
    align-items: stretch !important;
  }
  .section-header h1 {
    font-size: 24px !important;
    color: #000 !important;
  }
  .section-header .subtitle {
    font-size: 11px !important;
  }

  .breadcrumb { display: none !important; }

  /* Inhalte fließend, Hintergründe weg */
  .card, .detail-grid {
    background: #fff !important;
    border: 1px solid #ccc !important;
    page-break-inside: avoid;
    box-shadow: none !important;
  }
  .detail-grid { display: block !important; }
  .detail-main, .detail-aside { display: block !important; }
  .detail-aside { margin-top: var(--s-4); }

  .card { margin-bottom: 12px; padding: 12px !important; }
  .card-header { margin-bottom: 8px; padding-bottom: 6px; }
  .card-header h3 { font-size: 13px; color: #000; }

  /* Tabellen */
  table, .table-wrap { background: #fff !important; }
  th { background: #000 !important; color: #fff !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  td { color: #000 !important; }
  table.clickable tbody tr { cursor: default !important; }

  /* Badges */
  .badge {
    background: #f0f0f0 !important;
    color: #000 !important;
    border: 1px solid #ccc !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* Phasen-Stepper als Tabelle drucken */
  .phase-stepper {
    grid-auto-flow: row !important;
    grid-template-columns: 1fr !important;
    border: 1px solid #000 !important;
    padding: 8px !important;
  }
  .phase-step {
    border-left: 3px solid #000 !important;
    background: #f9f9f9 !important;
    page-break-inside: avoid;
  }
  .phase-step.is-current { background: #ffeee8 !important; }
  .phase-step.is-done .phase-step-num { background: #000 !important; }

  /* Phase-Card mit Aufgaben — am wichtigsten für Druck */
  .phase-card { page-break-inside: avoid; }
  .task-item {
    page-break-inside: avoid;
    border-bottom: 1px dashed #999 !important;
  }
  .task-checkbox span {
    border: 2px solid #000 !important;
    background: #fff !important;
  }
  .task-checkbox input:checked + span {
    background: #000 !important;
  }

  /* Deliverables-Liste */
  .deliverables-list li::before {
    color: #000 !important;
  }

  /* Druckbarer Footer pro Seite */
  @page {
    size: A4;
    margin: 15mm 12mm;
  }

  /* Links nicht unterstreichen (im Print stören sie) */
  a { color: #000 !important; text-decoration: none !important; }

  /* Hide-Print-Helper */
  .no-print { display: none !important; }

  /* Login-View nicht drucken */
  .login { display: none !important; }
}

/* ── SMALL PHONE ≤ 380px (extra eng) ───────────────────────── */

@media (max-width: 380px) {
  .stat-grid { grid-template-columns: 1fr; }
  .section-header h1 { font-size: 18px; }
  .topbar .brand .name { font-size: 12px; }
  .topbar .role-badge { display: none; }   /* role-Badge weg, Logout muss bleiben */
}

/* ── Lead Generator ─────────────────────────────────────────── */

.lg-tabs {
  display: flex;
  gap: 2px;
  border-bottom: 2px solid var(--c-border);
  margin-bottom: var(--s-6);
}

.lg-tab {
  background: none;
  border: none;
  padding: var(--s-3) var(--s-5);
  font-family: var(--f-body);
  font-size: 13px;
  font-weight: 600;
  color: var(--c-mid);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
}

.lg-tab:hover { color: var(--c-ink); }
.lg-tab.is-active { color: var(--c-ink); border-bottom-color: var(--c-ink); }

.lg-tab-panel { animation: fadeIn 0.15s ease; }

.lg-hint {
  font-size: 13px;
  color: var(--c-mid);
  margin-bottom: var(--s-4);
  line-height: 1.6;
}

.lg-csv-actions {
  display: flex;
  gap: var(--s-3);
  flex-wrap: wrap;
}

.lg-file-label { cursor: pointer; }

.lg-preview-header {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  margin-bottom: var(--s-4);
}
.lg-preview-header .form-section-title { margin-bottom: 0; }

.lg-preview-table { font-size: 12px; }
.lg-preview-table th,
.lg-preview-table td { padding: var(--s-2) var(--s-3); white-space: nowrap; }

.lg-result {
  margin-top: var(--s-5);
  padding: var(--s-5);
  border-radius: 0;
  border: 1px solid var(--c-border);
  background: var(--c-surface);
}

.lg-result.success { border-left: 3px solid #22c55e; }
.lg-result.error   { border-left: 3px solid var(--c-accent); }

.lg-result-header {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  margin-bottom: var(--s-4);
}

.lg-result-icon { font-size: 20px; line-height: 1.2; }

.lg-result-header strong { font-size: 15px; font-weight: 700; display: block; }
.lg-result-sub { font-size: 12px; color: var(--c-mid); font-family: var(--f-mono); margin-top: 2px; }

.lg-score-row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  margin-bottom: var(--s-4);
  font-size: 13px;
}

.lg-score-bar-wrap {
  flex: 1;
  height: 6px;
  background: var(--c-border);
  border-radius: 3px;
  overflow: hidden;
}

.lg-score-bar {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
}

.lg-result-actions { display: flex; gap: var(--s-3); flex-wrap: wrap; }

.lg-errors {
  font-size: 12px;
  color: var(--c-mid);
  margin-bottom: var(--s-4);
}
.lg-errors summary { cursor: pointer; font-weight: 600; margin-bottom: var(--s-2); }
.lg-errors ul { padding-left: var(--s-4); }
.lg-errors li { margin-bottom: 2px; font-family: var(--f-mono); }

.osm-table-actions {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  margin-bottom: var(--s-3);
  font-size: 13px;
}

.osm-check-all {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  cursor: pointer;
  font-weight: 600;
}

.osm-check-all input { cursor: pointer; }

/* OSM Ergebnis-Tabelle */
.osm-results-table th,
.osm-results-table td { vertical-align: top; padding: var(--s-2) var(--s-3); }

.osm-row-qualified { background: rgba(34,197,94,0.04); }

.osm-score-cell { display: flex; align-items: baseline; gap: 2px; white-space: nowrap; }
.osm-score-num  { font-family: var(--f-mono); font-weight: 700; font-size: 15px; }
.osm-score-max  { font-family: var(--f-mono); font-size: 10px; color: var(--c-mid); }
.osm-qualified-dot { color: #22c55e; font-size: 10px; margin-left: 2px; }

.osm-desc { font-size: 11px; color: var(--c-mid); margin-top: 2px; }
.osm-small { font-size: 11px; }

.osm-pains { display: flex; flex-direction: column; gap: 3px; }
.osm-pain-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  background: rgba(220,38,38,0.08);
  color: var(--c-accent);
  border: 1px solid rgba(220,38,38,0.2);
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

.osm-missing-tag {
  display: inline-block;
  font-size: 10px;
  padding: 1px 5px;
  background: var(--c-soft);
  color: var(--c-mid);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-pill);
  margin: 1px 1px 0 0;
  white-space: nowrap;
}

@media (max-width: 600px) {
  .lg-csv-actions { flex-direction: column; }
  .lg-result-actions { flex-direction: column; }
}

/* ═══════════════════════════════════════════════════════════════
   WP2 — Responsiveness ab 320 px (Spot-Fixes)
   ─────────────────────────────────────────────────────────────── */

/* 320-px-Safety: inputs/selects ohne harten min-width-Crash */
@media (max-width: 600px) {
  /* Search-Inputs hatten min-width: 240px — auf Mobile auf 100% Container */
  .kb-search-input,
  .wiz-extras-input,
  input[type="text"]:not([style*="width"]),
  input[type="email"]:not([style*="width"]),
  input[type="search"]:not([style*="width"]) {
    min-width: 0;
    width: 100%;
  }

  /* Modal-Dialog passt auf 320px ohne horizontalen Overflow */
  .modal-dialog {
    max-width: calc(100vw - 24px) !important;
    width: calc(100vw - 24px);
    margin: 12px auto;
    padding: var(--s-3);
  }
  .modal-body, .modal-head, .modal-foot { padding-left: var(--s-3); padding-right: var(--s-3); }

  /* Form-Grids stapeln strikt 1-spaltig */
  .form-grid {
    grid-template-columns: 1fr !important;
  }
  .form-grid .field.span-2 { grid-column: 1; }

  /* Section-Header H1 etwas kleiner */
  .section-header h1 { font-size: 22px; }

  /* Section-Header Actions: volle Breite-Wrap */
  .section-header .header-actions {
    width: 100%;
    justify-content: flex-start;
  }
  .section-header .header-actions .btn,
  .section-header .header-actions button { flex: 1 1 auto; min-width: 0; }

  /* Topbar Brand: nur Mini-Logo, kein Sub-Text */
  .topbar .brand .sub { display: none; }
}

/* Tablet-Bereich: Detail-Grids stapeln früher */
@media (max-width: 900px) {
  .detail-grid { grid-template-columns: 1fr !important; }
  .ai-row-2 { grid-template-columns: 1fr !important; }
}

/* Global: Tabellen ohne table-wrap kommen wenigstens nicht ungebremst raus */
table {
  max-width: 100%;
  table-layout: auto;
}
.table-wrap { -webkit-overflow-scrolling: touch; }

/* Settings-Pane bei sehr schmal: weniger Padding */
@media (max-width: 600px) {
  .settings-pane { padding: var(--s-4) var(--s-3); }
  .settings-nav { padding: var(--s-3) 0 var(--s-4); }
  .settings-shell {
    grid-template-columns: 1fr !important;
    min-height: auto;
  }
  .settings-nav-item { padding: 8px 12px; }
}

/* ═══════════════════════════════════════════════════════════════
   WP3 — Skeleton-Loader + Empty-State Pattern (wiederverwendbar)
   ─────────────────────────────────────────────────────────────── */

/* Skeleton — pulsierender grauer Block mit Shimmer */
.skeleton {
  position: relative;
  background: var(--c-line-soft);
  border-radius: var(--r-sm, 10px);
  overflow: hidden;
  display: block;
}
.skeleton::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.6) 50%,
    transparent 100%);
  animation: skeleton-sweep 1.4s ease-in-out infinite;
}
@keyframes skeleton-sweep {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}
.skeleton.skeleton-text { height: 14px; margin-bottom: 6px; }
.skeleton.skeleton-title { height: 22px; width: 60%; margin-bottom: 12px; }
.skeleton.skeleton-card { height: 120px; }
.skeleton.skeleton-row { height: 38px; margin-bottom: 8px; }

/* Empty-State — Icon + Headline + Sub + optionaler CTA */
.empty-state {
  text-align: center;
  padding: var(--s-8) var(--s-4);
  color: var(--c-mid);
}
.empty-state-icon {
  width: 48px; height: 48px;
  margin: 0 auto var(--s-3);
  color: var(--c-mid-soft);
  display: flex; align-items: center; justify-content: center;
}
.empty-state-icon svg { width: 48px; height: 48px; }
.empty-state h4 {
  font-size: 16px;
  margin: 0 0 6px;
  color: var(--c-ink);
}
.empty-state p {
  font-size: 13px;
  margin: 0 auto var(--s-3);
  max-width: 360px;
  line-height: 1.55;
}

/* Forward — Cards/Modals/Inputs adoptieren globale Tokens */
[data-theme="structon-forward"] .card { border-radius: var(--r-md, 14px); box-shadow: var(--shadow-1); }
[data-theme="structon-forward"] .card:hover { box-shadow: var(--shadow-2); }
[data-theme="structon-forward"] .modal-dialog { border-radius: var(--r-lg, 20px); box-shadow: var(--shadow-3); }
[data-theme="structon-forward"] input:not([type="checkbox"]):not([type="radio"]),
[data-theme="structon-forward"] select,
[data-theme="structon-forward"] textarea { border-radius: var(--r-sm, 10px); }
[data-theme="structon-forward"] .stat-card,
[data-theme="structon-forward"] .set-stat-card { border-radius: var(--r-md, 14px); box-shadow: var(--shadow-1); }

/* ═══════════════════════════════════════════════════════════════
   WP4 — Workflow-Board (Bereichs-Karten + Service-Liste + Phasen)
   ─────────────────────────────────────────────────────────────── */

/* Bereichs-Karten-Grid (Default-Ansicht) */
.wf-area-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--s-4);
}
.wf-area-card {
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-top: 4px solid var(--area-color, var(--c-accent));
  border-radius: var(--r-md, 12px);
  padding: var(--s-5);
  cursor: pointer;
  position: relative;
  transition: transform 220ms cubic-bezier(0.22, 1, 0.36, 1),
              box-shadow 220ms cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: var(--shadow-1, 0 1px 2px rgba(0, 0, 0, 0.04));
}
.wf-area-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-2, 0 8px 24px -8px rgba(0, 0, 0, 0.1));
}
.wf-area-icon {
  width: 28px; height: 28px;
  color: var(--area-color);
  margin-bottom: var(--s-2);
}
.wf-area-icon svg { width: 28px; height: 28px; }
.wf-area-code {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--c-mid);
  margin-bottom: 4px;
}
.wf-area-name {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 var(--s-2);
  color: var(--c-ink);
}
.wf-area-desc {
  font-size: 13px;
  line-height: 1.5;
  color: var(--c-mid);
  margin: 0 0 var(--s-3);
}
.wf-area-stats {
  display: flex;
  gap: var(--s-3);
  padding-top: var(--s-3);
  border-top: 1px solid var(--c-line-soft);
  font-size: 11px;
}
.wf-area-stats strong { color: var(--c-ink); }

/* Service-Karten-Liste (Drill-down nach Klick auf Bereich) */
.wf-service-list {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}
.wf-service-card {
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-left: 4px solid var(--area-color, var(--c-accent));
  border-radius: var(--r-sm, 10px);
  padding: var(--s-4);
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}
.wf-service-card:hover {
  transform: translateX(2px);
  box-shadow: var(--shadow-2, 0 8px 24px -8px rgba(0, 0, 0, 0.1));
}
.wf-service-head {
  display: flex; align-items: center; gap: var(--s-2);
  flex-wrap: wrap;
  margin-bottom: var(--s-2);
}
.wf-service-code {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--c-mid);
  background: var(--c-soft);
  padding: 2px 8px;
  border-radius: var(--r-pill, 999px);
}
.wf-service-name {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--c-ink);
  flex: 1;
  min-width: 0;
}
.wf-service-desc {
  font-size: 13px;
  line-height: 1.5;
  color: var(--c-mid);
  margin: 0 0 var(--s-2);
}
.wf-service-meta {
  display: flex;
  gap: var(--s-3);
  font-size: 11px;
  align-items: center;
}
.wf-service-meta strong { color: var(--c-ink); }
.wf-service-meta .text-mid { margin-left: auto; }

/* Phasen-Schritte (im Service-Detail) */
.wf-phase-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.wf-phase-step {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: var(--s-3);
  padding: var(--s-3) 0;
  border-bottom: 1px solid var(--c-line-soft);
  align-items: start;
}
.wf-phase-step:last-child { border-bottom: none; }
.wf-phase-num {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--c-ink);
  color: var(--c-surface);
  display: flex; align-items: center; justify-content: center;
  font: 700 12px/1 var(--f-mono);
}
.wf-phase-body { flex: 1; min-width: 0; }
.wf-phase-name {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
}
.wf-phase-desc {
  font-size: 13px;
  color: var(--c-mid);
  line-height: 1.55;
  margin-bottom: 4px;
}
.wf-phase-days { font-size: 11px; }

/* Mobile: alles 1-spaltig */
@media (max-width: 600px) {
  .wf-area-grid { grid-template-columns: 1fr; }
  .wf-service-head { gap: var(--s-1); }
  .wf-service-meta { flex-wrap: wrap; }
}

/* ═══════════════════════════════════════════════════════════════
   Tree-View global (Git-Style — Workflow-Board + Service-Katalog)
   ─────────────────────────────────────────────────────────────── */
.tree-root {
  font: 14px/1.5 var(--f-body);
  position: relative;
  padding: var(--s-2) 0;
}
.tree-node {
  position: relative;
}
.tree-children {
  margin-left: 14px;
  padding-left: 12px;
  position: relative;
  border-left: 1px solid var(--c-line);
}
/* Horizontaler Connector pro Row */
.tree-children > .tree-node::before {
  content: '';
  position: absolute;
  left: -12px;
  top: 14px;
  width: 10px;
  height: 1px;
  background: var(--c-line);
}
/* Letzter Knoten: vertikale Linie nur bis zur Höhe der Row */
.tree-children > .tree-node:last-child {
  background: var(--c-surface);  /* Hintergrund "schneidet" die parent border-left ab */
}
.tree-children > .tree-node:last-child::after {
  content: '';
  position: absolute;
  left: -13px;
  top: 14px;
  bottom: 0;
  width: 2px;
  background: var(--c-surface);
}

/* Summary + Leaf-Rows */
.tree-summary, .tree-node-leaf {
  cursor: pointer;
  list-style: none;
  padding: 4px 0;
  user-select: none;
}
.tree-summary::-webkit-details-marker { display: none; }
.tree-summary::marker { content: ''; }
.tree-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border-radius: var(--r-sm, 6px);
  transition: background 120ms ease;
  width: calc(100% - 28px);
  min-width: 0;
}
.tree-row:hover { background: var(--c-soft); }

/* Toggle-Pfeil (▸/▾) vor branch-Knoten */
.tree-node-branch > .tree-summary::before {
  content: '▸';
  display: inline-block;
  width: 16px;
  color: var(--c-mid);
  font-size: 10px;
  text-align: center;
  transition: transform 180ms ease;
  flex-shrink: 0;
}
.tree-node-branch[open] > .tree-summary::before {
  transform: rotate(90deg);
}
.tree-node-leaf::before {
  content: '';
  display: inline-block;
  width: 16px;
  flex-shrink: 0;
}

/* Status-Dots */
.tree-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  font-size: 12px;
  line-height: 1;
}
.tree-dot-full  { color: var(--c-success, #2A8A3F); }
.tree-dot-stub  { color: var(--c-warning, #D4A373); }
.tree-dot-empty { color: var(--c-mid-soft, #9b9b9b); }

/* Label/Subtitle/Meta */
.tree-label {
  font-weight: 500;
  color: var(--c-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 1;
  min-width: 0;
}
.tree-subtitle {
  font-size: 12px;
  color: var(--c-mid);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 1;
}
.tree-meta {
  font-size: 11px;
  color: var(--c-mid);
  margin-left: auto;
  flex-shrink: 0;
  padding-left: 12px;
}
.tree-empty {
  padding: var(--s-5);
  text-align: center;
  color: var(--c-mid);
  font-size: 13px;
}

/* Branch-Label etwas fetter */
.tree-node-branch > .tree-summary .tree-label { font-weight: 600; }

/* Mobile */
@media (max-width: 600px) {
  .tree-children { margin-left: 8px; padding-left: 8px; }
  .tree-meta { display: none; }       /* zu wenig Platz */
}

/* ═══════════════════════════════════════════════════════════════
   Phase-Detail-Modal (Workflow-Knowledge-Editor)
   ─────────────────────────────────────────────────────────────── */
.phase-modal-content {
  max-width: 720px;
  width: calc(100vw - 32px);
}
.phase-modal-tabs {
  display: flex;
  gap: 2px;
  margin-bottom: var(--s-3);
  border-bottom: 1px solid var(--c-line);
}
.phase-modal-tab {
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--c-mid);
  cursor: pointer;
  border: none;
  background: transparent;
  border-bottom: 2px solid transparent;
  font-family: var(--f-mono);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.phase-modal-tab.is-active {
  color: var(--c-ink);
  border-bottom-color: var(--c-accent);
}
.phase-modal-pane { display: none; }
.phase-modal-pane.is-active { display: block; }
.phase-modal-textarea {
  width: 100%;
  min-height: 200px;
  padding: var(--s-3);
  font: 13px/1.55 var(--f-body);
  border: 1px solid var(--c-line);
  border-radius: var(--r-sm, 8px);
  background: var(--c-surface);
  resize: vertical;
}
.phase-modal-textarea.code {
  font-family: var(--f-mono);
  font-size: 12px;
}
.phase-modal-hint {
  font-size: 11px;
  color: var(--c-mid);
  margin-top: 6px;
  line-height: 1.5;
}
.phase-modal-checklist-item {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 6px;
}
.phase-modal-checklist-item input[type="text"] {
  flex: 1;
  padding: 6px 10px;
  font-size: 13px;
  border: 1px solid var(--c-line);
  border-radius: var(--r-xs, 4px);
}
.phase-modal-checklist-add {
  font-size: 12px;
  color: var(--c-accent);
  cursor: pointer;
  background: none;
  border: 1px dashed var(--c-line);
  padding: 6px 12px;
  width: 100%;
  border-radius: var(--r-xs, 4px);
  margin-top: 6px;
}

/* Markdown-Render */
.md-rendered { font-size: 13px; line-height: 1.65; color: var(--c-ink); }
.md-rendered h1, .md-rendered h2, .md-rendered h3 {
  margin: var(--s-3) 0 var(--s-2); font-weight: 700; letter-spacing: -0.01em;
}
.md-rendered h1 { font-size: 18px; }
.md-rendered h2 { font-size: 15px; }
.md-rendered h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--c-mid); }
.md-rendered p { margin: 0 0 var(--s-2); }
.md-rendered ul, .md-rendered ol { margin: 0 0 var(--s-2); padding-left: 20px; }
.md-rendered li { margin-bottom: 3px; }
.md-rendered strong { font-weight: 700; }
.md-rendered em { font-style: italic; }
.md-rendered code {
  font-family: var(--f-mono);
  font-size: 11.5px;
  background: var(--c-soft);
  padding: 1px 5px;
  border-radius: 3px;
}
.md-rendered pre {
  background: var(--c-soft);
  padding: var(--s-3);
  border-radius: var(--r-xs, 4px);
  overflow-x: auto;
  font-family: var(--f-mono);
  font-size: 12px;
  line-height: 1.5;
  margin: var(--s-2) 0;
}
.md-rendered a { color: var(--c-accent); text-decoration: underline; }
.md-rendered .md-empty { color: var(--c-mid); font-style: italic; }

/* ═══════════════════════════════════════════════════════════════
   Workflow-Board V3 — Status-Dots + klickbare Phase-Cards
   ─────────────────────────────────────────────────────────────── */

/* Status-Dots (auch in Cards verwendet) */
.status-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  line-height: 1;
  font-weight: 700;
  width: 14px; height: 14px;
}
.status-dot-full  { color: #16A34A; }      /* grün */
.status-dot-stub  { color: #D97706; }       /* amber */
.status-dot-empty { color: var(--c-mid-soft, #B0B0B6); }

/* Bereichs-Karte Head-Erweiterung (Code + Status-Punkt) */
.wf-area-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--s-2);
}
.wf-area-head .wf-area-code { margin-bottom: 0; }

/* Service-Card: Status rechts oben + Phasen-Punktreihe */
.wf-service-head {
  align-items: flex-start;
}
.wf-service-status {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
}
.wf-phase-dots {
  display: inline-flex;
  gap: 2px;
  margin-right: var(--s-3);
  font-size: 13px;
  letter-spacing: 1px;
}
.wf-phase-dots .status-dot {
  width: 12px; height: 12px;
  font-size: 11px;
}

/* Klickbare Phase-Cards (im Service-Detail) */
.wf-phase-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--s-3);
}
.wf-phase-card {
  position: relative;
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-left: 4px solid var(--c-mid-soft);
  border-radius: var(--r-sm, 10px);
  padding: var(--s-3) var(--s-4);
  cursor: pointer;
  transition: transform 200ms cubic-bezier(0.22, 1, 0.36, 1),
              box-shadow 200ms cubic-bezier(0.22, 1, 0.36, 1),
              border-color 180ms ease;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 130px;
}
.wf-phase-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-2, 0 12px 28px -12px rgba(0, 0, 0, 0.15));
  border-color: var(--c-accent);
}
.wf-phase-card.status-full  { border-left-color: #16A34A; }
.wf-phase-card.status-stub  { border-left-color: #D97706; }
.wf-phase-card.status-empty { border-left-color: var(--c-mid-soft); }

.wf-phase-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.wf-phase-num {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--c-ink);
  color: var(--c-surface);
  display: flex; align-items: center; justify-content: center;
  font: 700 11px/1 var(--f-mono);
}
.wf-phase-card-body { flex: 1; }
.wf-phase-name {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
  letter-spacing: -0.01em;
}
.wf-phase-desc {
  font-size: 12px;
  line-height: 1.5;
  color: var(--c-mid);
}
.wf-phase-card-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding-top: var(--s-2);
  border-top: 1px solid var(--c-line-soft);
  font-size: 10px;
}
.wf-phase-tag {
  font: 600 9px/1 var(--f-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--c-accent-soft, #FCEAEC);
  color: var(--c-accent, #E63946);
  border: 1px solid rgba(230, 57, 70, 0.2);
}

/* Mobile: Phase-Cards stapeln */
@media (max-width: 600px) {
  .wf-phase-grid { grid-template-columns: 1fr; }
  .wf-area-grid { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════════════════════════
   Workflow-Service-Karten KOMPAKT — Grid mit Pflicht-Info only
   ─────────────────────────────────────────────────────────────── */
.wf-service-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--s-3);
}
.wf-service-card.compact {
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-left: 4px solid var(--area-color, var(--c-accent));
  border-radius: var(--r-sm, 8px);
  padding: var(--s-3) var(--s-4);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 130px;
  transition: transform 200ms cubic-bezier(0.22, 1, 0.36, 1),
              box-shadow 200ms cubic-bezier(0.22, 1, 0.36, 1),
              border-color 180ms ease;
}
.wf-service-card.compact:hover {
  transform: translateY(-3px);
  border-color: var(--area-color, var(--c-accent));
  box-shadow: var(--shadow-2, 0 12px 28px -12px rgba(0, 0, 0, 0.14));
}
.wf-service-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.wf-service-card.compact .wf-service-code {
  font-size: 11px;
  font-weight: 700;
  color: var(--c-mid);
  background: var(--c-soft);
  padding: 2px 7px;
  border-radius: 999px;
  letter-spacing: 0.05em;
}
.wf-service-card.compact .wf-service-name {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 4px 0 0;
  line-height: 1.3;
  color: var(--c-ink);
}
.wf-service-positioning {
  font: 600 9.5px/1 var(--f-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--c-mid);
}
.wf-service-foot {
  margin-top: auto;
  padding-top: var(--s-2);
  border-top: 1px solid var(--c-line-soft);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.wf-service-meta-line {
  display: flex;
  gap: var(--s-3);
  font-size: 11px;
  color: var(--c-mid);
}
.wf-service-meta-line strong { color: var(--c-ink); }
.wf-service-card.compact .wf-phase-dots {
  display: inline-flex;
  gap: 2px;
  letter-spacing: 0;
}

@media (max-width: 600px) {
  .wf-service-grid { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════════════════════════
   Workflow-Status-System — Badges, Coverage-Bar, Progress-Hero
   Unfertige Workflows klar als „OFFEN" markieren + visuell dimmen
   ─────────────────────────────────────────────────────────────── */

/* Status-Badge (ersetzt nur-Punkt-Anzeige) */
.wf-status-badge {
  font: 700 9.5px/1 var(--f-mono, 'IBM Plex Mono', monospace);
  letter-spacing: 0.08em;
  padding: 4px 8px;
  border-radius: 999px;
  white-space: nowrap;
  border: 1px solid transparent;
}
.wf-status-badge-full {
  background: rgba(34, 153, 84, 0.12);
  color: #1f7a44;
  border-color: rgba(34, 153, 84, 0.32);
}
.wf-status-badge-stub {
  background: rgba(217, 119, 6, 0.14);
  color: #a85d00;
  border-color: rgba(217, 119, 6, 0.36);
}
.wf-status-badge-empty {
  background: rgba(100, 116, 139, 0.12);
  color: #475569;
  border-color: rgba(100, 116, 139, 0.32);
}

/* Status-Tag-Dots (klein, für Progress-Hero) */
.status-tag-full  { color: #22c55e; }
.status-tag-stub  { color: #ea7c0c; }
.status-tag-empty { color: #94a3b8; }

/* Visueller Dim-State für leere Workflows — gedeckt, sichtbar nicht-erledigt */
.wf-service-card.wf-status-empty {
  background: var(--c-soft, #f6f7f9);
}
.wf-service-card.wf-status-empty .wf-service-name {
  color: var(--c-mid, #64748b);
}
.wf-service-card.wf-status-empty:hover {
  background: var(--c-surface, #fff);
}
.wf-area-card.wf-status-empty .wf-area-name {
  color: var(--c-mid, #64748b);
}

/* Coverage-Bar (in Area-Cards + Progress-Hero) */
.wf-area-coverage {
  margin-top: var(--s-2);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.wf-coverage-row {
  display: flex;
  justify-content: space-between;
  font-size: 10.5px;
  color: var(--c-mid);
}
.wf-coverage-row strong { color: var(--c-ink); }
.wf-coverage-bar,
.wf-progress-bar {
  height: 6px;
  width: 100%;
  background: var(--c-line-soft, #e5e7eb);
  border-radius: 999px;
  display: flex;
  overflow: hidden;
}
.wf-progress-bar { height: 10px; margin-top: var(--s-3); }
.wf-cov-seg { display: block; height: 100%; }
.wf-cov-full  { background: #22c55e; }
.wf-cov-stub  { background: #ea7c0c; }
.wf-cov-empty { background: #cbd5e1; }

/* Progress-Hero (oben auf #workflow) */
.wf-progress-hero {
  background: var(--c-surface, #fff);
  border: 1px solid var(--c-line, #e5e7eb);
  border-radius: var(--r-md, 12px);
  padding: var(--s-4) var(--s-5);
  margin-bottom: var(--s-4);
}
.wf-progress-numbers {
  display: grid;
  grid-template-columns: 1.6fr repeat(3, 1fr);
  gap: var(--s-4);
}
.wf-progress-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.wf-progress-num {
  font: 700 22px/1 var(--f-mono, 'IBM Plex Mono', monospace);
  color: var(--c-ink, #0f172a);
}
.wf-progress-headline .wf-progress-num { font-size: 32px; }
.wf-progress-of {
  font-size: 16px;
  color: var(--c-mid, #94a3b8);
  font-weight: 400;
}
.wf-progress-label {
  font: 600 10.5px/1.2 var(--f-mono, monospace);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--c-mid, #64748b);
}

@media (max-width: 720px) {
  .wf-progress-numbers { grid-template-columns: 1fr 1fr; }
  .wf-progress-headline { grid-column: 1 / -1; }
}

/* Status-Filter (auf Area-Detail-Seite) */
.wf-status-filter {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.wf-filter-btn {
  background: var(--c-soft, #f6f7f9);
  border: 1px solid var(--c-line, #e5e7eb);
  border-radius: 999px;
  padding: 6px 14px;
  font: 600 11.5px/1 var(--f-mono, 'IBM Plex Mono', monospace);
  letter-spacing: 0.04em;
  color: var(--c-mid, #475569);
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.wf-filter-btn:hover {
  background: var(--c-surface, #fff);
  border-color: var(--c-ink, #0f172a);
  color: var(--c-ink, #0f172a);
}
.wf-filter-btn.active {
  background: var(--c-ink, #0f172a);
  border-color: var(--c-ink, #0f172a);
  color: #fff;
}
.wf-filter-count {
  font-weight: 700;
  background: rgba(255, 255, 255, 0.18);
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 10.5px;
}
.wf-filter-btn:not(.active) .wf-filter-count {
  background: var(--c-line-soft, #e5e7eb);
}
.wf-filter-btn:not(.active) .wf-filter-empty { color: #475569; }
.wf-filter-btn:not(.active) .wf-filter-stub  { color: #a85d00; }
.wf-filter-btn:not(.active) .wf-filter-full  { color: #1f7a44; }

/* ═══════════════════════════════════════════════════════════════
   Topbar v2 — Suche · Datum · Avatar · Icon-Actions
   Calvin: 'Kopfzeile sieht so nackt und trocken aus'
   ─────────────────────────────────────────────────────────────── */

/* Globale Such-Bar (Center) */
.topbar-search {
  flex: 1 1 460px;
  max-width: 520px;
  min-width: 0;
  width: 100%;
  justify-self: center;
  margin: 0;
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--s-2);
  height: 38px;
  padding: 0 12px 0 36px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  color: var(--c-surface, #fff);
  transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}
.topbar-search:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.22);
}
.topbar-search:focus-within {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.08);
}
.topbar-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255, 255, 255, 0.65);
  pointer-events: none;
}
.topbar-search input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  color: inherit;
  font: 500 13px/1 var(--f-body, 'Inter', system-ui, sans-serif);
  outline: none;
  padding: 0;
}
.topbar-search input::placeholder {
  color: rgba(255, 255, 255, 0.55);
  font-weight: 400;
}
.topbar-search-kbd {
  flex: 0 0 auto;
  font: 600 10.5px/1 var(--f-mono, monospace);
  padding: 3px 7px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.18);
  letter-spacing: 0.03em;
}

/* Datum-Pille (links neben Notifications) */
.topbar-date {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1;
  gap: 2px;
  padding: 6px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  user-select: none;
}
.topbar-date-day {
  font: 700 9.5px/1 var(--f-mono, monospace);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.6);
}
.topbar-date-num {
  font: 600 12px/1 var(--f-mono, monospace);
  color: var(--c-surface, #fff);
}

/* Icon-Buttons (Bell + Logout) */
.topbar-icon-btn {
  position: relative;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  color: var(--c-surface, #fff);
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, transform 140ms ease;
}
.topbar-icon-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.24);
}
.topbar-icon-btn:active { transform: translateY(1px); }
.topbar-icon-btn svg { display: block; }

.topbar-notif-dot {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 7px;
  height: 7px;
  background: var(--c-accent, #ef4444);
  border-radius: 999px;
  box-shadow: 0 0 0 2px var(--c-ink, #0f172a);
}

/* Trenner */
.topbar-divider {
  width: 1px;
  height: 22px;
  background: rgba(255, 255, 255, 0.14);
  margin: 0 4px;
}

/* User-Block (Button mit Avatar + Meta) */
.topbar-user {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 4px 12px 4px 4px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  color: var(--c-surface, #fff);
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease;
}
.topbar-user:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.24);
}

.topbar-avatar {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: 700 11px/1 var(--f-mono, monospace);
  letter-spacing: 0.02em;
  color: #fff;
  background:
    linear-gradient(135deg,
      hsl(var(--avatar-hue, 220) 70% 55%),
      hsl(calc(var(--avatar-hue, 220) + 40) 70% 45%));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.topbar-user-meta {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1;
  gap: 3px;
}
.topbar-user-name {
  font: 600 12.5px/1 var(--f-body, system-ui);
  color: var(--c-surface, #fff);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Bestehende role-badge im neuen User-Block kompakter */
.topbar-user .role-badge {
  margin: 0;
  font-size: 9px;
  padding: 1px 6px;
  letter-spacing: 0.1em;
}

/* Topbar-right Layout-Tuning */
.topbar .topbar-right { gap: 10px; }

/* Responsive — auf mittleren Screens Datum + Meta weg */
@media (max-width: 1100px) {
  .topbar-date { display: none; }
  .topbar-user-meta { display: none; }
  .topbar-user { padding: 4px; }
}
@media (max-width: 860px) {
  .topbar-search { display: none; }
}
@media (max-width: 600px) {
  .topbar-divider { display: none; }
  .topbar-icon-btn { width: 32px; height: 32px; border-radius: 8px; }
}

/* Helle Topbars (Themes mit hellem --c-ink) — invertierte Akzent-Farben */
@supports (color: color-mix(in oklab, white, black)) {
  .topbar[style*=""], .topbar {
    /* falls Theme einen hellen Background setzt: */
  }
}

/* (Hell-Theme-Override fuer Topbar entfernt — Topbar bleibt theme-uebergreifend dunkel) */

/* Alte .topbar .user / .logout-btn Regeln sind durch neue Selektoren obsolet —
   überschreibe Reste explizit fuer Sicherheit */
.topbar .user { display: none !important; }
.topbar > .topbar-right > .logout-btn { /* unbenutzt, aber falls cached */ }

/* ═══════════════════════════════════════════════════════════════
   Topbar v3 — entquetschtes Grid + Search-Dropdown
   Brand schmaler · Search mittig mit max-width · Right-Block atmend
   ─────────────────────────────────────────────────────────────── */

/* (Such-Bar-Basis konsolidiert weiter oben — doppelte Definition entfernt) */

/* Search-Results-Dropdown */
.topbar-search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--c-surface, #fff);
  color: var(--c-ink, #0f172a);
  border: 1px solid var(--c-line, #e5e7eb);
  border-radius: 14px;
  box-shadow: 0 24px 60px -16px rgba(0, 0, 0, 0.25), 0 8px 16px -8px rgba(0, 0, 0, 0.12);
  max-height: 60vh;
  overflow-y: auto;
  z-index: 200;
  padding: 6px;
}
.topbar-search-results[hidden] { display: none; }

.search-hint, .search-empty {
  padding: 14px 12px;
  font-size: 12.5px;
  color: var(--c-mid, #64748b);
  text-align: center;
  line-height: 1.5;
}
.search-hint kbd {
  font: 600 10px/1 var(--f-mono, monospace);
  background: var(--c-soft, #f3f4f6);
  padding: 2px 6px;
  border-radius: 4px;
  margin: 0 2px;
}

.search-group-label {
  font: 700 9.5px/1 var(--f-mono, monospace);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--c-mid, #94a3b8);
  padding: 10px 12px 4px;
}

.search-item {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
  color: inherit;
  font: inherit;
}
.search-item:hover,
.search-item.is-active {
  background: var(--c-soft, #f3f4f6);
}
.search-icon {
  font-size: 14px;
  width: 22px;
  text-align: center;
  color: var(--c-mid, #94a3b8);
}
.search-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.search-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--c-ink, #0f172a);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.search-sub {
  font-size: 11px;
  color: var(--c-mid, #64748b);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.search-type {
  font: 600 9.5px/1 var(--f-mono, monospace);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--c-soft, #f3f4f6);
  color: var(--c-mid, #64748b);
}
.search-item mark {
  background: rgba(255, 200, 50, 0.35);
  color: inherit;
  border-radius: 2px;
  padding: 0 1px;
}

/* Topbar-Brand entquetschen */
.topbar .brand { gap: 10px; }
.topbar .brand img { height: 28px; }
.topbar .brand .name { font-size: 15px; }
.topbar .brand .sub {
  font-size: 9.5px;
  letter-spacing: 0.18em;
  margin-left: 6px;
}

/* User-Block etwas schmaler */
.topbar-user-name { font-size: 12px; max-width: 90px; }
.topbar-user { padding: 4px 10px 4px 4px; }

/* Responsive-Anpassung Topbar-Grid */
@media (max-width: 1280px) {
  .topbar { grid-template-columns: minmax(150px, auto) minmax(0, 1fr) auto; gap: var(--s-4); }
  .topbar-search { max-width: 420px; }
}
@media (max-width: 1100px) {
  .topbar-search { max-width: 360px; }
}
@media (max-width: 980px) {
  .topbar { grid-template-columns: auto 1fr auto; }
  .topbar-search { max-width: none; }
}
@media (max-width: 860px) {
  .topbar { grid-template-columns: auto auto; }
  .topbar-search { display: none; }
}

/* Aus alten Mobile-Rules — die alten .user / .logout-btn Regeln greifen nicht mehr,
   neue .topbar-user nutzen wir bereits weiter oben mit eigenen Mobile-Hooks */
@media (max-width: 600px) {
  .topbar .brand .sub { display: none; }
  .topbar { gap: var(--s-2); padding-left: max(var(--s-2), env(safe-area-inset-left)); padding-right: max(var(--s-2), env(safe-area-inset-right)); }
}
@media (max-width: 430px) {
  .topbar { gap: 6px; padding-left: max(8px, env(safe-area-inset-left)); padding-right: max(8px, env(safe-area-inset-right)); }
}

/* ═══════════════════════════════════════════════════════════════
   Inline-Icons (Replaces fuer Emojis in Buttons/Texten)
   ─────────────────────────────────────────────────────────────── */
.i-inline {
  display: inline-block;
  vertical-align: -2px;
  flex-shrink: 0;
  margin-right: 4px;
  color: currentColor;
}
.i-inline:last-child { margin-right: 0; }
button .i-inline { margin-right: 5px; }
button:where(.icon-only) .i-inline { margin-right: 0; }
h1 .i-inline, h2 .i-inline, h3 .i-inline { vertical-align: -3px; margin-right: 6px; opacity: 0.85; }

/* Status-Variants */
.i-inline.i-ok      { color: #1f7a44; }
.i-inline.i-warn    { color: #a85d00; }
.i-inline.i-error   { color: #b91c1c; }
.i-inline.i-info    { color: #2563eb; }
.i-inline.i-mid     { color: var(--c-mid, #64748b); }

/* Sehr grosse Icons fuer Empty-States */
.i-empty-state {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px; height: 56px;
  border-radius: 999px;
  background: var(--c-soft, #f3f4f6);
  color: var(--c-mid, #94a3b8);
  margin-bottom: var(--s-3);
}
.i-empty-state svg { width: 26px; height: 26px; }

/* Search-Dropdown-Icons: SVG zentriert, kein margin */
.search-icon .i-inline { margin-right: 0; vertical-align: middle; }
.search-icon svg { width: 14px; height: 14px; }

/* ═══════════════════════════════════════════════════════════════
   Phase-Modal · Prompt-Generator-Tab
   ─────────────────────────────────────────────────────────────── */
.pg-hint {
  font-size: 12.5px;
  color: var(--c-mid, #64748b);
  background: var(--c-soft, #f8fafc);
  border-radius: 8px;
  padding: 10px 12px;
  line-height: 1.5;
  margin-bottom: var(--s-3);
}
.pg-input-row {
  display: grid;
  grid-template-columns: 1fr 200px auto;
  gap: 8px;
  margin-bottom: var(--s-3);
}
.pg-task-input,
.pg-format-select {
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--c-line, #e5e7eb);
  border-radius: 8px;
  background: var(--c-surface, #fff);
  color: var(--c-ink, #0f172a);
  font-size: 13px;
  font-family: inherit;
}
.pg-task-input:focus,
.pg-format-select:focus {
  outline: none;
  border-color: var(--c-accent, #ef4444);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
}
.pg-result {
  border: 1px solid var(--c-line, #e5e7eb);
  border-radius: 10px;
  background: var(--c-surface, #fff);
  overflow: hidden;
}
.pg-result-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--c-soft, #f8fafc);
  border-bottom: 1px solid var(--c-line, #e5e7eb);
}
.pg-result-label { font-size: 12px; color: var(--c-ink, #0f172a); }
.pg-result-actions { display: flex; align-items: center; gap: 10px; }
.pg-result-meta { font-size: 10.5px; color: var(--c-mid, #94a3b8); }
.pg-result-body {
  margin: 0;
  padding: 14px;
  background: var(--c-surface, #fff);
  font: 13px/1.55 ui-monospace, 'JetBrains Mono', 'Geist Mono', 'IBM Plex Mono', monospace;
  white-space: pre-wrap;
  word-wrap: break-word;
  color: var(--c-ink, #0f172a);
  max-height: 50vh;
  overflow-y: auto;
}
@media (max-width: 700px) {
  .pg-input-row { grid-template-columns: 1fr; }
  .pg-format-select { width: 100%; }
}

/* ═════════════════════════════════════════════════════════════════
   PARTNER-BEREICH (Portal extern + Verwaltung intern)
   ═════════════════════════════════════════════════════════════════ */

/* Status-Chips */
.pstatus {
  display: inline-block;
  font-family: var(--f-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}
.pst-open      { background: var(--c-soft); color: var(--c-mid); border: 1px solid var(--c-line); }
.pst-review    { background: #FDF3E3; color: #8A5A1B; border: 1px solid #EBD3A8; }
.pst-confirmed { background: var(--c-tools-soft); color: var(--c-tools); border: 1px solid var(--c-tools); }
.pst-paid      { background: var(--c-kunden-soft); color: var(--c-kunden); border: 1px solid var(--c-kunden); }
.pst-cancelled { background: var(--c-accent-soft); color: var(--c-danger); border: 1px solid var(--c-danger); }

/* Tabellen im Partner-Bereich */
.ptable { width: 100%; border-collapse: collapse; font-size: 13px; }
.ptable th {
  text-align: left;
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--c-mid);
  padding: 8px 10px;
  border-bottom: 1px solid var(--c-line);
}
.ptable td { padding: 10px; border-bottom: 1px solid var(--c-line-soft); vertical-align: top; }
.ptable td.num, .ptable th.num { text-align: right; font-variant-numeric: tabular-nums; }
.ptable tbody tr:last-child td { border-bottom: none; }
.ptable tr.row-click { cursor: pointer; }
.ptable tr.row-click:hover td { background: var(--c-soft); }

/* Empfehlungs-Zeile mit Prozess-Stepper */
.plead-row { padding: 12px 0; border-bottom: 1px solid var(--c-line-soft); }
.plead-row:last-child { border-bottom: none; }
.plead-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }

.pstepper { display: flex; align-items: center; gap: 0; flex-wrap: wrap; }
.pstep { display: flex; align-items: center; gap: 6px; }
.pstep-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--c-surface); border: 2px solid var(--c-line);
  flex-shrink: 0;
}
.pstep.is-done .pstep-dot { background: var(--c-tools); border-color: var(--c-tools); }
.pstep.is-current .pstep-dot { background: var(--c-accent); border-color: var(--c-accent); }
.pstep-label { font-size: 11px; color: var(--c-mid); white-space: nowrap; }
.pstep.is-current .pstep-label { color: var(--c-ink); font-weight: 700; }
.pstep.is-done .pstep-label { color: var(--c-ink-soft); }
.pstep-line { flex: 0 0 18px; height: 2px; background: var(--c-line-soft); margin: 0 6px; }
.pstep-rejected { font-size: 12px; color: var(--c-danger); }

/* Info-Seite (So funktioniert's) */
.pinfo-step { padding: 12px 0 12px 16px; border-left: 3px solid var(--c-accent); margin-bottom: 12px; }
.pinfo-step-title { font-family: var(--f-display); font-weight: 700; margin-bottom: 2px; }
.pinfo-strip { font-size: 13px; }
.pinfo-strip a { margin-left: 6px; }

@media (max-width: 720px) {
  .pstepper { flex-direction: column; align-items: flex-start; gap: 4px; }
  .pstep-line { display: none; }
  .ptable { font-size: 12px; }
}

/* ═════════════════════════════════════════════════════════════════
   UX-MODERNISIERUNG (global, theme-unabhängig) — 2026-06-12
   1) Skeleton-Loading statt „Lade…"-Text
   2) Tastatur-Fokus sichtbar (a11y)
   3) Disabled-Buttons einheitlich
   ═════════════════════════════════════════════════════════════════ */

/* Skeleton: jede .loading wird zur schimmernden Platzhalter-Fläche */
.loading {
  position: relative;
  color: transparent !important;
  user-select: none;
  min-height: 44px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--c-soft);
}
.loading::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.65) 50%,
    transparent 100%);
  transform: translateX(-100%);
  animation: sk-shimmer 1.2s ease-in-out infinite;
}
@keyframes sk-shimmer {
  to { transform: translateX(100%); }
}
@media (prefers-reduced-motion: reduce) {
  .loading::before { animation: none; }
}

/* Tastatur-Fokus global sichtbar (Maus-Klicks bleiben ohne Ring) */
.btn:focus-visible,
.set-btn:focus-visible,
.nav-link:focus-visible,
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--c-info, #2C5A8A);
  outline-offset: 2px;
}

/* Disabled — einheitlich über alle Themes */
.btn:disabled,
.set-btn:disabled,
button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Prompt-Generator — Feedback-Zeile (Lern-Loop) */
.pg-feedback {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--c-line-soft);
  font-size: 12px;
}
.pg-feedback-label { color: var(--c-mid); }
.pg-feedback-done { font-size: 12px; color: var(--c-success); }
.pg-feedback-comment {
  display: flex;
  gap: 8px;
  padding: 0 12px 12px;
}
.pg-feedback-comment input {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid var(--c-line);
  font-size: 13px;
}

/* ── Kanban/Workflow Mobile-Feinschliff (Responsive C4) ── */
@media (max-width: 1024px) {
  .workflow-col-header { flex-direction: column; align-items: flex-start; gap: 4px; font-size: 12px; }
}
@media (max-width: 768px) {
  .workflow-card-head { flex-direction: column; align-items: flex-start; gap: 4px; }
}
@media (max-width: 640px) {
  /* eine fast-vollbreite Spalte pro Screen + Snap statt 240px-Stummel */
  .kanban-board { grid-auto-columns: 86%; scroll-snap-type: x mandatory; }
  .kanban-col { scroll-snap-align: start; min-height: 200px; }
}
@media (max-width: 430px) {
  .kanban-board { grid-auto-columns: 92%; }
  .kanban-col { min-height: auto; }
}

/* ── Detail-Ansichten Mobile-Feinschliff (Responsive C5) ── */
.inline-select { max-width: 100%; }
@media (max-width: 600px) {
  /* Label über Wert stapeln statt 110px-Spalte zu quetschen */
  .detail-row { grid-template-columns: 1fr; gap: 2px; align-items: start; }
  .detail-row .detail-label { font-size: 10px; }
  .detail-row .detail-value { font-size: 14px; }
}
@media (max-width: 430px) {
  .wf-service-grid { grid-template-columns: 1fr; }
}

/* ── Modals + Formulare Mobile-Touch (Responsive C6) ── */
@media (max-width: 600px) {
  .field input, .field select, .field textarea,
  .set-form-row input, .set-form-row select, .set-form-row textarea { min-height: 44px; }
  .btn.small { padding: 10px 14px; min-height: 44px; font-size: 12px; }
  /* Footer-Buttons stapeln, Primär (zuletzt im DOM) oben + vollbreit */
  .modal .modal-foot { flex-direction: column-reverse; align-items: stretch; }
  .modal .modal-foot .btn { width: 100%; }
  .set-form { max-width: 100%; }
}

/* ── Dashboard/Chat/Lead-Gen Mobile-Feinschliff (Responsive C7) ── */
@media (max-width: 640px) {
  /* feste 90px/80px-Spalten entzerren statt zu quetschen */
  .payout-row { grid-template-columns: auto 1fr auto; gap: 6px; font-size: 12px; }
}
@media (max-width: 600px) {
  .ai-chat-bubble { max-width: 88%; }
  .lg-tabs { flex-wrap: wrap; }
  .dashboard-grid { gap: var(--s-3); }
}
@media (max-width: 480px) {
  .toast { width: calc(100vw - var(--s-6)); min-width: 0; }
}
@media (max-width: 430px) {
  .stat-grid { grid-template-columns: 1fr; }
}

/* ── A11y/Touch-Hygiene (Responsive C8) ── */
@media (max-width: 1024px) { :root { --sidebar-width: 200px; } }   /* schmalere Rail auf Tablet (768–1024) */
@media (max-width: 768px) { .field label, .set-form-row label, .nav-section-title { font-size: 11px; } }
@media (max-width: 600px) { .topbar-icon-btn { width: 40px; height: 40px; } }   /* Touch-Genauigkeit */

/* ── KPI/Reporting-Balken (eckig, Swiss) ── */
.kpi-bar-row { display: flex; align-items: center; gap: var(--s-3); padding: 6px 0; }
.kpi-bar-label { flex: 0 0 120px; font-size: 13px; color: var(--c-ink); }
.kpi-bar-track { flex: 1; height: 14px; background: var(--c-soft); border: 1px solid var(--c-line); }
.kpi-bar-fill { height: 100%; background: var(--c-accent); min-width: 2px; }
.kpi-bar-val { flex: 0 0 auto; min-width: 96px; text-align: right; font-family: var(--f-mono); font-size: 12px; color: var(--c-mid); }
@media (max-width: 600px) { .kpi-bar-label { flex-basis: 84px; } .kpi-bar-val { min-width: 72px; } }
