/* MSE 2.0 — Spike-UI Stylesheet */

:root {
  /* Surface */
  --bg-app: #0a0b10;
  --bg-elev-1: #12141c;
  --bg-elev-2: #181b25;
  --bg-elev-3: #1f2330;
  --bg-input: #1a1d27;
  --bg-hover: #1e2230;
  --bg-active: #2a2f40;

  /* Text */
  --fg-primary: #ecedef;
  --fg-secondary: #a0a3ad;
  --fg-tertiary: #6c707a;
  --fg-dim: #4a4d56;

  /* Borders */
  --border: #232733;
  --border-strong: #2e3342;
  --border-focus: #5e6cff;

  /* Accents */
  --accent: #5e6cff;
  --accent-hover: #7280ff;
  --accent-soft: rgba(94, 108, 255, 0.12);
  --ok: #4ade80;
  --warn: #fbbf24;
  --err: #f87171;
  --purple: #a78bfa;
  --cyan: #67e8f9;

  /* Layout */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --sidebar-w: 280px;
  --inspector-w: 340px;
  --topbar-h: 64px;
  --composer-h: 140px;

  /* Type */
  --font-sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;

  /* Motion */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: 120ms var(--ease);
  --transition: 200ms var(--ease);
}

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

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg-app);
  color: var(--fg-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr var(--inspector-w);
  grid-template-rows: 100vh;
  overflow: hidden;
}

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

textarea, input {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

::selection {
  background: rgba(94, 108, 255, 0.55);
  color: #fff;
}
::-moz-selection {
  background: rgba(94, 108, 255, 0.55);
  color: #fff;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 5px;
  border: 2px solid var(--bg-app);
}
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* ============================================================
   SIDEBAR
   ============================================================ */

.sidebar {
  background: var(--bg-elev-1);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  position: relative;
}

.sidebar-toggle,
.inspector-toggle {
  position: absolute;
  top: 14px;
  right: 10px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--fg-secondary);
  cursor: pointer;
  z-index: 10;
  transition: all 120ms ease;
}
.inspector-toggle { right: auto; left: 10px; }
.sidebar-toggle:hover,
.inspector-toggle:hover {
  background: var(--bg-elev-3);
  color: var(--fg-primary);
  border-color: var(--border-focus, var(--accent));
}

.topbar-reopen {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elev-1);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 120ms ease;
  flex-shrink: 0;
}
.topbar-reopen:hover {
  background: var(--bg-elev-2);
  color: var(--text);
}
.topbar-reopen[hidden] { display: none; }

/* Collapsed-Layout via body-Class
   WICHTIG: bei display:none verschwindet das Grid-Item aus der Auto-Placement;
   nachfolgende Items rutschen eine Spalte vor. Deshalb hier die Grid-Template
   passend zur Anzahl sichtbarer Spalten reduzieren. */
body.sidebar-collapsed {
  grid-template-columns: 1fr var(--inspector-w);
}
body.inspector-collapsed {
  grid-template-columns: var(--sidebar-w) 1fr;
}
body.sidebar-collapsed.inspector-collapsed {
  grid-template-columns: 1fr;
}
body.sidebar-collapsed .sidebar,
body.inspector-collapsed .inspector {
  display: none;
}

/* Wenn Panels ausgeblendet sind: Chat-Spalte nutzt mehr von der freien Breite.
   Limits hoch, aber nicht entgrenzt — sehr lange Zeilen sind schwer lesbar. */
body.sidebar-collapsed .msg-list,
body.inspector-collapsed .msg-list,
body.sidebar-collapsed .composer-inner,
body.inspector-collapsed .composer-inner {
  max-width: 1100px;
}
body.sidebar-collapsed.inspector-collapsed .msg-list,
body.sidebar-collapsed.inspector-collapsed .composer-inner {
  max-width: 1400px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 40px 18px 20px;
  border-bottom: 1px solid var(--border);
}
.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  display: grid;
  place-items: center;
  color: white;
  font-weight: 700;
  font-size: 16px;
  box-shadow: 0 4px 16px -4px rgba(94, 108, 255, 0.5);
}
.brand-text { line-height: 1.15; }
.brand-name { font-weight: 600; font-size: 14px; }
.brand-tagline { font-size: 11px; color: var(--fg-tertiary); }

.btn-new {
  margin: 14px 16px 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--accent-soft);
  color: var(--accent-hover);
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-weight: 500;
  transition: var(--transition-fast);
}
.btn-new:hover {
  background: rgba(94, 108, 255, 0.18);
  border-color: var(--accent);
  color: white;
}
.btn-new:active { transform: scale(0.98); }

.sidebar-section-label {
  padding: 18px 20px 8px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-tertiary);
}

.session-search-wrap {
  padding: 0 12px 8px;
}
.session-search {
  width: 100%;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
  color: var(--fg-primary);
  font-family: inherit;
  transition: border-color 120ms ease;
  -webkit-appearance: none;
}
.session-search::placeholder { color: var(--fg-tertiary); }
.session-search:focus {
  outline: none;
  border-color: var(--border-focus, var(--accent));
}

.session-list {
  list-style: none;
  margin: 0;
  padding: 0 8px;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.session-item {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
  border: 1px solid transparent;
  position: relative;
}
.session-item:hover {
  background: var(--bg-hover);
}
.session-item.active {
  background: var(--bg-active);
  border-color: var(--border-strong);
}
.session-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.session-item-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}
.session-item-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}
.session-rename,
.session-delete {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  color: var(--fg-tertiary);
  opacity: 0;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: var(--transition-fast);
}
.session-item:hover .session-rename,
.session-item:hover .session-delete { opacity: 1; }
.session-rename:hover {
  background: var(--bg-elev-3);
  color: var(--fg-primary);
}
.session-delete:hover {
  background: rgba(248, 113, 113, 0.15);
  color: var(--err);
}
.session-rename-input {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  color: var(--fg-primary);
  background: var(--bg-elev-1);
  border: 1px solid var(--accent);
  border-radius: 4px;
  padding: 1px 6px;
  outline: none;
}
.session-item-meta {
  font-size: 11px;
  color: var(--fg-tertiary);
  margin-top: 2px;
  display: flex;
  gap: 8px;
}
.session-item-meta .dot-sep::before { content: "·"; margin-right: 6px; color: var(--fg-dim); }
.session-list-empty {
  padding: 24px 16px;
  text-align: center;
  font-size: 12px;
  color: var(--fg-tertiary);
}

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding: 12px 20px;
}
.health-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--fg-secondary);
  font-family: var(--font-mono);
}
.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--fg-dim);
  flex-shrink: 0;
}
.dot.ok { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.dot.err { background: var(--err); }
.dot.busy { background: var(--warn); animation: pulse 1.4s ease-in-out infinite; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* ============================================================
   MAIN / CHAT
   ============================================================ */

.main {
  display: grid;
  grid-template-rows: var(--topbar-h) 1fr auto;
  height: 100vh;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-app);
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.topbar-left { min-width: 0; }
.session-title {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 600px;
}
.session-meta {
  font-size: 12px;
  color: var(--fg-tertiary);
  font-family: var(--font-mono);
  margin-top: 2px;
}

.badge {
  font-size: 11px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 10px;
  border-radius: 12px;
  background: var(--bg-elev-2);
  color: var(--fg-tertiary);
  border: 1px solid var(--border);
  transition: var(--transition-fast);
}
.badge.busy { background: rgba(251, 191, 36, 0.1); color: var(--warn); border-color: rgba(251, 191, 36, 0.3); }
.badge.ok { background: rgba(74, 222, 128, 0.1); color: var(--ok); border-color: rgba(74, 222, 128, 0.3); }
.badge.err { background: rgba(248, 113, 113, 0.1); color: var(--err); border-color: rgba(248, 113, 113, 0.3); }

/* Messages */

.messages {
  overflow-y: auto;
  padding: 24px 0;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 24px;
  text-align: center;
  color: var(--fg-secondary);
  max-width: 540px;
  margin: 0 auto;
}
.empty-icon {
  color: var(--fg-dim);
  margin-bottom: 24px;
}
.empty-state h2 {
  font-size: 22px;
  font-weight: 600;
  color: var(--fg-primary);
  margin: 0 0 12px;
  letter-spacing: -0.01em;
}
.empty-state p {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
}

.msg-list {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.msg {
  display: flex;
  gap: 14px;
  animation: msgIn 240ms var(--ease) both;
}

@keyframes msgIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.msg-avatar {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: 7px;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  color: white;
}
.msg.user .msg-avatar {
  background: linear-gradient(135deg, #3a4252, #5a6478);
}
.msg.assistant .msg-avatar {
  background: linear-gradient(135deg, var(--accent), var(--purple));
}

.msg-body { flex: 1; min-width: 0; }
.msg-author {
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-secondary);
  margin-bottom: 4px;
}
.msg-content {
  font-size: 14px;
  line-height: 1.65;
  color: var(--fg-primary);
  white-space: pre-wrap;
  word-wrap: break-word;
  /* Defensiv: Text muss in jedem Fall selektierbar bleiben */
  user-select: text;
  -webkit-user-select: text;
}
/* Beim gerenderten Markdown brauchen wir kein pre-wrap mehr — die <p>/<li>
   Tags machen den Linebreak. Sonst entstehen Doppel-Lücken.
   Gilt sowohl fuer Chat (.msg-content) als auch Workflow-Steps (.wf-output). */
.msg-content:has(p, ul, ol, h1, h2, h3, pre),
.wf-output:has(p, ul, ol, h1, h2, h3, pre) {
  white-space: normal;
}
.msg-content ol li, .msg-content ul li,
.wf-output ol li, .wf-output ul li {
  margin-bottom: 4px;
}
.msg-content ol li:last-child, .msg-content ul li:last-child,
.wf-output ol li:last-child, .wf-output ul li:last-child {
  margin-bottom: 0;
}
.msg-content p, .wf-output p { margin: 0 0 10px; }
.msg-content p:last-child, .wf-output p:last-child { margin-bottom: 0; }
.msg-content h1, .msg-content h2, .msg-content h3,
.msg-content h4, .msg-content h5, .msg-content h6,
.wf-output h1, .wf-output h2, .wf-output h3,
.wf-output h4, .wf-output h5, .wf-output h6 {
  margin: 14px 0 6px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--fg-primary);
  line-height: 1.3;
}
.msg-content h1, .wf-output h1 { font-size: 20px; }
.msg-content h2, .wf-output h2 { font-size: 17px; }
.msg-content h3, .wf-output h3 { font-size: 15px; }
.msg-content h4, .msg-content h5, .msg-content h6,
.wf-output h4, .wf-output h5, .wf-output h6 { font-size: 14px; }
.msg-content ul, .msg-content ol,
.wf-output ul, .wf-output ol { margin: 0 0 10px; padding-left: 22px; }
.msg-content li, .wf-output li { margin-bottom: 3px; }
/* Erstes Element im Container hat keinen oberen Abstand */
.msg-content > *:first-child,
.wf-output > *:first-child { margin-top: 0; }

/* GitHub-Style Tabellen */
.md-table {
  border-collapse: collapse;
  margin: 12px 0;
  font-size: inherit;
  width: auto;
  max-width: 100%;
  overflow-x: auto;
  display: block;
  border: 1px solid var(--border);
  border-radius: 6px;
}
.md-table thead {
  background: var(--bg-elev-2);
}
.md-table th,
.md-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  vertical-align: top;
}
.md-table th:last-child,
.md-table td:last-child {
  border-right: none;
}
.md-table tbody tr:last-child td {
  border-bottom: none;
}
.md-table th {
  font-weight: 600;
  color: var(--fg-primary);
  font-size: 12px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.md-table tbody tr:hover {
  background: var(--bg-elev-2);
}

/* Display-Math (KaTeX) */
.math-display {
  margin: 14px 0;
  padding: 8px 4px;
  overflow-x: auto;
  text-align: center;
}
.katex { font-size: 1.05em; }
.katex-display { margin: 12px 0; }
.msg-content a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: var(--transition-fast);
}
.msg-content a:hover { border-bottom-color: var(--accent); }
/* Pseudo-Stream "Type-On" — jeder Block fade-in/translate-up zeitversetzt.
   Wird auf gerendertem Markdown angewendet (p, li, h1-6, pre, blockquote). */
@keyframes revealLine {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.reveal-line {
  animation: revealLine 240ms var(--ease) both;
}

.msg-content .inline-code {
  background: var(--bg-elev-2);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.88em;
  color: var(--cyan);
  border: 1px solid var(--border);
}
.msg-content .code-block {
  position: relative;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 12px 0;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.5;
  color: var(--fg-primary);
}
.msg-content .code-block code { color: inherit; background: none; padding: 0; }
.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 10px;
  background: var(--bg-elev-3);
  color: var(--fg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-family: var(--font-mono);
  text-transform: lowercase;
  opacity: 0;
  transition: var(--transition-fast);
}
.code-block:hover .copy-btn { opacity: 1; }
.copy-btn:hover { background: var(--bg-active); color: var(--fg-primary); }
.msg-content strong { color: var(--fg-primary); font-weight: 600; }
.msg-content em { color: var(--fg-secondary); font-style: italic; }

.msg-content.streaming::after {
  content: "▍";
  color: var(--accent);
  animation: blink 0.9s steps(2) infinite;
  margin-left: 1px;
}
@keyframes blink { 50% { opacity: 0; } }
.msg-footer {
  margin-top: 8px;
  font-size: 11px;
  color: var(--fg-tertiary);
  font-family: var(--font-mono);
  display: flex;
  gap: 12px;
  align-items: center;
}

/* Export-Buttons (.md / .docx) im Chat-Footer + Workflow-Header */
.export-actions {
  display: inline-flex;
  gap: 6px;
  margin-left: auto;
}
.export-btn {
  padding: 2px 9px;
  background: var(--bg-elev-3);
  color: var(--fg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-family: var(--font-mono);
  cursor: pointer;
  transition: var(--transition-fast);
}
.export-btn:hover {
  background: var(--accent-soft);
  color: var(--accent-hover);
  border-color: var(--accent);
}
.workflow-header .export-actions { margin-left: 12px; }

/* „Ganzen Chat herunterladen" im Topbar-Header */
.session-subline {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.session-export {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.session-export .export-actions { margin-left: 0; }
.session-export-label {
  font-size: 11px;
  color: var(--fg-tertiary);
  font-family: var(--font-mono);
}

/* Tool-Call-Card (inline in der Assistant-Message) */
.tool-card {
  margin: 10px 0;
  padding: 10px 12px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--warn);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-secondary);
}
.tool-card-name { color: var(--warn); font-weight: 600; }

/* Workflow-Run Container */

.workflow-run {
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-elev-1);
  overflow: hidden;
  animation: msgIn 240ms var(--ease) both;
}
.workflow-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg-elev-2);
  border-bottom: 1px solid var(--border);
}
.workflow-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
}
.workflow-meta {
  font-size: 11px;
  color: var(--fg-tertiary);
  font-family: var(--font-mono);
}

.workflow-steps {
  list-style: none;
  margin: 0;
  padding: 0;
}

.wf-cycle-separator {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px 10px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-tertiary);
  background: var(--bg-elev-1);
  border-bottom: 1px solid var(--border);
}
.wf-cycle-separator::before,
.wf-cycle-separator::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}
.wf-cycle-separator span {
  padding: 3px 10px;
  background: var(--bg-elev-3);
  border-radius: 10px;
  color: var(--fg-secondary);
}
.wf-step {
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
}
.wf-step:last-child { border-bottom: none; }
.wf-step.running { background: rgba(94, 108, 255, 0.04); }
.wf-step.status-approved { background: rgba(74, 222, 128, 0.03); }
.wf-step.status-revise { background: rgba(251, 191, 36, 0.03); }
.wf-step.status-rejected, .wf-step.status-error { background: rgba(248, 113, 113, 0.04); }

.wf-step-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  font-size: 12px;
  cursor: pointer;
  user-select: none;
  transition: background var(--transition-fast);
}
.wf-step-head:hover { background: var(--bg-hover); }

.wf-collapse-icon {
  color: var(--fg-tertiary);
  transition: transform 160ms var(--ease);
  margin-left: 4px;
}
.wf-step.collapsed .wf-collapse-icon { transform: rotate(-90deg); }
.wf-step.collapsed .wf-step-body { display: none !important; }
.wf-step-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--bg-elev-3);
  color: var(--fg-secondary);
  display: grid;
  place-items: center;
  font-weight: 600;
  font-size: 11px;
}
.wf-step.running .wf-step-num {
  background: var(--accent);
  color: white;
  animation: pulse 1.4s ease-in-out infinite;
}
.wf-step.status-approved .wf-step-num,
.wf-step.status-completed .wf-step-num { background: var(--ok); color: white; }
.wf-step.status-revise .wf-step-num { background: var(--warn); color: #1f1300; }
.wf-step.status-rejected .wf-step-num,
.wf-step.status-error .wf-step-num { background: var(--err); color: white; }

.wf-step-role {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--bg-elev-3);
  color: var(--fg-secondary);
}
.role-author { color: var(--accent); }
.role-reviewer { color: var(--cyan); }
.role-judge { color: var(--purple); }

.wf-step-name {
  font-weight: 600;
  color: var(--fg-primary);
}
.wf-step-provider {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-tertiary);
  padding: 2px 6px;
  border-radius: 3px;
  background: var(--bg-elev-2);
}
.wf-step-status {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Body ist per Default ausgeblendet (pending), und expliziter sichtbar
   sobald der Step laeuft ODER einen Terminal-Status hat. Wichtig: 'completed'
   muss in der Liste sein, sonst bleibt der Author-Output (ohne Verdict)
   unsichtbar obwohl er existiert. */
.wf-step-body { padding: 0 16px 14px 50px; display: none; }
.wf-step.running .wf-step-body,
.wf-step.status-completed .wf-step-body,
.wf-step.status-approved .wf-step-body,
.wf-step.status-revise .wf-step-body,
.wf-step.status-rejected .wf-step-body,
.wf-step.status-error .wf-step-body {
  display: block;
}
.wf-output {
  font-size: 13px;
  line-height: 1.6;
  color: var(--fg-primary);
  white-space: pre-wrap;
  word-wrap: break-word;
}
.wf-output.streaming::after {
  content: "▍";
  color: var(--accent);
  animation: blink 0.9s steps(2) infinite;
}

.wf-findings {
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--bg-elev-2);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--warn);
}
.wf-findings-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--warn);
  margin-bottom: 6px;
}
.wf-finding {
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--fg-secondary);
  padding: 2px 0;
}
.wf-step-footer {
  margin-top: 8px;
  font-size: 11px;
  color: var(--fg-tertiary);
  font-family: var(--font-mono);
}

/* ============================================================
   COMPOSER
   ============================================================ */

.composer {
  border-top: 1px solid var(--border);
  background: var(--bg-app);
  padding: 16px 24px 20px;
}
.composer-inner {
  max-width: 760px;
  margin: 0 auto;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 12px 14px 10px;
  transition: var(--transition-fast);
}
.composer-inner:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

#prompt {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  font-size: 14px;
  line-height: 1.55;
  color: var(--fg-primary);
  padding: 6px 4px;
  min-height: 24px;
  max-height: 220px;
  overflow-y: auto;
}
#prompt::placeholder { color: var(--fg-tertiary); }

.composer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.composer-options {
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
  flex: 1 1 auto;
  min-width: 0;
}
.composer-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  margin-left: auto;
}

/* --- Dokument-Upload (Anhänge) --- */
.btn-attach {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--fg-secondary);
  font-size: 15px;
  cursor: pointer;
  transition: var(--transition-fast);
}
.btn-attach:hover:not(:disabled) { background: var(--bg-hover); color: var(--fg-primary); }
.btn-attach:disabled { opacity: 0.5; cursor: wait; }
.attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.attachments[hidden] { display: none; }
.attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 240px;
  padding: 4px 6px 4px 10px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-size: 12px;
  color: var(--fg-secondary);
}
.attachment-chip .att-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.att-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--fg-dim);
  cursor: pointer;
  font-size: 11px;
  line-height: 1;
  flex-shrink: 0;
}
.att-remove:hover { background: var(--bg-elev-3); color: var(--fg-primary); }
.workflow-picker {
  max-width: 460px;
  text-overflow: ellipsis;
  overflow: hidden;
}

.mode-toggle {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.mode-btn {
  padding: 5px 14px;
  border-radius: 6px;
  font-size: 12px;
  color: var(--fg-tertiary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  transition: var(--transition-fast);
}
.mode-btn:hover { color: var(--fg-secondary); }
.mode-btn.active {
  background: var(--bg-elev-3);
  color: var(--fg-primary);
  box-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.workflow-picker,
.model-picker,
.effort-picker {
  background: var(--bg-elev-2);
  color: var(--fg-primary);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
  font-family: var(--font-mono);
  letter-spacing: 0.01em;
}
.workflow-picker { min-width: 220px; }
.model-picker { min-width: 130px; }
.effort-picker { min-width: 100px; }
.workflow-picker:hover,
.model-picker:hover,
.effort-picker:hover { background: var(--bg-elev-3); }
.workflow-picker:focus,
.model-picker:focus,
.effort-picker:focus { outline: none; border-color: var(--border-focus); }

.speed-picker {
  background: var(--bg-elev-2);
  color: var(--fg-primary);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 12px;
  cursor: pointer;
  font-family: var(--font-mono);
}
.speed-picker:hover { background: var(--bg-elev-3); }

/* --- Workflow-Combobox --- */

.wf-combobox { position: relative; display: inline-block; }

.wf-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 240px;
  max-width: 360px;
  padding: 5px 10px;
  background: var(--bg-elev-2);
  color: var(--fg-primary);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  font-family: var(--font-mono);
  letter-spacing: 0.01em;
  cursor: pointer;
  text-align: left;
}
.wf-trigger:hover { background: var(--bg-elev-3); }
.wf-trigger:focus { outline: none; border-color: var(--border-focus); }
.wf-trigger[aria-expanded="true"] { border-color: var(--border-focus); }
.wf-trigger #wf-trigger-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wf-caret { opacity: 0.7; font-size: 10px; }

.wf-popover {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  width: min(720px, 90vw);
  max-height: min(480px, 60vh);
  background: var(--bg-elev-1);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 200;
}
/* User-Agent-Default fuer [hidden] wird vom display:flex oben ueberschrieben —
   hier explizit nachziehen, sonst schliesst der Popover nie. */
.wf-popover[hidden] { display: none; }

.wf-search-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.wf-search {
  flex: 1;
  padding: 7px 10px;
  background: var(--bg-elev-2);
  color: var(--fg-primary);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
}
.wf-search:focus { outline: none; border-color: var(--border-focus); }
.wf-count {
  font-size: 11px;
  color: var(--fg-muted);
  font-family: var(--font-mono);
  white-space: nowrap;
}

.wf-body {
  display: grid;
  grid-template-columns: minmax(220px, 40%) 1fr;
  overflow: hidden;
  flex: 1;
}

.wf-list {
  margin: 0;
  padding: 4px 0;
  list-style: none;
  overflow-y: auto;
  border-right: 1px solid var(--border);
  min-height: 0;
}
.wf-list-item {
  padding: 7px 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-left: 2px solid transparent;
}
.wf-list-item:hover,
.wf-list-item.is-focused { background: var(--bg-elev-2); }
.wf-list-item.is-active {
  background: var(--bg-elev-2);
  border-left-color: var(--accent, #5e6cff);
}
.wf-list-title {
  font-size: 13px;
  color: var(--fg-primary);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wf-list-meta {
  font-size: 10px;
  color: var(--fg-muted);
  font-family: var(--font-mono);
  display: flex;
  gap: 6px;
}
.wf-list-empty {
  padding: 24px 12px;
  text-align: center;
  color: var(--fg-muted);
  font-size: 12px;
}
.wf-source-badge {
  display: inline-block;
  padding: 0 5px;
  border-radius: 3px;
  background: var(--bg-elev-3);
  color: var(--fg-muted);
  font-size: 10px;
  letter-spacing: 0.02em;
}
.wf-source-badge.builtin { color: #a78bfa; }
.wf-source-badge.custom { color: #67e8f9; }
.wf-source-badge.override { color: #fbbf24; }

.wf-preview {
  padding: 14px 16px;
  overflow-y: auto;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--fg-secondary);
  min-height: 0;
}
.wf-preview-empty {
  color: var(--fg-muted);
  font-style: italic;
  padding-top: 8px;
}
.wf-preview h3 {
  margin: 0 0 4px 0;
  font-size: 14px;
  color: var(--fg-primary);
  font-weight: 600;
}
.wf-preview-id {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--fg-muted);
  margin-bottom: 10px;
}
.wf-preview-desc { margin-bottom: 14px; color: var(--fg-primary); }
.wf-preview-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--fg-muted);
}
.wf-preview-meta > span {
  padding: 2px 6px;
  background: var(--bg-elev-2);
  border-radius: 3px;
}
.wf-preview-step {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.wf-preview-step-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-primary);
}
.wf-preview-step-role {
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--bg-elev-2);
  color: var(--fg-muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.wf-preview-prompt {
  white-space: pre-wrap;
  font-family: var(--font-mono);
  font-size: 11.5px;
  background: var(--bg-elev-2);
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--fg-primary);
  max-height: 220px;
  overflow-y: auto;
}

@media (max-width: 680px) {
  .wf-body { grid-template-columns: 1fr; }
  .wf-list { border-right: none; border-bottom: 1px solid var(--border); max-height: 200px; }
}

[data-mode-only] { transition: opacity 120ms var(--ease); }
[data-mode-only][hidden] { display: none; }

.provider-toggle {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.provider-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 12px;
  color: var(--fg-tertiary);
  font-weight: 500;
  transition: var(--transition-fast);
}
.provider-btn:hover { color: var(--fg-secondary); }
.provider-btn.active {
  background: var(--bg-elev-3);
  color: var(--fg-primary);
  box-shadow: 0 1px 2px rgba(0,0,0,0.3);
}
.provider-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.opt {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--fg-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 500;
}
.opt input[type="number"] {
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  width: 52px;
  text-align: center;
  color: var(--fg-primary);
  font-family: var(--font-mono);
}

.btn-cancel {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  color: var(--fg-secondary);
  font-size: 13px;
  font-weight: 500;
  transition: var(--transition-fast);
}
.btn-cancel:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--err);
}
.btn-cancel:disabled { opacity: 0.3; cursor: not-allowed; }

.btn-send {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--accent);
  color: white;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  transition: var(--transition-fast);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}
.btn-send:hover:not(:disabled) {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px -2px rgba(94, 108, 255, 0.4);
}
.btn-send:active:not(:disabled) { transform: translateY(0); }
.btn-send:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-send kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  background: rgba(255, 255, 255, 0.16);
  padding: 2px 5px;
  border-radius: 3px;
  font-weight: 500;
}

/* ============================================================
   INSPECTOR
   ============================================================ */

.inspector {
  background: var(--bg-elev-1);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  position: relative;
}

.inspector-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  padding: 0 16px 0 40px;
}
.tab {
  padding: 16px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-tertiary);
  border-bottom: 2px solid transparent;
  transition: var(--transition-fast);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.tab:hover { color: var(--fg-secondary); }
.tab.active {
  color: var(--fg-primary);
  border-bottom-color: var(--accent);
}

.tab-pane {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
}
.tab-pane.active { display: block; }

/* Events list */

.events {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.event {
  padding: 8px 10px 8px 12px;
  background: var(--bg-elev-2);
  border-radius: var(--radius-sm);
  border-left: 2px solid var(--border-strong);
  font-family: var(--font-mono);
  font-size: 11px;
  animation: msgIn 200ms var(--ease) both;
}
.event-type {
  font-weight: 700;
  color: var(--fg-secondary);
  margin-bottom: 2px;
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.event-detail {
  color: var(--fg-primary);
  word-break: break-word;
}
.event.SessionStart { border-left-color: var(--purple); }
.event.SessionStart .event-type { color: var(--purple); }
.event.TextDelta { border-left-color: var(--accent); }
.event.TextDelta .event-type { color: var(--accent); }
.event.ToolCallStart { border-left-color: var(--warn); }
.event.ToolCallStart .event-type { color: var(--warn); }
.event.ToolCallInput { border-left-color: var(--warn); opacity: 0.85; }
.event.ToolResult { border-left-color: var(--cyan); }
.event.ToolResult .event-type { color: var(--cyan); }
.event.UsageDelta { border-left-color: var(--fg-tertiary); }
.event.Done { border-left-color: var(--ok); }
.event.Done .event-type { color: var(--ok); }
.event.Error { border-left-color: var(--err); }
.event.Error .event-type { color: var(--err); }

.events-empty {
  text-align: center;
  padding: 40px 16px;
  font-size: 12px;
  color: var(--fg-tertiary);
}

/* Usage */

.usage-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.usage-card {
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}
.usage-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-tertiary);
  margin-bottom: 10px;
}
.usage-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 12px;
  border-bottom: 1px solid var(--border);
}
.usage-row:last-child { border-bottom: none; }
.usage-row > span:first-child { color: var(--fg-secondary); }
.usage-row > span:last-child {
  color: var(--fg-primary);
  font-family: var(--font-mono);
  font-weight: 500;
}

/* ============================================================
   TOAST
   ============================================================ */

.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  padding: 12px 16px;
  background: var(--bg-elev-3);
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--err);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--fg-primary);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  max-width: 360px;
  pointer-events: all;
  animation: toastIn 280ms var(--ease) both;
}
.toast.ok { border-left-color: var(--ok); }
.toast.warn { border-left-color: var(--warn); }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(8px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.toast.fade-out { animation: toastOut 220ms var(--ease) forwards; }
@keyframes toastOut {
  to { opacity: 0; transform: translateY(8px) scale(0.96); }
}

/* ============================================================
   LOGIN
   ============================================================ */

/* ============================================================
   Login — Split-Screen (Vorlage: ai-strategy-consulting.de/login.html)
   Eigenes Farbschema (Indigo/Violett), bewusst literal statt App-Tokens,
   da der Login eine eigenständige Vollbild-Oberfläche ist.
   ============================================================ */
.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  overflow: auto;
  color: #e2e8f0;
  background: #070912;
  background-image:
    radial-gradient(1600px 800px at 8% 12%, rgba(99, 102, 241, 0.2), transparent 60%),
    radial-gradient(1200px 700px at 95% 85%, rgba(16, 185, 129, 0.1), transparent 60%),
    radial-gradient(800px 500px at 50% 50%, rgba(139, 92, 246, 0.06), transparent 60%);
  animation: fadeIn 200ms var(--ease);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.login-overlay[hidden] { display: none; }
.login-overlay::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.022) 1px, transparent 1px);
  background-size: 80px 80px;
  -webkit-mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
  mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
}
.login-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.4fr 1fr;
}

/* Hero (links) */
.login-hero {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 3rem 3.5rem;
  min-width: 0;
}
.login-brandrow { display: inline-flex; align-items: center; gap: 0.7rem; }
.login-mark {
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 0.5rem;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45);
}
.login-ver {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #34d399;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
}
.login-brandtext {
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 700;
  color: #cbd5e1;
}
.login-hero-mid { margin-top: auto; margin-bottom: auto; }
.login-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: #a5b4fc;
  padding: 0.35rem 0.7rem;
  border-radius: 99px;
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(165, 180, 252, 0.25);
  margin-bottom: 1.5rem;
}
.login-dot {
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  background: #a5b4fc;
  box-shadow: 0 0 8px #a5b4fc;
}
.login-h1 {
  font-size: clamp(2.4rem, 4.8vw, 4.2rem);
  font-weight: 900;
  /* line-height + padding-bottom geben der Unterlaenge ('g') Raum — sonst schneidet
     -webkit-background-clip:text sie an der unteren Paint-Kante ab. */
  line-height: 1.08;
  padding-bottom: 0.12em;
  letter-spacing: -0.035em;
  background: linear-gradient(180deg, #fff 0%, #94a3b8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 0.8rem;
}
.login-h1 em {
  font-style: normal;
  background: linear-gradient(90deg, #a5b4fc, #34d399 60%, #fde047);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.login-heroteaser {
  font-size: 1.05rem;
  color: #94a3b8;
  line-height: 1.55;
  max-width: 30rem;
  margin-bottom: 2.5rem;
}
.login-tags { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.login-tag {
  font-size: 0.78rem;
  font-weight: 500;
  color: #cbd5e1;
  padding: 0.4rem 0.8rem;
  border-radius: 99px;
  background: rgba(30, 41, 59, 0.6);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(148, 163, 184, 0.18);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.login-ic { width: 0.7rem; height: 0.7rem; border-radius: 50%; }
.login-ic.i1 { background: #6366f1; box-shadow: 0 0 8px #6366f1; }
.login-ic.i2 { background: #10b981; box-shadow: 0 0 8px #10b981; }
.login-ic.i3 { background: #f59e0b; box-shadow: 0 0 8px #f59e0b; }
.login-ic.i4 { background: #ec4899; box-shadow: 0 0 8px #ec4899; }
.login-ic.i5 { background: #22d3ee; box-shadow: 0 0 8px #22d3ee; }
.login-hero-bot { font-size: 0.74rem; color: #475569; }

/* Auth-Card (rechts) */
.login-auth {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 3rem;
}
.login-card {
  width: 100%;
  max-width: 24rem;
  background: rgba(15, 23, 42, 0.55);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 1.1rem;
  padding: 2rem 2rem 1.6rem;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.04) inset,
    0 24px 60px -20px rgba(0, 0, 0, 0.6);
  animation: loginCardIn 0.5s cubic-bezier(0.22, 0.61, 0.36, 1);
}
@keyframes loginCardIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
.login-card-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: #f1f5f9;
  margin-bottom: 0.35rem;
}
.login-card-lead {
  font-size: 0.85rem;
  color: #94a3b8;
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

#login-form { display: block; }
.login-field { margin-bottom: 1rem; }
.login-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: #cbd5e1;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin: 0 0 0.4rem;
}
.login-input-wrap { position: relative; }
#login-email,
#login-password {
  width: 100%;
  background: rgba(11, 18, 32, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 0.6rem;
  padding: 0.8rem 2.5rem 0.8rem 2.4rem;
  color: #f1f5f9;
  font: inherit;
  font-size: 0.92rem;
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
#login-email:focus,
#login-password:focus {
  border-color: rgba(165, 180, 252, 0.6);
  background: rgba(11, 18, 32, 0.9);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}
#login-email:disabled,
#login-password:disabled { opacity: 0.6; cursor: not-allowed; }
.login-input-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1.05rem;
  height: 1.05rem;
  color: #64748b;
  pointer-events: none;
}
.login-pwd-toggle {
  position: absolute;
  right: 0.55rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1.7rem;
  height: 1.7rem;
  background: transparent;
  border: 0;
  color: #64748b;
  cursor: pointer;
  border-radius: 0.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-pwd-toggle:hover { color: #cbd5e1; background: rgba(148, 163, 184, 0.08); }
.login-pwd-toggle svg { width: 1.05rem; height: 1.05rem; }

.login-error {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(239, 68, 68, 0.1);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 0.55rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.82rem;
  margin-bottom: 1rem;
  text-align: left;
}
.login-error[hidden] { display: none; }

.login-btn {
  width: 100%;
  margin-top: 0.5rem;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border: 0;
  color: #fff;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.85rem;
  border-radius: 0.6rem;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.35);
  transition: filter 0.15s, transform 0.1s, box-shadow 0.2s;
}
.login-btn:hover:not(:disabled) {
  filter: brightness(1.1);
  box-shadow: 0 12px 32px rgba(99, 102, 241, 0.45);
  transform: translateY(-1px);
}
.login-btn:active:not(:disabled) { transform: translateY(0); }
.login-btn:disabled { opacity: 0.7; cursor: wait; }

/* Google + Divider (per /api/auth/status getoggelt; aktuell deaktiviert) */
.login-divider {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 1rem 0 0.8rem;
  color: #64748b;
  font-size: 0.75rem;
}
.login-divider[hidden] { display: none; }
.login-divider::before,
.login-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(148, 163, 184, 0.18);
}
.login-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.7rem;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 0.6rem;
  background: rgba(30, 41, 59, 0.5);
  color: #f1f5f9;
  font-size: 0.9rem;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.login-google[hidden] { display: none; }
.login-google:hover { background: rgba(51, 65, 85, 0.6); border-color: rgba(148, 163, 184, 0.35); }

.login-hint {
  margin-top: 1rem;
  padding: 0.7rem 0.8rem;
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 0.5rem;
  font-size: 0.76rem;
  color: #94a3b8;
  line-height: 1.5;
}
.login-hint code {
  display: inline-block;
  margin-top: 0.35rem;
  padding: 0.15rem 0.4rem;
  background: rgba(11, 18, 32, 0.8);
  color: #a5b4fc;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  border-radius: 0.25rem;
  word-break: break-all;
}
.login-cardfoot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  margin-top: 1.2rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(148, 163, 184, 0.1);
  font-size: 0.72rem;
  color: #64748b;
}
.login-cardfoot svg { width: 0.8rem; height: 0.8rem; }

@media (max-width: 920px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-hero { padding: 2.5rem 2rem; text-align: center; align-items: center; }
  .login-hero-mid { margin: 1rem 0; }
  .login-auth { padding: 1rem 2rem 2.5rem; }
  .login-tags { justify-content: center; }
}
@media (max-width: 480px) {
  .login-hero { padding: 2rem 1.5rem; }
  .login-auth { padding: 1rem 1.5rem 2rem; }
  .login-card { padding: 1.75rem 1.5rem 1.4rem; }
}

/* ============================================================
   RESPONSIVE — schmal: Inspector ausblenden
   ============================================================ */

@media (max-width: 1100px) {
  body { grid-template-columns: var(--sidebar-w) 1fr; }
  .inspector { display: none; }
}
@media (max-width: 720px) {
  body { grid-template-columns: 1fr; }
  .sidebar { display: none; }
}

/* ============================================================
   MULTI-USER (ADR-0006): User-Menü, Login, Modals, Settings, Admin
   ============================================================ */

/* --- Mode-Chip im Composer --- */
.mode-chip {
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--fg-tertiary);
  background: var(--bg-elev-2);
  align-self: center;
  cursor: default;
}
.mode-chip.is-api { color: var(--ok); border-color: rgba(74, 222, 128, 0.35); }

/* --- User-Menü (Topbar) --- */
.user-menu { position: relative; display: flex; align-items: center; }
.user-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: linear-gradient(135deg, var(--accent), var(--purple));
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform var(--transition-fast);
}
.user-avatar:hover { transform: scale(1.06); }
.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 230px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  padding: 6px;
  z-index: 60;
}
.user-dropdown-head {
  padding: 8px 10px 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}
.user-dd-name { font-weight: 600; }
.user-dd-email { font-size: 12px; color: var(--fg-tertiary); word-break: break-all; }
.role-badge {
  display: inline-block;
  margin-top: 6px;
  font-size: 10.5px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-elev-3);
  color: var(--fg-secondary);
}
.role-badge.is-admin { color: var(--warn); }
.user-dropdown-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--fg-primary);
  font-size: 13px;
  cursor: pointer;
}
.user-dropdown-item:hover { background: var(--bg-hover); }
.user-dropdown-item.danger { color: var(--err); }

/* --- Login: Google + Divider --- in den konsolidierten Split-Screen-Block oben verschoben --- */

/* --- Modal-Grundgerüst --- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(5, 6, 10, 0.72);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  z-index: 80;
  padding: 24px;
}
.modal {
  width: min(640px, 100%);
  max-height: 86vh;
  display: flex; flex-direction: column;
  background: var(--bg-elev-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}
.modal-wide { width: min(980px, 100%); }
.modal-narrow { width: min(440px, 100%); }

/* Passwort-ändern-Modal (ADR-0007) */
#pwchange-form input[type="password"] {
  width: 100%;
  padding: 8px 11px;
  margin-bottom: 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--fg-primary);
  font-size: 13px;
  font-family: var(--font-sans);
}
#pwchange-form input[type="password"]:focus { outline: none; border-color: var(--border-focus); }
.mtab-status.ok { color: var(--ok, #4ade80); }
.mtab-status.err { color: var(--err); }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px 12px;
}
.modal-head h2 { margin: 0; font-size: 16px; }
.modal-close {
  background: transparent; border: none;
  color: var(--fg-tertiary);
  font-size: 22px; line-height: 1;
  cursor: pointer;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}
.modal-close:hover { color: var(--fg-primary); background: var(--bg-hover); }
.modal-tabs {
  display: flex; gap: 4px;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
}
.modal-tab {
  padding: 8px 14px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--fg-tertiary);
  font-size: 13px;
  cursor: pointer;
}
.modal-tab.active { color: var(--fg-primary); border-bottom-color: var(--accent); }
.modal-body { padding: 16px 20px 20px; overflow-y: auto; }
.mtab { display: none; }
.mtab.active { display: block; }
.mtab-info { color: var(--fg-tertiary); font-size: 12.5px; margin: 0 0 14px; }
.mtab-info-inline { color: var(--fg-tertiary); font-size: 12px; }
.mtab-actions { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.mtab-status { font-size: 12.5px; color: var(--fg-secondary); }

.btn-primary {
  padding: 8px 16px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary {
  padding: 6px 12px;
  background: var(--bg-elev-3);
  color: var(--fg-primary);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  cursor: pointer;
}
.btn-secondary:hover { background: var(--bg-hover); }
.btn-secondary:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-secondary.danger { color: var(--err); }

/* --- Einstellungen: API-Keys --- */
.key-row {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 12px;
  background: var(--bg-elev-2);
}
.key-row-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.key-provider { font-weight: 600; }
.key-state {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-dim);
}
.key-state.is-set { color: var(--ok); }
.key-row-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.key-input {
  flex: 1;
  min-width: 180px;
  padding: 7px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--fg-primary);
  font-family: var(--font-mono);
  font-size: 12.5px;
}
.key-input:focus { outline: none; border-color: var(--border-focus); }
.key-row-status { margin-top: 8px; font-size: 12px; min-height: 14px; }
.key-row-status.ok { color: var(--ok); }
.key-row-status.err { color: var(--err); }

/* --- Einstellungen: Modelle & Verbindung --- */
.conn-row {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.conn-engine { width: 130px; font-weight: 600; flex-shrink: 0; }
.conn-controls { display: flex; gap: 8px; flex: 1; flex-wrap: wrap; align-items: center; }
.conn-mode, .conn-model {
  padding: 6px 8px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--fg-primary);
  font-size: 12.5px;
}
.conn-mode-fixed {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ok);
  padding: 6px 10px;
  border: 1px solid rgba(74, 222, 128, 0.3);
  border-radius: var(--radius-sm);
}
.conn-custom {
  flex: 1;
  min-width: 160px;
  padding: 6px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--fg-primary);
  font-family: var(--font-mono);
  font-size: 12px;
}
.conn-custom:focus { outline: none; border-color: var(--border-focus); }

/* --- Admin: Benutzer-Tabelle --- */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.admin-table th {
  text-align: left;
  color: var(--fg-tertiary);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border-strong);
}
.admin-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); }
.admin-table tr.is-disabled td { opacity: 0.5; }
.admin-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.admin-subhead { font-size: 13.5px; margin: 20px 0 10px; }
.admin-user-form { display: flex; gap: 8px; flex-wrap: wrap; }
.admin-user-form input, .admin-user-form select {
  padding: 7px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--fg-primary);
  font-size: 12.5px;
}
.admin-user-form input:focus { outline: none; border-color: var(--border-focus); }

/* --- Admin: Workflow-Editor --- */
.admin-wf-layout { display: flex; gap: 16px; min-height: 320px; }
.admin-wf-list-col { width: 240px; flex-shrink: 0; display: flex; flex-direction: column; gap: 8px; }
.admin-wf-list {
  list-style: none; margin: 0; padding: 0;
  overflow-y: auto;
  max-height: 52vh;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.admin-wf-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 9px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
}
.admin-wf-item:last-child { border-bottom: none; }
.admin-wf-item:hover { background: var(--bg-hover); }
.admin-wf-item.is-active { background: var(--accent-soft); }
.admin-wf-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-wf-editor { flex: 1; min-width: 0; }
.wf-ed-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.wf-ed-id {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--bg-elev-3);
  padding: 3px 8px;
  border-radius: 4px;
}
.wf-ed-label {
  display: block;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--fg-tertiary);
  margin: 12px 0 4px;
}
.admin-wf-editor input[type="text"], .admin-wf-editor input[type="number"],
.admin-wf-editor textarea, .admin-wf-editor select {
  width: 100%;
  padding: 7px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--fg-primary);
  font-size: 12.5px;
  font-family: var(--font-sans);
}
.admin-wf-editor textarea.st-prompt { font-family: var(--font-mono); font-size: 12px; line-height: 1.5; }
.admin-wf-editor input:focus, .admin-wf-editor textarea:focus, .admin-wf-editor select:focus {
  outline: none; border-color: var(--border-focus);
}
.wf-ed-step {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 12px 0;
  padding: 10px 12px 12px;
}
.wf-ed-step legend {
  font-size: 11.5px;
  color: var(--fg-tertiary);
  padding: 0 6px;
}
.wf-ed-step-grid {
  display: grid;
  grid-template-columns: 1.4fr 0.9fr 1fr 0.8fr 1.2fr auto auto;
  gap: 6px;
  margin-bottom: 8px;
  align-items: center;
}
.st-verdict-label {
  display: flex; align-items: center; gap: 5px;
  font-size: 12px;
  color: var(--fg-secondary);
  white-space: nowrap;
}
.wf-ed-actions { display: flex; align-items: center; gap: 10px; margin-top: 14px; }

@media (max-width: 860px) {
  .admin-wf-layout { flex-direction: column; }
  .admin-wf-list-col { width: 100%; }
  .wf-ed-step-grid { grid-template-columns: 1fr 1fr; }
}

/* [hidden] schlaegt display:flex nicht von allein (User-Agent-Spezifitaet) —
   ohne diese Regel faengt das unsichtbare Modal Pointer-Events ab. */
.modal-overlay[hidden] { display: none; }

/* ============================================================
   WORKFLOW-KATEGORIEN, ORCHESTRATOR-VORSCHLAG, ADMIN-REORDER
   ============================================================ */

/* Kategorie-Header in der Workflow-Combobox */
.wf-group {
  list-style: none;
  padding: 10px 12px 4px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--fg-tertiary);
  pointer-events: none;
  position: sticky;
  top: 0;
  background: var(--bg-elev-1);
  z-index: 1;
}
.wf-group:first-child { padding-top: 4px; }

/* Orchestrator-Vorschlagskarte (1-Klick-Start) */
.wf-suggestion {
  margin: 14px 0;
  padding: 16px;
  border: 1px solid var(--accent);
  border-radius: var(--radius-lg);
  background: var(--accent-soft);
}
.wf-suggestion-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.wf-suggestion-icon { font-size: 22px; }
.wf-suggestion-label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--fg-tertiary);
}
.wf-suggestion-title { font-size: 15px; font-weight: 700; color: var(--fg-primary); }
.wf-suggestion-prompt {
  background: var(--bg-elev-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--fg-secondary);
  white-space: pre-wrap;
  max-height: 160px;
  overflow-y: auto;
}
.wf-suggestion-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.wf-suggestion-warn { margin-top: 8px; color: var(--warn); font-size: 12.5px; }

/* Admin: Kategorie-Header + Suche in der Workflow-Liste */
.admin-wf-group {
  padding: 9px 12px 3px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-tertiary);
  background: var(--bg-elev-2);
  border-bottom: 1px solid var(--border);
}
.admin-wf-search {
  width: 100%;
  padding: 7px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--fg-primary);
  font-size: 12.5px;
  margin-bottom: 6px;
}
.admin-wf-search:focus { outline: none; border-color: var(--border-focus); }

/* Admin-Editor: Step-Reorder-Buttons */
.st-reorder { display: flex; gap: 4px; align-items: center; }
.btn-icon {
  flex: 0 0 auto; /* in Flex-Containern (.st-reorder) nicht auf Glyph-Breite schrumpfen */
  width: 28px; height: 28px;
  padding: 0;
  background: var(--bg-elev-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--fg-secondary);
  font-size: 13px;
  cursor: pointer;
  line-height: 1;
}
.btn-icon:hover { background: var(--bg-hover); color: var(--fg-primary); }
.btn-icon.danger { color: var(--err); }

/* Composer: Combobox im Workflow-Modus sichtbar machen ([hidden] respektieren) */
.wf-combobox[hidden], .mode-chip[hidden] { display: none; }

/* ============================================================
   ADMIN-FENSTER GRÖSSER + PROMPTS BESSER LESBAR (User-Feedback)
   ============================================================ */
.modal { max-height: 92vh; }
.modal-wide { width: min(1340px, 96vw); }
.admin-wf-layout { min-height: 64vh; }
.admin-wf-list { max-height: 64vh; }
.admin-wf-editor { max-height: 70vh; overflow-y: auto; padding-right: 6px; }
.admin-wf-editor textarea.st-prompt {
  min-height: 240px;
  line-height: 1.55;
  resize: vertical;
}
#wfed-desc { min-height: 70px; resize: vertical; }
.st-prompt-label {
  display: block;
  margin: 8px 0 4px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--fg-tertiary);
}

.wf-suggestion-auto {
  margin: 4px 0 10px;
  font-size: 12.5px;
  color: var(--accent-hover);
  font-style: italic;
}

/* ---------- Use-Case-Launcher (ADR-0007) ---------- */
.launcher-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: var(--bg-app);
  display: flex;
  flex-direction: column;
  overflow: auto;
}
/* display:flex oben wuerde das [hidden]-Attribut sonst aushebeln */
.launcher-overlay[hidden] { display: none; }
.launcher-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  border-bottom: 1px solid var(--border-strong);
  flex-shrink: 0;
}
.launcher-brand { display: flex; align-items: center; gap: 12px; }
.launcher-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: var(--radius-sm);
  background: var(--accent); color: #fff; font-weight: 600; font-size: 13px;
}
.launcher-brandname { font-size: 15px; font-weight: 600; color: var(--fg-primary); }
.launcher-brandtag { font-size: 12px; color: var(--fg-tertiary); }
.launcher-account { display: flex; align-items: center; gap: 14px; }
.launcher-user { font-size: 13px; color: var(--fg-secondary); }
.launcher-logout {
  font-size: 13px; color: var(--fg-secondary);
  background: var(--bg-elev-1); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); padding: 6px 12px; cursor: pointer;
  transition: var(--transition-fast);
}
.launcher-logout:hover { background: var(--bg-hover); color: var(--fg-primary); }
.launcher-main {
  flex: 1; width: 100%; max-width: 1000px;
  margin: 0 auto; padding: 40px 28px 56px;
}
.launcher-h1 { font-size: 22px; font-weight: 600; color: var(--fg-primary); margin: 0 0 24px; }
.launcher-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.uc-card {
  position: relative;
  display: flex; flex-direction: column; gap: 8px; align-items: flex-start;
  text-align: left; min-height: 132px; padding: 18px;
  background: var(--bg-elev-1); border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg); color: var(--fg-primary);
  cursor: pointer; transition: var(--transition-fast);
}
.uc-card:hover:not(:disabled) { border-color: var(--accent); transform: translateY(-1px); }
.uc-card:disabled { cursor: default; opacity: 0.5; }
.uc-current { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.uc-placeholder { border-style: dashed; background: transparent; }
.uc-ic { color: var(--accent); line-height: 0; }
.uc-placeholder .uc-ic { color: var(--fg-dim); }
.uc-ic svg { width: 26px; height: 26px; }
.uc-title { font-size: 15px; font-weight: 600; }
.uc-sub { font-size: 12px; color: var(--fg-tertiary); line-height: 1.4; }
.uc-badge {
  position: absolute; top: 14px; right: 14px;
  font-size: 10px; padding: 2px 7px; border-radius: var(--radius-sm);
}
.uc-badge-self { background: var(--accent); color: #fff; }
.uc-badge-ext {
  background: var(--bg-elev-3); color: var(--fg-tertiary);
  border: 1px solid var(--border-strong);
}
.uc-note { font-size: 11px; color: var(--fg-tertiary); margin-top: auto; }
.topbar-launcher {
  display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0;
  font-size: 13px; color: var(--fg-secondary);
  background: var(--bg-elev-1); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); padding: 5px 10px; cursor: pointer;
  transition: var(--transition-fast);
}
.topbar-launcher:hover { background: var(--bg-hover); color: var(--fg-primary); }
@media (max-width: 760px) {
  .launcher-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
