/* Arkenstone Neumorphism Design System — layout & structure; visual theme overridden by studio-design.css */

:root {
  --neu-bg: #2a2e36;
  --neu-light: #363b44;
  --neu-dark: #1e2128;
  --neu-radius: 16px;
  --neu-radius-sm: 12px;
  --neu-distance: 5px;
  --neu-blur: 10px;
  --neu-accent: #6b8cff;
  --neu-accent-soft: rgba(107, 140, 255, 0.42);
  --neu-text: #e8edf7;
  --neu-text-muted: #9aaccc;
  --neu-extrude-shadow:
    calc(var(--neu-distance) * -1) calc(var(--neu-distance) * -1) var(--neu-blur) rgba(54, 59, 68, 0.45),
    var(--neu-distance) var(--neu-distance) var(--neu-blur) rgba(0, 0, 0, 0.48);
  --neu-float-shadow:
    0 10px 28px rgba(0, 0, 0, 0.52),
    0 1px 0 rgba(255, 255, 255, 0.04) inset;
  --neu-inset-shadow:
    inset 3px 3px 6px rgba(0, 0, 0, 0.42),
    inset -2px -2px 5px rgba(255, 255, 255, 0.035);
  --neu-focus-ring: 0 0 0 2px var(--neu-accent-soft);
  --neu-ui-font-size: 0.8125rem;
  --neu-ui-padding-y: 0.55rem;
  --neu-ui-padding-x: 0.85rem;
  --neu-ui-min-height: 44px;
  --workspace-topbar-clearance: 3.5rem;
  --workspace-content-gap: 0.55rem;
}

/* Primitives */

.neu-extrude {
  background: var(--neu-bg);
  border: none;
  border-radius: var(--neu-radius-sm);
  box-shadow: var(--neu-extrude-shadow);
  transition: box-shadow 160ms ease, transform 160ms ease;
}

.neu-inset {
  background: var(--neu-bg);
  box-shadow: var(--neu-inset-shadow);
}

.neu-pressable {
  transition: box-shadow 160ms ease;
}

.neu-pressable:active,
.neu-pressable.neu-pressed {
  box-shadow: var(--neu-inset-shadow);
}

.neu-focusable:focus-visible {
  outline: none;
  box-shadow: var(--neu-extrude-shadow), var(--neu-focus-ring);
}

/* Components */

.neu-btn {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border: none;
  background: var(--neu-bg);
  color: var(--neu-text-muted);
  border-radius: var(--neu-radius-sm);
  padding: var(--neu-ui-padding-y) var(--neu-ui-padding-x);
  min-height: var(--neu-ui-min-height);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: var(--neu-extrude-shadow);
  transition: box-shadow 160ms ease, color 160ms ease;
}

.neu-btn:hover {
  color: var(--neu-text);
}

.neu-btn:active {
  box-shadow: var(--neu-inset-shadow);
}

.neu-btn:focus-visible {
  outline: none;
  box-shadow: var(--neu-extrude-shadow), var(--neu-focus-ring);
}

.neu-btn-primary {
  color: var(--neu-accent);
}

.neu-btn-primary:hover {
  color: var(--neu-text);
}

.neu-btn-danger {
  color: #ff8a9a;
}

.neu-btn-danger:hover {
  color: #ffb4b8;
}

.neu-btn-sm {
  min-height: 32px;
  padding: 0.35rem 0.65rem;
  font-size: 12px;
}

.neu-panel {
  background: var(--neu-bg);
  border: none;
  border-radius: var(--neu-radius);
  box-shadow: var(--neu-float-shadow);
  color: var(--neu-text);
}

.neu-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100010;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(0, 0, 12, 0.72);
}

.neu-modal-overlay.open,
.neu-modal-overlay:not([hidden]) {
  display: flex;
}

.neu-modal-overlay--raised {
  z-index: 100020;
  background: rgba(0, 0, 12, 0.78);
}

.neu-modal-card {
  width: min(520px, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  background: var(--neu-bg);
  border: none;
  border-radius: var(--neu-radius);
  box-shadow: var(--neu-float-shadow);
  padding: 1.25rem 1.35rem 1.35rem;
  color: var(--neu-text);
}

.neu-modal-card--wide {
  width: min(900px, calc(100vw - 2rem));
}

.neu-modal-card--agent {
  width: min(820px, calc(100vw - 2rem));
}

.neu-modal-card--staging {
  width: min(1100px, calc(100vw - 2rem));
}

.neu-modal-card--detail {
  width: min(640px, calc(100vw - 2rem));
}

.neu-modal-card h2,
.neu-modal-card h3 {
  font-size: 1.1rem;
  margin: 0 0 0.85rem;
  color: var(--neu-text);
}

.neu-modal-card h5 {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--neu-text);
  margin: 0 0 0.55rem;
}

.neu-modal-card h5.neu-section-gap {
  margin-top: 15px;
}

.neu-field,
.wizard-field,
.ai-upload-field,
.staging-field {
  margin-bottom: 0.75rem;
}

.neu-field label,
.wizard-field label,
.ai-upload-field label,
.staging-field label {
  display: block;
  font-size: 12px;
  color: var(--neu-text-muted);
  margin-bottom: 0.35rem;
}

.neu-input,
.neu-modal-card input[type="text"],
.neu-modal-card input[type="file"],
.neu-modal-card input[type="datetime-local"],
.neu-modal-card input[type="date"],
.neu-modal-card input[type="number"],
.neu-modal-card textarea,
.neu-modal-card select,
#ark-select {
  width: 100%;
  border: none;
  border-radius: var(--neu-radius-sm);
  background: var(--neu-bg);
  color: var(--neu-text);
  padding: var(--neu-ui-padding-y) var(--neu-ui-padding-x);
  min-height: var(--neu-ui-min-height);
  font: inherit;
  font-size: var(--neu-ui-font-size);
  outline: none;
  box-shadow: var(--neu-inset-shadow);
  transition: box-shadow 160ms ease;
}

.neu-modal-card textarea {
  min-height: 88px;
  resize: vertical;
}

.neu-modal-card input:focus,
.neu-modal-card textarea:focus,
.neu-modal-card select:focus,
.neu-input:focus,
#ark-select:focus {
  outline: none;
  box-shadow: var(--neu-inset-shadow), var(--neu-focus-ring);
}

.neu-modal-card input[readonly] {
  opacity: 0.75;
  cursor: not-allowed;
}

#ark-select {
  width: auto;
  min-width: 220px;
  cursor: pointer;
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--neu-text-muted) 50%),
    linear-gradient(135deg, var(--neu-text-muted) 50%, transparent 50%);
  background-position:
    calc(100% - 0.95rem) calc(50% + 0.12rem),
    calc(100% - 0.7rem) calc(50% + 0.12rem);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 1.65rem;
}

.neu-hint,
.ai-upload-intro {
  font-size: 12px;
  color: var(--neu-text-muted);
  line-height: 1.45;
  margin: 0 0 1rem;
}

.neu-hint--sm {
  font-size: 11px;
  margin: 0.5rem 0 0;
}

.neu-actions,
.wizard-actions,
.ai-upload-actions {
  margin-top: 1.25rem;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.neu-actions .neu-btn,
.wizard-actions .neu-btn,
.ai-upload-actions .neu-btn {
  flex: 1 1 auto;
  min-width: 140px;
}

.neu-btn-row {
  margin-top: 0.75rem;
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.neu-status-text {
  margin-top: 0.75rem;
  font-size: 12px;
  color: var(--neu-text-muted);
}

/* Menu items */

.neu-menu-item {
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  color: var(--neu-text);
  border-radius: var(--neu-radius-sm);
  padding: 0.55rem 0.85rem;
  min-height: 44px;
  font-size: 13px;
  cursor: pointer;
  box-shadow: none;
  transition: background 160ms ease, box-shadow 160ms ease, color 160ms ease;
}

.neu-menu-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--neu-text);
}

.neu-menu-item:active {
  background: transparent;
  box-shadow: var(--neu-inset-shadow);
}

.neu-menu-item:focus-visible {
  outline: none;
  box-shadow: var(--neu-inset-shadow), var(--neu-focus-ring);
}

.neu-menu-separator {
  height: 1px;
  margin: 0.35rem 0.25rem;
  background: rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

.main-menu-submenu {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.main-menu-submenu-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.main-menu-submenu-label {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  min-width: 0;
}

.main-menu-submenu-caret {
  color: var(--neu-text-muted);
  font-size: 0.75rem;
  line-height: 1;
  transition: transform 160ms ease;
  flex-shrink: 0;
}

.main-menu-submenu.is-open .main-menu-submenu-caret {
  transform: rotate(90deg);
}

.main-menu-submenu-panel {
  display: none;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.1rem 0 0.15rem 0.55rem;
  margin-left: 0.35rem;
  border-left: 1px solid var(--studio-border, rgba(255, 255, 255, 0.08));
}

.main-menu-submenu.is-open .main-menu-submenu-panel,
.main-menu-submenu-panel:not([hidden]) {
  display: flex;
}

.main-menu-submenu-item {
  min-height: 40px;
  padding-left: 0.95rem;
  font-size: 12.5px;
}

/* Workspace chrome: title, page actions, settings flyout */

#workspace-header-text {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  min-width: 0;
  flex: 1 1 auto;
}

#workspace-header-text[hidden] {
  display: none !important;
}

#workspace-header-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  color: var(--studio-text, var(--neu-text));
}

#workspace-header-hint {
  margin: 0;
  font-size: 0.78rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  color: var(--studio-text-muted, var(--neu-text-muted));
}

#workspace-header-hint[hidden] {
  display: none !important;
}

#top-controls-context {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
  margin-right: 0.75rem;
  flex: 0 1 auto;
  min-width: 0;
}

#top-controls-context[hidden] {
  display: none !important;
}

.workspace-header-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  flex-shrink: 0;
}

.workspace-header-actions[hidden] {
  display: none !important;
}

#settings-menu {
  position: relative;
  flex: 0 0 auto;
  margin-left: 0;
}

.settings-menu-toggle {
  min-height: 44px;
  white-space: nowrap;
}

#settings-menu-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  left: auto;
  z-index: 100003;
  display: none;
  flex-direction: column;
  gap: 0.25rem;
  min-width: min(320px, calc(100vw - 32px));
  max-height: min(70vh, 480px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0.5rem;
  background: var(--studio-surface-elevated, var(--neu-bg));
  border: 1px solid var(--studio-border, transparent);
  border-radius: var(--studio-radius, var(--neu-radius));
  box-shadow: var(--studio-shadow-sm, var(--neu-float-shadow));
}

#settings-menu-panel.open {
  display: flex;
}

.settings-menu-panel .settings-menu-submenu {
  width: 100%;
}

.settings-menu-action {
  width: 100%;
  text-align: left;
  min-height: 40px;
}

.settings-menu-action:disabled {
  opacity: 0.65;
  cursor: default;
}

.settings-menu-user-info {
  pointer-events: none;
  user-select: none;
  width: 100%;
  max-width: none;
  margin: 0.15rem 0;
}

.settings-menu-logout {
  color: var(--studio-text, var(--neu-text));
}

body.graph-detail-active #workspace-header-text,
body.graph-detail-active #top-controls-context {
  display: none !important;
}

.topbar-dropdown {
  position: relative;
  flex: 0 0 auto;
}

.topbar-dropdown-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
  min-height: 44px;
  white-space: nowrap;
}

.topbar-dropdown-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  left: auto;
  z-index: 100003;
  display: none;
  flex-direction: column;
  gap: 0.25rem;
  min-width: min(320px, calc(100vw - 32px));
  max-height: min(70vh, 480px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0.5rem;
  background: var(--neu-bg);
  border: none;
  border-radius: var(--neu-radius);
  box-shadow: var(--neu-float-shadow);
}

.topbar-dropdown.is-open .topbar-dropdown-panel,
.topbar-dropdown-panel:not([hidden]) {
  display: flex;
}

.topbar-dropdown-panel button {
  width: 100%;
  text-align: left;
}

.topbar-mandant-btn {
  max-width: min(240px, calc(100vw - 12rem));
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-height: 44px;
}

.topbar-mandant-btn:disabled {
  cursor: default;
  opacity: 1;
}

.topbar-user-chip {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.35rem 0.65rem;
  border-radius: var(--studio-radius);
  background: var(--studio-surface);
  border: 1px solid var(--studio-border);
  max-width: min(200px, calc(100vw - 12rem));
  min-width: 0;
}

.topbar-logout-btn {
  min-height: 44px;
  white-space: nowrap;
}

/* Workspace pages: unified top chrome aligned with page headers */

body.inbox-active #graph-2d,
body.inbox-active #hud,
body.inbox-active #toolbar,
body.inbox-active #ark-chat-panel,
body.inbox-active #chat-fab,
body.inbox-active #search-center-container,
body.inbox-active #graph-header-stack,
body.inbox-active #stats-chip,
body.inbox-active #agent-dock-bar,
body.inbox-active #sequence-timeline,
body.inbox-active #ark-menu {
  visibility: hidden;
  pointer-events: none;
}

body.inbox-active #top-controls,
body.jobs-active #top-controls,
body.leads-active #top-controls,
body.escalations-active #top-controls,
body.sc-requirements-active #top-controls,
body.sc-features-active #top-controls,
body.sc-topics-active #top-controls,
body.sc-open-questions-active #top-controls,
body.customers-active #top-controls,
body.parties-active #top-controls,
body.knowledge-sources-active #top-controls,
body.pze-active #top-controls,
body.capacity-planning-active #top-controls,
body.abos-active #top-controls,
body.agent-dashboard-active #top-controls,
body.admin-workspace-active #top-controls,
body.system-settings-active #top-controls,
body.document-editor-active #top-controls {
  top: 0;
  left: 0;
  right: 0;
  padding: 0.65rem 0.75rem;
  align-items: center;
  flex-wrap: nowrap;
  gap: 0.65rem;
  background: var(--studio-bg, var(--neu-bg));
  border-bottom: 1px solid var(--studio-border, rgba(255, 255, 255, 0.08));
  box-sizing: border-box;
}

/* Vollseiten mit eigener Seiten-Kopfzeile: Der Topbar enthält weder
   Workspace-Titel noch Workspace-Aktionen, deshalb bliebe der
   Einstellungen-Button ohne Auto-Rand direkt neben dem Menü-Button stehen.
   Graph-/Detailansicht bleibt bewusst ausgenommen. */
body.error-tracking-active #settings-menu {
  margin-left: auto;
}

body.inbox-active #inbox-page,
body.jobs-active #jobs-page,
body.leads-active #leads-page,
body.escalations-active #escalations-page,
body.sc-requirements-active #sc-requirements-page,
body.sc-features-active #sc-features-page,
body.sc-topics-active #sc-topics-page,
body.sc-open-questions-active #sc-open-questions-page,
body.customers-active #customers-page,
body.parties-active #parties-page,
body.knowledge-sources-active #knowledge-sources-page,
body.pze-active #pze-page,
body.capacity-planning-active #capacity-planning-page,
body.abos-active #abos-page,
body.stages-active #stages-page,
body.agent-dashboard-active #agent-dashboard-page,
body.admin-workspace-active #admin-workspace-page,
body.document-editor-active #document-editor-page {
  padding-top: 0;
}

body.inbox-active #inbox-page.open,
body.jobs-active #jobs-page.open,
body.leads-active #leads-page.open,
body.escalations-active #escalations-page.open,
body.sc-requirements-active #sc-requirements-page.open,
body.sc-features-active #sc-features-page.open,
body.sc-topics-active #sc-topics-page.open,
body.sc-open-questions-active #sc-open-questions-page.open,
body.customers-active #customers-page.open,
body.parties-active #parties-page.open,
body.knowledge-sources-active #knowledge-sources-page.open,
body.pze-active #pze-page.open,
body.capacity-planning-active #capacity-planning-page.open,
body.abos-active #abos-page.open,
body.stages-active #stages-page.open,
body.agent-dashboard-active #agent-dashboard-page.open,
body.admin-workspace-active #admin-workspace-page.open,
body.system-settings-active #system-settings-page.open,
body.document-editor-active #document-editor-page.open {
  padding-top: calc(var(--workspace-topbar-clearance) + var(--workspace-content-gap));
}

.neu-menu-group-label {
  display: block;
  padding: 0.35rem 0.85rem 0.15rem;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--neu-text-muted);
  user-select: none;
  pointer-events: none;
}

/* Ark menu */

#ark-menu {
  position: relative;
  flex: 0 0 auto;
}

body:not(.graph-detail-active) #ark-menu {
  display: none;
}

#btn-ark-menu {
  pointer-events: auto;
  border: none;
  background: var(--neu-bg);
  color: var(--neu-text);
  border-radius: var(--neu-radius-sm);
  padding: 0.55rem 0.9rem;
  min-height: 44px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  max-width: min(280px, calc(100vw - 200px));
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: var(--neu-extrude-shadow);
  transition: box-shadow 160ms ease, color 160ms ease;
}

#btn-ark-menu:hover {
  color: var(--neu-text);
}

#btn-ark-menu:active {
  box-shadow: var(--neu-inset-shadow);
}

#btn-ark-menu:focus-visible {
  outline: none;
  box-shadow: var(--neu-extrude-shadow), var(--neu-focus-ring);
}

/* Automatisierung: ss-section-automatisierung in system-settings-page (studio-design.css) */

/* Graph/detail view — only visible after ark overview or deep link */

body:not(.graph-detail-active) #graph-split,
body:not(.graph-detail-active) #graph-2d,
body:not(.graph-detail-active) #hud,
body:not(.graph-detail-active) #toolbar,
body:not(.graph-detail-active) #ark-chat-panel,
body:not(.graph-detail-active) #chat-fab,
body:not(.graph-detail-active) #search-center-container,
body:not(.graph-detail-active) #graph-header-stack,
body:not(.graph-detail-active) #stats-chip,
body:not(.graph-detail-active) #agent-dock-bar,
body:not(.graph-detail-active) #sequence-timeline,
body:not(.graph-detail-active) #graph-tooling-dock {
  visibility: hidden;
  pointer-events: none;
}

/* Full-page dashboard */

body.ark-info-active #ark-select,
body.agent-dashboard-active #ark-select,
body.error-tracking-active #ark-select,
body.jobs-active #ark-select,
body.leads-active #ark-select,
body.inbox-active #ark-select,
body.customers-active #ark-select,
body.parties-active #ark-select,
body.knowledge-sources-active #ark-select,
body.pze-active #ark-select,
body.abos-active #ark-select,
body.user-admin-active #ark-select,
body.view-mode-2d.graph-detail-active #ark-select {
  visibility: hidden;
  pointer-events: none;
  width: 0;
  min-width: 0;
  padding: 0;
  margin: 0;
  border: none;
  opacity: 0;
}

body.ark-info-active #graph-split,
body.agent-dashboard-active #graph-split,
body.jobs-active #graph-split,
body.leads-active #graph-split,
body.inbox-active #graph-split,
body.escalations-active #graph-split,
body.sc-requirements-active #graph-split,
body.sc-features-active #graph-split,
body.sc-topics-active #graph-split,
body.sc-open-questions-active #graph-split,
body.customers-active #graph-split,
body.parties-active #graph-split,
body.knowledge-sources-active #graph-split,
body.pze-active #graph-split,
body.capacity-planning-active #graph-split,
body.abos-active #graph-split,
body.user-admin-active #graph-split,
body.auth-locked #graph-split,
body.ark-info-active #graph-2d,
body.agent-dashboard-active #graph-2d,
body.error-tracking-active #graph-3d,
body.error-tracking-active #graph-2d,
body.ark-info-active #hud,
body.ark-info-active #toolbar,
body.ark-info-active #ark-chat-panel,
body.ark-info-active #chat-fab,
body.ark-info-active #search-center-container,
body.ark-info-active #graph-header-stack,
body.ark-info-active #stats-chip,
body.ark-info-active #agent-dock-bar,
body.ark-info-active #sequence-timeline,
body.agent-dashboard-active #hud,
body.agent-dashboard-active #toolbar,
body.agent-dashboard-active #ark-chat-panel,
body.agent-dashboard-active #chat-fab,
body.agent-dashboard-active #search-center-container,
body.agent-dashboard-active #graph-header-stack,
body.agent-dashboard-active #stats-chip,
body.agent-dashboard-active #agent-dock-bar,
body.agent-dashboard-active #sequence-timeline,
body.error-tracking-active #vignette,
body.error-tracking-active #node-labels-layer,
body.error-tracking-active #hud,
body.error-tracking-active #toolbar,
body.error-tracking-active #ark-chat-panel,
body.error-tracking-active #chat-fab,
body.error-tracking-active #search-center-container,
body.error-tracking-active #graph-header-stack,
body.error-tracking-active #stats-chip,
body.error-tracking-active #agent-dock-bar,
body.error-tracking-active #sequence-timeline,
body.agent-dashboard-active #sequence-timeline,
body.jobs-active #graph-2d,
body.jobs-active #hud,
body.jobs-active #toolbar,
body.jobs-active #ark-chat-panel,
body.jobs-active #chat-fab,
body.jobs-active #search-center-container,
body.jobs-active #graph-header-stack,
body.jobs-active #stats-chip,
body.jobs-active #agent-dock-bar,
body.jobs-active #sequence-timeline,
body.document-editor-active #graph-2d,
body.document-editor-active #hud,
body.document-editor-active #toolbar,
body.document-editor-active #ark-chat-panel,
body.document-editor-active #chat-fab,
body.document-editor-active #search-center-container,
body.document-editor-active #graph-header-stack,
body.document-editor-active #stats-chip,
body.document-editor-active #agent-dock-bar,
body.document-editor-active #sequence-timeline,
body.leads-active #graph-2d,
body.leads-active #hud,
body.leads-active #toolbar,
body.leads-active #ark-chat-panel,
body.leads-active #chat-fab,
body.leads-active #search-center-container,
body.leads-active #graph-header-stack,
body.leads-active #stats-chip,
body.leads-active #agent-dock-bar,
body.leads-active #sequence-timeline,
body.escalations-active #graph-2d,
body.escalations-active #hud,
body.escalations-active #toolbar,
body.escalations-active #ark-chat-panel,
body.escalations-active #chat-fab,
body.escalations-active #search-center-container,
body.escalations-active #graph-header-stack,
body.escalations-active #stats-chip,
body.escalations-active #agent-dock-bar,
body.escalations-active #sequence-timeline,
body.sc-requirements-active #graph-2d,
body.sc-requirements-active #hud,
body.sc-requirements-active #toolbar,
body.sc-requirements-active #ark-chat-panel,
body.sc-requirements-active #chat-fab,
body.sc-requirements-active #search-center-container,
body.sc-requirements-active #graph-header-stack,
body.sc-requirements-active #stats-chip,
body.sc-requirements-active #agent-dock-bar,
body.sc-requirements-active #sequence-timeline,
body.sc-features-active #graph-2d,
body.sc-features-active #hud,
body.sc-features-active #toolbar,
body.sc-features-active #ark-chat-panel,
body.sc-features-active #chat-fab,
body.sc-features-active #search-center-container,
body.sc-features-active #graph-header-stack,
body.sc-features-active #stats-chip,
body.sc-features-active #agent-dock-bar,
body.sc-features-active #sequence-timeline,
body.sc-topics-active #graph-2d,
body.sc-topics-active #hud,
body.sc-topics-active #toolbar,
body.sc-topics-active #ark-chat-panel,
body.sc-topics-active #chat-fab,
body.sc-topics-active #search-center-container,
body.sc-topics-active #graph-header-stack,
body.sc-topics-active #stats-chip,
body.sc-topics-active #agent-dock-bar,
body.sc-topics-active #sequence-timeline,
body.sc-open-questions-active #graph-2d,
body.sc-open-questions-active #hud,
body.sc-open-questions-active #toolbar,
body.sc-open-questions-active #ark-chat-panel,
body.sc-open-questions-active #chat-fab,
body.sc-open-questions-active #search-center-container,
body.sc-open-questions-active #graph-header-stack,
body.sc-open-questions-active #stats-chip,
body.sc-open-questions-active #agent-dock-bar,
body.sc-open-questions-active #sequence-timeline,
body.customers-active #graph-2d,
body.customers-active #hud,
body.customers-active #toolbar,
body.customers-active #ark-chat-panel,
body.customers-active #chat-fab,
body.customers-active #search-center-container,
body.customers-active #graph-header-stack,
body.customers-active #stats-chip,
body.customers-active #agent-dock-bar,
body.customers-active #sequence-timeline,
body.parties-active #graph-2d,
body.parties-active #hud,
body.parties-active #toolbar,
body.parties-active #ark-chat-panel,
body.parties-active #chat-fab,
body.parties-active #search-center-container,
body.parties-active #graph-header-stack,
body.parties-active #stats-chip,
body.parties-active #agent-dock-bar,
body.parties-active #sequence-timeline,
body.knowledge-sources-active #graph-2d,
body.pze-active #graph-2d,
body.capacity-planning-active #graph-2d,
body.knowledge-sources-active #hud,
body.pze-active #hud,
body.capacity-planning-active #hud,
body.knowledge-sources-active #toolbar,
body.pze-active #toolbar,
body.capacity-planning-active #toolbar,
body.knowledge-sources-active #ark-chat-panel,
body.pze-active #ark-chat-panel,
body.capacity-planning-active #ark-chat-panel,
body.knowledge-sources-active #chat-fab,
body.pze-active #chat-fab,
body.capacity-planning-active #chat-fab,
body.knowledge-sources-active #search-center-container,
body.pze-active #search-center-container,
body.capacity-planning-active #search-center-container,
body.knowledge-sources-active #graph-header-stack,
body.pze-active #graph-header-stack,
body.capacity-planning-active #graph-header-stack,
body.knowledge-sources-active #stats-chip,
body.pze-active #stats-chip,
body.capacity-planning-active #stats-chip,
body.knowledge-sources-active #agent-dock-bar,
body.pze-active #agent-dock-bar,
body.capacity-planning-active #agent-dock-bar,
body.knowledge-sources-active #sequence-timeline,
body.pze-active #sequence-timeline,
body.capacity-planning-active #sequence-timeline,
body.abos-active #graph-2d,
body.abos-active #hud,
body.abos-active #toolbar,
body.abos-active #ark-chat-panel,
body.abos-active #chat-fab,
body.abos-active #search-center-container,
body.abos-active #graph-header-stack,
body.abos-active #stats-chip,
body.abos-active #agent-dock-bar,
body.abos-active #sequence-timeline {
  visibility: hidden;
  pointer-events: none;
}

body.jobs-active #agent-dock-bar,
body.jobs-active #sequence-timeline,
body.leads-active #agent-dock-bar,
body.leads-active #sequence-timeline,
body.customers-active #agent-dock-bar,
body.customers-active #sequence-timeline,
body.parties-active #agent-dock-bar,
body.parties-active #sequence-timeline,
body.knowledge-sources-active #agent-dock-bar,
body.knowledge-sources-active #sequence-timeline,
body.abos-active #agent-dock-bar,
body.abos-active #sequence-timeline,
body.user-admin-active #graph-2d,
body.user-admin-active #hud,
body.user-admin-active #toolbar,
body.user-admin-active #ark-chat-panel,
body.user-admin-active #chat-fab,
body.user-admin-active #search-center-container,
body.user-admin-active #graph-header-stack,
body.user-admin-active #stats-chip,
body.user-admin-active #agent-dock-bar,
body.user-admin-active #sequence-timeline,
body.user-admin-active #ark-menu {
  visibility: hidden;
  pointer-events: none;
}

body.auth-locked #top-controls,
body.auth-locked #graph-2d,
body.auth-locked #hud,
body.auth-locked #toolbar,
body.auth-locked #ark-chat-panel,
body.auth-locked #chat-fab,
body.auth-locked #search-center-container,
body.auth-locked #graph-header-stack,
body.auth-locked #agent-dock-bar,
body.auth-locked #sequence-timeline,
body.auth-locked #jobs-page,
body.auth-locked #document-editor-page,
body.auth-locked #inbox-page,
body.auth-locked #leads-page,
body.auth-locked #escalations-page,
body.auth-locked #sc-requirements-page,
body.auth-locked #sc-features-page,
body.auth-locked #sc-topics-page,
body.auth-locked #sc-open-questions-page,
body.auth-locked #customers-page,
body.auth-locked #parties-page,
body.auth-locked #knowledge-sources-page,
body.auth-locked #pze-page,
body.auth-locked #capacity-planning-page,
body.auth-locked #abos-page,
body.auth-locked #stages-page,
body.auth-locked #user-admin-page,
body.auth-locked #agent-dashboard-page,
body.auth-locked #ark-info-page,
body.auth-locked #admin-workspace-page,
body.auth-locked #system-settings-page,
body.auth-locked #care-area-page {
  visibility: hidden;
  pointer-events: none;
}

.auth-login-screen {
  position: fixed;
  inset: 0;
  z-index: 200000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--studio-bg);
  padding: 1.5rem;
}

.auth-login-screen[hidden] {
  display: none !important;
}

.auth-login-card {
  width: min(100%, 24rem);
  padding: 1.5rem;
}

.auth-login-card h1 {
  margin: 0 0 0.35rem;
  font-size: 1.35rem;
}

.auth-login-form {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

.mandant-select-list {
  display: grid;
  gap: 0.75rem;
  margin: 1rem 0;
}

.mandant-select-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
  text-align: left;
  width: 100%;
}

.care-section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.care-section-header h2 {
  margin: 0 0 0.25rem;
}

.care-membership-list {
  display: grid;
  gap: 0.5rem;
}

.care-membership-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--studio-border);
  border-radius: var(--studio-radius);
  background: var(--studio-surface);
}

.care-membership-row label {
  margin: 0;
  min-width: 8rem;
}

.care-badge {
  display: inline-block;
  font-size: 0.75rem;
  padding: 0.1rem 0.4rem;
  border-radius: var(--studio-radius);
  border: 1px solid var(--studio-border);
  color: var(--studio-text-muted);
}

.care-badge-admin {
  color: var(--studio-primary);
  border-color: var(--studio-primary);
}

body.care-area-active #graph-split,
body.care-area-active #graph-2d,
body.care-area-active #hud,
body.care-area-active #toolbar,
body.care-area-active #ark-chat-panel,
body.care-area-active #chat-fab,
body.care-area-active #search-center-container,
body.care-area-active #graph-header-stack,
body.care-area-active #top-controls,
body.care-area-active #ark-select,
body.care-area-active #agent-dock-bar {
  visibility: hidden;
  pointer-events: none;
}

#care-area-page {
  position: fixed;
  inset: 0;
  z-index: 100008;
  display: none;
  background: var(--neu-bg);
  color: var(--neu-text);
}

#care-area-page.open {
  display: flex;
  flex-direction: column;
}

.care-area-nav-btn {
  text-align: left;
  padding: 0.65rem 0.85rem;
  border: none;
  border-radius: var(--neu-radius-sm);
  background: var(--neu-bg);
  color: var(--neu-text-muted);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  box-shadow: var(--neu-extrude-shadow);
  transition: box-shadow 160ms ease, color 160ms ease;
}

.care-area-nav-btn:hover {
  color: var(--neu-text);
}

.care-area-nav-btn.active {
  color: var(--neu-text);
  box-shadow: var(--neu-inset-shadow);
}

.care-area-nav-btn:focus-visible {
  outline: none;
  box-shadow: var(--neu-extrude-shadow), var(--neu-focus-ring);
}

body.user-admin-active #top-controls {
  /* keep topbar usable for legacy user-admin */
}

.auth-login-error {
  color: var(--studio-danger, #e07070);
  margin: 0;
}

.main-menu-user-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.45rem 0.75rem;
  margin: 0.15rem 0.35rem;
  border-radius: var(--studio-radius);
  background: var(--studio-surface);
  border: 1px solid var(--studio-border);
}

.main-menu-user-name {
  font-size: 0.9rem;
  color: var(--studio-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.main-menu-user-role {
  margin: 0;
  font-size: 0.8rem;
}

#user-admin-page {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: none;
  background: var(--neu-bg);
  color: var(--neu-text);
  padding: 5.5rem 1.25rem 1.25rem;
  box-sizing: border-box;
}

#user-admin-page.open {
  display: flex;
  flex-direction: column;
}

.user-admin-shell {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.studio-admin-section {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.user-admin-table .studio-select {
  min-width: 9rem;
}

.user-admin-active-row {
  min-width: 7.5rem;
}

.dashboard-shell {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  max-width: min(1200px, 100%);
  margin: 0 auto;
  width: 100%;
}

.dashboard-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 1rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

.dashboard-header h1 {
  margin: 0 0 0.25rem;
  font-size: 1.15rem;
  color: var(--neu-text);
}

.dashboard-header-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.dashboard-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.dashboard-content-area {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.dashboard-card {
  padding: 1rem 1.15rem;
  border-radius: var(--neu-radius);
  background: var(--neu-bg);
  box-shadow: var(--neu-extrude-shadow);
}

.dashboard-card h2 {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
  color: var(--neu-text);
}

.dashboard-card p {
  margin: 0;
  color: var(--neu-text-muted);
  font-size: 0.85rem;
  line-height: 1.45;
}

.abos-field-grid,
.abos-signal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 0.9rem;
}

.abos-card-stack {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.abos-signal-card,
.abos-source-card {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.abos-card-actions {
  display: flex;
  justify-content: flex-end;
}

/* Full-page agent dashboard (cockpit) */

#agent-dashboard-page {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: none;
  background: var(--neu-bg);
  color: var(--neu-text);
  padding: 0.85rem 0.75rem 0.75rem;
  box-sizing: border-box;
}

#agent-dashboard-page.open {
  display: flex;
  flex-direction: column;
}

#jobs-page {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: none;
  background: var(--neu-bg);
  color: var(--neu-text);
  padding: 0.85rem 0.75rem 0.75rem;
  box-sizing: border-box;
}

#jobs-page.open {
  display: flex;
  flex-direction: column;
}

#document-editor-page {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: none;
  background: var(--neu-bg);
  color: var(--neu-text);
  padding: 0.85rem 0.75rem 0.75rem;
  box-sizing: border-box;
}

#document-editor-page.open {
  display: flex;
  flex-direction: column;
}

#document-editor-page .dashboard-shell,
#document-editor-page .jobs-main,
#document-editor-page .jobs-content-area {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

#document-editor-page .document-detail-body {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

#leads-page {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: none;
  background: var(--neu-bg);
  color: var(--neu-text);
  padding: 0.85rem 0.75rem 0.75rem;
  box-sizing: border-box;
}

#leads-page.open {
  display: flex;
  flex-direction: column;
}

#escalations-page {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: none;
  background: var(--neu-bg);
  color: var(--neu-text);
  padding: 0.85rem 0.75rem 0.75rem;
  box-sizing: border-box;
}

#escalations-page.open {
  display: flex;
  flex-direction: column;
}

#sc-requirements-page,
#sc-features-page,
#sc-topics-page,
#sc-open-questions-page {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: none;
  background: var(--neu-bg);
  color: var(--neu-text);
  padding: 0.85rem 0.75rem 0.75rem;
  box-sizing: border-box;
}

#sc-requirements-page.open,
#sc-features-page.open,
#sc-topics-page.open,
#sc-open-questions-page.open {
  display: flex;
  flex-direction: column;
}

#sc-requirements-page .dashboard-shell,
#sc-requirements-page .jobs-main,
#sc-requirements-page .jobs-content-area,
#sc-features-page .dashboard-shell,
#sc-features-page .jobs-main,
#sc-features-page .jobs-content-area,
#sc-topics-page .dashboard-shell,
#sc-topics-page .jobs-main,
#sc-topics-page .jobs-content-area,
#sc-open-questions-page .dashboard-shell,
#sc-open-questions-page .jobs-main,
#sc-open-questions-page .jobs-content-area {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

#inbox-page {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: none;
  background: var(--neu-bg);
  color: var(--neu-text);
  padding: 0.85rem 0.75rem 0.75rem;
  box-sizing: border-box;
}

#inbox-page.open {
  display: flex;
  flex-direction: column;
}

#customers-page,
#parties-page {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: none;
  background: var(--neu-bg);
  color: var(--neu-text);
  padding: 0.85rem 0.75rem 0.75rem;
  box-sizing: border-box;
}

#customers-page.open,
#parties-page.open {
  display: flex;
  flex-direction: column;
}

#knowledge-sources-page {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: none;
  background: var(--neu-bg);
  color: var(--neu-text);
  padding: 0.85rem 0.75rem 0.75rem;
  box-sizing: border-box;
}

#knowledge-sources-page.open {
  display: flex;
  flex-direction: column;
}

#abos-page {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: none;
  background: var(--neu-bg);
  color: var(--neu-text);
  padding: 0.85rem 0.75rem 0.75rem;
  box-sizing: border-box;
}

#abos-page.open {
  display: flex;
  flex-direction: column;
}

#stages-page {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: none;
  background: var(--neu-bg);
  color: var(--neu-text);
  padding: 0.85rem 0.75rem 0.75rem;
  box-sizing: border-box;
}

#stages-page.open {
  display: flex;
  flex-direction: column;
}

.stages-list-stack {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.stages-list-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  text-align: left;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--studio-border);
  border-radius: var(--studio-radius);
  background: var(--studio-surface);
  color: var(--studio-text);
  cursor: pointer;
}

.stages-list-row:hover {
  border-color: var(--studio-primary);
}

.stages-list-row.is-active {
  border-color: var(--studio-primary);
  background: var(--studio-surface-elevated);
}

.stages-list-swatch {
  width: 0.85rem;
  height: 0.85rem;
  border-radius: var(--studio-radius, 8px);
  flex-shrink: 0;
  border: 1px solid var(--studio-border);
}

.stages-list-main {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
  flex: 1;
}

.stages-list-name {
  font-weight: 600;
}

.stages-list-meta {
  color: var(--studio-text-muted);
  font-size: 0.85em;
}

.stages-skipped-tag {
  flex-shrink: 0;
}

#stages-detail-skipped-badge[hidden],
.stages-skipped-tag[hidden] {
  display: none !important;
}

.leads-split {
  --leads-col-list: 50%;
  --leads-col-detail: 35%;
  --leads-col-agent: 15%;
}

.escalations-split {
  --escalations-col-list: 25%;
  --escalations-col-detail: 45%;
  --escalations-col-agent: 30%;
}

.inbox-split {
  --inbox-col-list: 44%;
  --inbox-col-detail: 41%;
  --inbox-col-agent: 15%;
}

.customers-split,
.parties-split {
  --customers-col-list: 50%;
  --customers-col-detail: 35%;
  --customers-col-agent: 15%;
  --parties-col-list: 50%;
  --parties-col-detail: 35%;
  --parties-col-agent: 15%;
}

.knowledge-sources-split {
  --knowledge-sources-col-list: 50%;
  --knowledge-sources-col-detail: 35%;
  --knowledge-sources-col-agent: 15%;
}

.parties-profile-fields {
  display: contents;
}

.abos-split {
  --abos-col-list: 50%;
  --abos-col-detail: 35%;
  --abos-col-agent: 15%;
}

.pze-split {
  --pze-col-list: 12%;
  --pze-col-detail: 43%;
  --pze-col-agent: 45%;
}

#pze-page {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: none;
  background: var(--neu-bg);
  color: var(--neu-text);
  padding: 0.85rem 0.75rem 0.75rem;
  box-sizing: border-box;
}

#pze-page.open {
  display: flex;
  flex-direction: column;
}

#capacity-planning-page {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: none;
  background: var(--neu-bg);
  color: var(--neu-text);
  padding: 0.85rem 0.75rem 0.75rem;
  box-sizing: border-box;
}

#capacity-planning-page.open {
  display: flex;
  flex-direction: column;
}

.capacity-planning-split {
  --capacity-planning-col-list: 15%;
  --capacity-planning-col-detail: 50%;
  --capacity-planning-col-agent: 35%;
}

.pze-nav-host {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 0;
}

.pze-nav-filters {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.75rem;
}

.pze-content-panel {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 0;
}

.pze-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.65rem;
}

.pze-kpi-card {
  padding: 0.75rem;
}

.pze-kpi-label {
  margin: 0;
  font-size: 0.78rem;
  color: var(--studio-text-muted);
  text-transform: capitalize;
}

.pze-kpi-value {
  margin: 0.25rem 0 0;
  font-size: 1.35rem;
  font-weight: 600;
}

.pze-chart-card {
  padding: 0.75rem;
}

.pze-chart-canvas {
  width: 100%;
  height: 200px;
  display: block;
}

.pze-overview-tables {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.75rem;
}

.pze-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.pze-status-badge {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: var(--studio-radius);
  font-size: 0.75rem;
  text-transform: uppercase;
  border: 1px solid var(--studio-border);
}

.pze-status-green {
  color: var(--studio-primary);
}

.pze-status-yellow {
  color: #c9a227;
}

.pze-status-red {
  color: #d9534f;
}

.dash-topics-host,
.dash-detail-host {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 0.75rem;
  gap: 0.35rem;
}

.dash-topics-host {
  padding: 0.5rem 0.4rem;
}

.dash-topics-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.dashboard-ai-chat-host,
#dashboard-ai-chat-host {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

.agent-cockpit-split {
  --agent-col-list: 40%;
  --agent-col-detail: 40%;
  --agent-col-agent: 20%;
}

.agent-cockpit-main {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.agent-col.jobs-col-list,
.agent-col.jobs-col-detail,
.agent-col.jobs-col-agent {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.agent-list-panel {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  flex: 1;
  min-height: 0;
  height: 100%;
  padding: 0.65rem;
  box-sizing: border-box;
}

.agent-table-host {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.agent-detail-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 0.75rem;
}

.agent-detail-body[hidden],
#agent-detail-empty[hidden] {
  display: none !important;
}

#agent-col-detail #agent-detail-empty {
  flex: 1;
}

.agent-preview-chat-host {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.agent-preview-chat {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  background: var(--studio-surface, var(--neu-bg));
  border: 1px solid var(--studio-border, transparent);
  border-radius: var(--studio-radius, var(--neu-radius));
}

.agent-preview-chat-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--studio-border, color-mix(in srgb, var(--neu-dark) 14%, transparent));
}

.agent-preview-chat-messages {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.agent-preview-msg {
  max-width: 95%;
  padding: 0.55rem 0.7rem;
  border-radius: var(--studio-radius, 8px);
  font-size: 0.9rem;
  line-height: 1.4;
  white-space: pre-wrap;
}

.agent-preview-msg--user {
  align-self: flex-end;
  background: color-mix(in srgb, var(--studio-primary, var(--neu-accent)) 22%, var(--studio-surface, var(--neu-bg)));
}

.agent-preview-msg--assistant {
  align-self: flex-start;
  background: var(--studio-surface-elevated, color-mix(in srgb, var(--neu-dark) 8%, var(--neu-bg)));
}

.agent-preview-msg--system {
  align-self: stretch;
  background: transparent;
  color: var(--studio-text-muted, var(--neu-text-muted));
  font-size: 0.8rem;
  padding: 0.2rem 0;
}

.agent-preview-chat-composer {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.65rem 0.75rem;
  border-top: 1px solid var(--studio-border, color-mix(in srgb, var(--neu-dark) 14%, transparent));
}

.agent-preview-chat-composer-row {
  display: flex;
  gap: 0.45rem;
  align-items: flex-end;
}

.agent-preview-chat-composer textarea {
  flex: 1;
  min-height: 2.6rem;
  max-height: 8rem;
  resize: vertical;
}

.agent-preview-monitor-hint {
  margin-top: 0.2rem;
}

.agent-preview-eval {
  align-self: stretch;
  margin-top: 0.15rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--studio-border, transparent);
  border-radius: var(--studio-radius, 8px);
  background: var(--studio-surface-elevated, var(--studio-surface));
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.agent-preview-eval-head {
  font-size: 0.85rem;
  color: var(--studio-text, inherit);
}

.agent-preview-eval-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

.agent-preview-eval-metric {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.45rem 0.55rem;
  border-radius: var(--studio-radius, 8px);
  border: 1px solid var(--studio-border, transparent);
  background: var(--studio-surface, transparent);
  min-width: 0;
}

.agent-preview-eval-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--studio-text-muted, inherit);
}

.agent-preview-eval-value {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--studio-text, inherit);
}

.agent-preview-eval-metric--ok {
  border-color: color-mix(in srgb, var(--studio-primary) 45%, var(--studio-border));
}

.agent-preview-eval-metric--warn {
  border-color: color-mix(in srgb, var(--studio-danger, #e57373) 55%, var(--studio-border));
}

.agent-preview-eval-metric--intensity-low .agent-preview-eval-value {
  color: var(--studio-primary);
}

.agent-preview-eval-metric--intensity-medium .agent-preview-eval-value {
  color: var(--studio-text);
}

.agent-preview-eval-metric--intensity-high .agent-preview-eval-value {
  color: var(--studio-danger, #e57373);
}

.agent-preview-eval-hints-block {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.agent-preview-eval-hints {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--studio-text-muted, inherit);
  font-size: 0.82rem;
  line-height: 1.4;
}

.agent-preview-eval-hints li + li {
  margin-top: 0.25rem;
}

.aa-eval-config {
  margin-top: 0.25rem;
}

.aa-eval-rules {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

@media (max-width: 720px) {
  .agent-preview-eval-grid {
    grid-template-columns: 1fr;
  }
}

.agent-cockpit-kind--autonomous {
  background: color-mix(in srgb, #3d8bfd 18%, var(--studio-surface, var(--neu-bg)));
  color: #6eb0ff;
}

.agent-cockpit-runs {
  margin-top: 1rem;
}

.jobs-shell {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  max-width: none;
  width: 100%;
  margin: 0;
}

.jobs-header {
  align-items: center;
  gap: 0.65rem;
  padding-bottom: 0.45rem;
  margin-bottom: 0.45rem;
}

.jobs-header-menu-spacer {
  flex: 0 0 6.5rem;
  width: 6.5rem;
  height: 1px;
}

.jobs-header-text {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  min-width: 0;
  flex: 1 1 auto;
}

.jobs-header h1 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.jobs-header-text .neu-hint {
  margin: 0;
  font-size: 0.78rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.jobs-header .jobs-view-tabs {
  flex-shrink: 0;
  margin-bottom: 0;
}

.jobs-header-actions {
  margin-left: 0;
  flex-shrink: 0;
}

.jobs-main {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  gap: 0;
  overflow: hidden;
}

.jobs-view-tabs {
  display: flex;
  gap: 0.35rem;
  flex-shrink: 0;
}

.jobs-toolbar {
  margin-bottom: 1rem;
}

.jobs-content-area {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.jobs-split {
  --jobs-col-list: 50%;
  --jobs-col-detail: 35%;
  --jobs-col-agent: 15%;
  display: grid;
  grid-template-columns:
    minmax(0, var(--jobs-col-list))
    6px
    minmax(0, var(--jobs-col-detail))
    6px
    minmax(0, var(--jobs-col-agent));
  flex: 1;
  min-height: 0;
  height: 100%;
  border: 1px solid var(--studio-border);
  border-radius: var(--studio-radius-lg);
  background: var(--studio-surface);
  overflow: hidden;
}

/* Spezifischer als .jobs-split: eigene CSS-Variablen + Grid (sonst greifen Jobs-Defaults 50/35/15) */
.jobs-split.leads-split {
  grid-template-columns:
    minmax(0, var(--leads-col-list))
    6px
    minmax(0, var(--leads-col-detail))
    6px
    minmax(0, var(--leads-col-agent));
}

.jobs-split.escalations-split {
  grid-template-columns:
    minmax(0, var(--escalations-col-list))
    6px
    minmax(0, var(--escalations-col-detail))
    6px
    minmax(0, var(--escalations-col-agent));
}

.jobs-split.customers-split {
  grid-template-columns:
    minmax(0, var(--customers-col-list))
    6px
    minmax(0, var(--customers-col-detail))
    6px
    minmax(0, var(--customers-col-agent));
}

.jobs-split.parties-split {
  grid-template-columns:
    minmax(0, var(--parties-col-list))
    6px
    minmax(0, var(--parties-col-detail))
    6px
    minmax(0, var(--parties-col-agent));
}

.jobs-split.knowledge-sources-split {
  grid-template-columns:
    minmax(0, var(--knowledge-sources-col-list))
    6px
    minmax(0, var(--knowledge-sources-col-detail))
    6px
    minmax(0, var(--knowledge-sources-col-agent));
}

.jobs-split.abos-split {
  grid-template-columns:
    minmax(0, var(--abos-col-list))
    6px
    minmax(0, var(--abos-col-detail))
    6px
    minmax(0, var(--abos-col-agent));
}

.jobs-split.document-editor-split {
  --document-col-list: 22%;
  --document-col-detail: 53%;
  --document-col-agent: 25%;
  grid-template-columns:
    minmax(0, var(--document-col-list))
    6px
    minmax(0, var(--document-col-detail))
    6px
    minmax(0, var(--document-col-agent));
}

.jobs-split.pze-split {
  grid-template-columns:
    minmax(0, var(--pze-col-list))
    6px
    minmax(0, var(--pze-col-detail))
    6px
    minmax(0, var(--pze-col-agent));
}

.jobs-split.capacity-planning-split {
  grid-template-columns:
    minmax(0, var(--capacity-planning-col-list))
    6px
    minmax(0, var(--capacity-planning-col-detail))
    6px
    minmax(0, var(--capacity-planning-col-agent));
}

.jobs-split.agent-cockpit-split {
  grid-template-columns:
    minmax(0, var(--agent-col-list))
    6px
    minmax(0, var(--agent-col-detail))
    6px
    minmax(0, var(--agent-col-agent));
}

.jobs-split.admin-split {
  --admin-col-list: 32%;
  --admin-col-detail: 43%;
  --admin-col-agent: 25%;
  grid-template-columns:
    minmax(0, var(--admin-col-list))
    6px
    minmax(0, var(--admin-col-detail))
    6px
    minmax(0, var(--admin-col-agent));
}

/* Testdaten / reine Formularseiten: nur Detail + KI.
   Wichtig: Liste/Handle mit display:none entfernen Grid-Items —
   dann würden Detail/Agent in die 0px-Spuren rutschen.
   Deshalb hier bewusst nur 3 Tracks; versteckte Items zählen nicht. */
.jobs-split.admin-split[data-admin-layout="detail-agent"] {
  grid-template-columns:
    minmax(0, var(--admin-col-detail))
    6px
    minmax(0, var(--admin-col-agent));
}

.jobs-split.admin-split[data-admin-layout="detail-agent"] #admin-col-list,
.jobs-split.admin-split[data-admin-layout="detail-agent"] > .jobs-split-handle[data-handle="list-detail"] {
  display: none !important;
}

.jobs-split.admin-split[data-admin-layout="detail-agent"] #admin-col-detail {
  min-width: 0;
}

.jobs-split.admin-split[data-admin-layout="detail-agent"] #admin-col-agent {
  min-width: 0;
  max-width: 100%;
}

#admin-workspace-page .admin-list-panels,
#admin-workspace-page .admin-detail-panels {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: auto;
  gap: 0.65rem;
}

#admin-workspace-page .admin-list-panel {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: 0;
  flex: 1;
}

#admin-workspace-page .admin-list-panel[hidden] {
  display: none !important;
}

#admin-workspace-page .admin-list-panel .jobs-col-list-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

#admin-workspace-page .admin-list-panel .jobs-col-list-filters .studio-hint {
  margin: 0;
  flex: 0 0 auto;
}

#admin-workspace-page #admin-mandant-toolbar,
#admin-workspace-page #admin-platform-user-toolbar {
  justify-content: flex-end;
}

#admin-workspace-page #admin-int-toolbar #int-btn-add,
#admin-workspace-page #admin-psc-toolbar #ss-psc-add {
  margin-left: auto;
  flex: 0 0 auto;
}

#admin-workspace-page .admin-list-panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

#admin-workspace-page .admin-list-panel-head h2 {
  margin: 0;
  font-size: 1rem;
  color: var(--studio-text);
}

#admin-workspace-page .admin-table-host,
#admin-workspace-page .ea-accounts-list,
#admin-workspace-page .ks-sources-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

#admin-workspace-page .admin-list-table tr.admin-list-row {
  cursor: pointer;
}

#admin-workspace-page .admin-list-table tr.admin-list-row.is-selected {
  background: color-mix(in srgb, var(--studio-primary) 14%, transparent);
}

#admin-workspace-page .admin-responsible-add-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

#admin-workspace-page .admin-responsible-add-row .studio-select,
#admin-workspace-page .admin-responsible-add-row .studio-input {
  min-width: 8rem;
  flex: 1 1 auto;
}

#admin-workspace-page .admin-responsible-mappings-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.card-verantwortlich-host {
  margin: 0.75rem 0;
}

.verantwortlich-card-add-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.verantwortlich-card-add-row .studio-select {
  flex: 1 1 10rem;
  min-width: 8rem;
}

.verantwortlich-card-list {
  list-style: none;
  margin: 0 0 0.75rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.verantwortlich-card-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--studio-border);
  border-radius: var(--studio-radius);
  background: var(--studio-surface);
}

#admin-workspace-page .admin-entity-detail[hidden] {
  display: none !important;
}

#admin-workspace-page .admin-settings-group[hidden],
#admin-workspace-page .system-settings-section details[hidden] {
  display: none !important;
}

#admin-workspace-page .admin-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

#admin-workspace-page .admin-detail-static,
#admin-workspace-page .admin-detail-key {
  margin: 0;
  color: var(--studio-text);
}

#admin-workspace-page .admin-color-swatch {
  display: inline-block;
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 2px;
  border: 1px solid var(--studio-border);
  vertical-align: middle;
  margin-right: 0.35rem;
}

#admin-workspace-page .admin-settings-group h3 {
  margin: 0 0 0.65rem;
  font-size: 1rem;
  color: var(--studio-text);
}

#admin-workspace-page .admin-list-panel .jobs-table-host {
  flex: 1;
  min-height: 0;
}

#admin-workspace-page #ss-testdaten-inventory {
  margin-bottom: 1rem;
}

#admin-workspace-page .ks-sources-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

#admin-workspace-page .ks-source-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  width: 100%;
  text-align: left;
  padding: 0.55rem 0.65rem;
}

#admin-workspace-page .ks-source-row.is-selected {
  border-color: var(--studio-primary);
  background: color-mix(in srgb, var(--studio-primary) 14%, transparent);
}

#admin-workspace-page .ks-source-row-main {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
}

#admin-workspace-page .ks-detail-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
}

#admin-workspace-page .ks-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

#admin-workspace-page .admin-catalog-detail {
  min-height: 12rem;
}

#admin-workspace-page .system-settings-section {
  display: none;
  flex-direction: column;
  gap: 0.75rem;
  max-width: none;
}

#admin-workspace-page .system-settings-section.active {
  display: flex;
}

#admin-workspace-page .system-settings-section[hidden] {
  display: none !important;
}

#admin-workspace-page .admin-care-user-detail {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 0;
}

#admin-workspace-page .admin-care-user-detail[hidden] {
  display: none !important;
}

#admin-workspace-page .admin-care-user-detail-header h2 {
  margin: 0 0 0.25rem;
  font-size: 1rem;
}

#admin-workspace-page .admin-care-user-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

#admin-workspace-page .admin-care-user-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 0.35rem;
}

#admin-workspace-page .care-user-table tr.care-user-row,
#admin-workspace-page .care-mandant-table tr.care-mandant-row {
  cursor: pointer;
}

#admin-workspace-page .care-user-table tr.care-user-row:hover,
#admin-workspace-page .care-mandant-table tr.care-mandant-row:hover {
  background: var(--studio-primary-soft);
}

#admin-workspace-page .care-user-table tr.care-user-row.is-selected,
#admin-workspace-page .care-mandant-table tr.care-mandant-row.is-selected {
  background: var(--studio-primary-soft);
  color: var(--studio-primary);
}

#admin-workspace-page .care-user-table tr.care-user-row:focus-visible,
#admin-workspace-page .care-mandant-table tr.care-mandant-row:focus-visible {
  outline: 2px solid var(--studio-primary);
  outline-offset: -2px;
}

#admin-workspace-page #care-user-email[readonly],
#admin-workspace-page #care-user-display-name[readonly],
#admin-workspace-page #care-mandant-slug[readonly] {
  opacity: 0.85;
  cursor: default;
}

.jobs-split[hidden] {
  display: none !important;
}

/* Graph 3-Spalten: Canvas | Detail | Chat */
.graph-split-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  outline: none;
  background: var(--studio-surface);
}

.graph-split-col-primary {
  position: relative;
  background: var(--graph-scene-bg, var(--studio-bg));
}

.graph-split-col.is-focused {
  box-shadow: inset 0 0 0 1px var(--studio-primary);
}

.graph-split-handle {
  width: 6px;
  flex: 0 0 6px;
  background: var(--studio-border);
  cursor: col-resize;
  z-index: 3;
}

.graph-split-handle:hover,
.graph-split-handle:focus-visible,
.graph-split.is-resizing .graph-split-handle[data-active="true"] {
  background: var(--studio-primary);
}

.graph-detail-empty {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 0.35rem;
  padding: 1.1rem 1.15rem 0.75rem;
  flex: 1;
  min-height: 0;
  color: var(--studio-text-muted);
}

.graph-detail-empty[hidden] {
  display: none !important;
}

.graph-detail-empty-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--studio-text-muted);
}

#graph-detail-host {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* Pin-UI entfernt: Detail bleibt bis Knotenwechsel sichtbar */
.graph-detail-pin {
  display: none !important;
}

#graph-split.detail-hidden,
#graph-split[data-detail-hidden="true"] {
  grid-template-columns:
    minmax(0, var(--split-col-primary))
    6px
    minmax(0, var(--split-col-chat));
}

#graph-split.detail-hidden .graph-split-col-detail,
#graph-split[data-detail-hidden="true"] .graph-split-col-detail,
#graph-split.detail-hidden .graph-split-handle[data-handle="primary-detail"],
#graph-split[data-detail-hidden="true"] .graph-split-handle[data-handle="primary-detail"] {
  display: none !important;
}

#graph-split:not([data-editor-open="true"]) .graph-split-col-editor,
#graph-split:not([data-editor-open="true"]) .graph-split-handle[data-handle="chat-editor"] {
  display: none !important;
}

#graph-split[data-editor-open="true"],
#graph-split.editor-open,
#graph-split.detail-hidden[data-editor-open="true"],
#graph-split[data-detail-hidden="true"][data-editor-open="true"] {
  grid-template-columns:
    minmax(0, var(--split-col-primary))
    6px
    minmax(0, var(--split-col-chat))
    6px
    minmax(22rem, var(--split-col-editor));
}

#graph-split[data-editor-open="true"] .graph-split-col-detail,
#graph-split[data-editor-open="true"] .graph-split-handle[data-handle="detail-chat"] {
  display: none !important;
}

#graph-split[data-editor-open="true"] .graph-split-handle[data-handle="primary-detail"],
#graph-split[data-editor-open="true"] .graph-split-col-editor,
#graph-split[data-editor-open="true"] .graph-split-handle[data-handle="chat-editor"] {
  display: flex !important;
}

#graph-editor-host,
#graph-chrome-editor-root {
  min-width: 0;
  min-height: 0;
  height: 100%;
}

.anforderung-detail {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  background: var(--studio-surface);
  overflow: hidden;
}

.anforderung-detail[hidden] {
  display: none !important;
}

.feature-detail {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  background: var(--studio-surface);
  overflow: hidden;
}

.feature-detail[hidden] {
  display: none !important;
}

.thema-detail {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  background: var(--studio-surface);
  overflow: hidden;
}

.thema-detail[hidden] {
  display: none !important;
}

.thema-detail-title {
  color: var(--studio-text);
  font-size: 0.95rem;
}

.thema-detail-toolbar {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 0.75rem 0.9rem 0.55rem;
  border-bottom: 1px solid var(--studio-border);
  flex-shrink: 0;
}

.thema-detail-toolbar-top {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
}

.thema-detail-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.45rem;
}

.thema-detail-title-block,
.topic-detail-title-block {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.35rem;
  min-width: 0;
  width: 100%;
}

.thema-detail-title-block .user-note-label-input,
.topic-detail-title-block .user-note-label-input {
  width: 100%;
}

.thema-type-tag {
  width: fit-content;
  max-width: 100%;
  flex: 0 0 auto;
}

.topic-detail-chrome {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--studio-border);
}

.topic-detail-chrome-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.45rem;
}

.thema-detail-mount {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  padding: 0.75rem 0.9rem 1rem;
  gap: 0.75rem;
}

/* Auftragsblatt (Spalte 2) – Header wie Thema, Body als Detail-Form */
.auftrag-detail {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.auftrag-detail-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  padding: 0.75rem 0.9rem 1rem;
  gap: 0.75rem;
}

.auftrag-history-host {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.auftrag-history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.auftrag-history-item {
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--studio-border);
  border-radius: var(--studio-radius);
  background: var(--studio-surface);
}

.auftrag-history-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.35rem;
}

.auftrag-history-side {
  width: fit-content;
}

.auftrag-history-actor,
.auftrag-history-text {
  margin: 0.15rem 0;
  color: var(--studio-text);
}

.auftrag-history-reaction {
  margin: 0.35rem 0 0;
}

.auftrag-detail .detail-form-banner.is-error {
  color: var(--studio-text);
}

.thema-detail-mount .topic-summary-section,
#sc-topics-detail-body .topic-summary-section {
  min-width: 0;
}

.thema-detail-mount .topic-summary-chrono,
#sc-topics-detail-body .topic-summary-chrono {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-width: 0;
}

.thema-detail-mount .topic-summary-entry,
#sc-topics-detail-body .topic-summary-entry {
  min-width: 0;
}

.thema-detail-mount .topic-summary-text,
#sc-topics-detail-body .topic-summary-text,
.thema-detail-mount .leads-text-view,
#sc-topics-detail-body .leads-text-view {
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: pre-wrap;
}

.projekttag-detail {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  background: var(--studio-surface);
  overflow: hidden;
}

.projekttag-detail[hidden] {
  display: none !important;
}

.projekttag-detail-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 0.85rem 0.9rem 1rem;
}

.kunde-detail-contacts {
  min-width: 0;
}

/* Kunden-Detail: Aktionen oben rechts (lokal, kein Standard-Umbau) */
.kunde-detail-header-actions {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.kunde-detail-header-actions .detail-form-close {
  position: static;
  top: auto;
  right: auto;
}

.kunde-detail .detail-form-close {
  position: static;
  top: auto;
  right: auto;
}

.kunde-detail .detail-form-header {
  padding-right: 14.5rem;
}

.angebot-detail .detail-form-header {
  padding-right: 9.5rem;
}

.kunde-detail-subheading {
  margin: 0.35rem 0 0.45rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--studio-text-muted);
}

.kunde-detail-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem 0.85rem;
  margin: 0;
  min-width: 0;
}

.kunde-detail-summary > div {
  min-width: 0;
}

.kunde-detail-summary dt {
  margin: 0;
  font-size: 0.75rem;
  color: var(--studio-text-muted);
}

.kunde-detail-summary dd {
  margin: 0.15rem 0 0;
  color: var(--studio-text);
  word-break: break-word;
}

@media (max-width: 360px) {
  .kunde-detail-summary {
    grid-template-columns: 1fr;
  }
}

/* --- Spalte-2 Detail-Formulare (SSOT) --- */

.detail-form-panel,
#kunde-detail.detail-host-panel,
.kunde-detail.detail-host-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.detail-form-panel[hidden],
#kunde-detail.detail-host-panel[hidden],
.kunde-detail.detail-host-panel[hidden] {
  display: none !important;
}

.detail-form-close {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
  z-index: 4;
  width: 2rem;
  height: 2rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.detail-form-header {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.55rem;
  padding: 1rem 3rem 0.85rem 1rem;
  border-bottom: 1px solid var(--studio-border);
  flex-shrink: 0;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.detail-form-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.65rem;
  min-width: 0;
  width: 100%;
}

.detail-form-title {
  margin: 0;
  min-width: 0;
  flex: 1 1 auto;
  max-width: 100%;
  font-size: 1.05rem;
  font-weight: 650;
  line-height: 1.25;
  color: var(--studio-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Unter dem Titel: Typ-Tag/Toast links, Speicherhinweis rechts */
.detail-title-meta-row,
.detail-form-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem 0.65rem;
  min-width: 0;
  width: 100%;
}

.detail-title-meta-row .leads-status-tag,
.detail-title-meta-row .studio-hint,
.detail-form-meta-row .leads-status-tag,
.detail-form-meta-row .studio-hint {
  flex-shrink: 0;
}

.detail-title-meta-row .user-note-save-status,
.detail-form-meta-row .user-note-save-status {
  flex-shrink: 0;
  margin-left: auto;
  text-align: right;
}

.detail-form-meta {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.5rem;
  min-width: 0;
  width: 100%;
}

.detail-form-banner {
  margin: 0;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--studio-border);
  border-radius: var(--studio-radius);
  background: var(--studio-surface-elevated);
  color: var(--studio-text-muted);
  font-size: 0.82rem;
  line-height: 1.35;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  word-break: break-word;
}

.detail-form-banner[hidden] {
  display: none !important;
}

.detail-form-body,
.kunde-detail-body {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  width: 100%;
  overflow: auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 1.15rem;
  padding: 1rem 1rem 1.25rem;
  box-sizing: border-box;
  container-type: inline-size;
  container-name: detail-form;
}

.detail-form-section {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.65rem;
  min-width: 0;
  width: 100%;
}

.detail-form-section-title {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--studio-text);
}

.detail-form-section .jobs-detail-section-title {
  margin: 0;
}

.detail-form-section > .studio-hint {
  margin: 0;
}

.detail-form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.7rem 0.85rem;
  min-width: 0;
  width: 100%;
}

.detail-form-grid .studio-field {
  margin: 0;
  min-width: 0;
}

.detail-form-grid .studio-field--full {
  grid-column: 1 / -1;
}

/* Eng verwandte Kurzfelder (Ausnahme zum Einspalter), z. B. Kürzel + CSM */
@container detail-form (min-width: 320px) {
  .detail-form-grid--related {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.projekttag-combi-row {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

.projekttag-combi-display {
  flex: 1;
  justify-content: flex-start;
  text-align: left;
  min-height: 2.5rem;
}

.projekttag-combi-display.is-empty {
  color: var(--studio-text-muted);
  font-weight: 400;
}

.projekttag-staff-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: 0.25rem;
  max-height: 28rem;
  overflow: auto;
}

.projekttag-participant-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.projekttag-participant-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.projekttag-participant-group-head h4 {
  margin: 0;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--studio-text-muted);
}

.projekttag-participant-group-head span {
  font-size: 0.75rem;
  color: var(--studio-text-muted);
}

.projekttag-participant-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.projekttag-participant-row,
.projekttag-contact-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--studio-border);
  border-radius: var(--studio-radius);
  background: var(--studio-surface);
  text-align: left;
  color: var(--studio-text);
}

.projekttag-contact-row {
  cursor: pointer;
}

.projekttag-contact-row:hover {
  background: var(--studio-surface-elevated);
}

.projekttag-avatar {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  flex-shrink: 0;
}

.projekttag-avatar--internal {
  background: var(--studio-primary);
  color: #fff;
}

.projekttag-avatar--external {
  background: var(--studio-surface-elevated);
  border: 1px solid var(--studio-border);
  color: var(--studio-text);
}

.projekttag-participant-text {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.projekttag-participant-name {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--studio-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.projekttag-participant-meta {
  font-size: 0.75rem;
  color: var(--studio-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.projekttag-staff-actions,
.projekttag-add-panel-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.projekttag-add-panel {
  margin-top: 0.25rem;
  padding: 0.75rem;
  border: 1px solid var(--studio-border);
  border-radius: var(--studio-radius);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.projekttag-contact-results {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-height: 12rem;
  overflow: auto;
}

.projekttag-staff-fieldset {
  border: 1px solid var(--studio-border);
  border-radius: var(--studio-radius);
  padding: 0.75rem;
  margin: 0;
}

.projekttag-staff-fieldset legend {
  color: var(--studio-text);
  padding: 0 0.25rem;
}

.projekttag-staff-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--studio-text);
}

.projekttag-staff-table {
  width: 100%;
  font-size: 0.85rem;
}

.projekttag-staff-table th,
.projekttag-staff-table td {
  vertical-align: top;
}

.projekttag-staff-notes {
  max-width: 10rem;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--studio-text-muted);
}

.projekttag-staff-add {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.projekttag-staff-add .studio-select {
  flex: 1 1 10rem;
  min-width: 8rem;
}

.thema-detail-mount .topic-summary-changes,
#sc-topics-detail-body .topic-summary-changes {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--studio-border);
}

.thema-detail-mount .topic-summary-chrono-wrap,
#sc-topics-detail-body .topic-summary-chrono-wrap {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--studio-border);
}

.thema-detail-mount .topic-summary-text strong,
#sc-topics-detail-body .topic-summary-text strong {
  color: var(--studio-text);
  font-weight: 600;
}

.lead-detail-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  background: var(--studio-surface);
  overflow: hidden;
}

.lead-detail-panel[hidden] {
  display: none !important;
}

.lead-detail-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 0.9rem 0.55rem;
  border-bottom: 1px solid var(--studio-border);
  flex-shrink: 0;
}

.lead-detail-panel-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.lead-detail-panel-title {
  color: var(--studio-text);
  font-size: 0.95rem;
}

.lead-detail-panel-mount {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
}

.lead-detail-panel-mount .jobs-detail-body,
.lead-detail-panel-mount .leads-detail-body,
.lead-detail-panel-mount .jobs-col-empty {
  flex: 1 1 auto;
  min-height: 0;
}

body.lead-detail-in-graph #leads-open-in-graph {
  display: none !important;
}

.anforderung-detail-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 0.9rem 0.55rem;
  border-bottom: 1px solid var(--studio-border);
  flex-shrink: 0;
}

.anforderung-detail-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
  min-width: 0;
}

.anforderung-detail-meta {
  display: grid;
  grid-template-columns: minmax(0, 8rem);
  gap: 0.75rem;
  padding: 0.65rem 0.9rem 0;
  flex-shrink: 0;
}

.feature-detail-meta {
  display: grid;
  grid-template-columns: minmax(0, 7rem) minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.75rem;
  padding: 0.65rem 0.9rem 0;
  flex-shrink: 0;
  align-items: start;
}

.feature-meta-label {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--studio-text);
  font-size: 0.85rem;
}

.feature-software-options {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.feature-software-option {
  margin: 0;
}

.anforderung-editor-mount {
  flex: 1;
  min-height: 12rem;
  overflow: hidden;
  padding: 0.5rem 0.9rem;
}

.feature-editor-mount {
  flex: 1;
  min-height: 12rem;
  overflow: hidden;
  padding: 0.5rem 0.9rem;
}

@media (max-width: 1100px) {
  .feature-detail-meta {
    grid-template-columns: 1fr;
  }
}

body.graph-detail-active.ai-chat-in-column #ark-chat-panel.ai-chat-column-mode {
  position: relative !important;
  inset: auto !important;
  width: 100% !important;
  height: 100% !important;
  visibility: visible !important;
  pointer-events: auto !important;
  display: flex !important;
  border-left: none;
  box-shadow: none;
}

.jobs-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--studio-surface);
  outline: none;
}

.jobs-col.is-focused {
  box-shadow: inset 0 0 0 1px var(--studio-primary);
}

.jobs-col-list-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--studio-border);
  flex-shrink: 0;
  background: var(--studio-surface-elevated);
  margin-bottom: 0;
}

.jobs-col-list-filters .studio-input,
.jobs-col-list-filters .studio-select {
  min-width: 8rem;
  flex: 1 1 8rem;
}

.jobs-table-host {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 0.5rem;
}

.leads-table-host {
  position: relative;
}

.leads-table-host.leads-table-host--drop-active {
  border-radius: var(--studio-radius, 8px);
  outline: 2px dashed var(--studio-primary);
  outline-offset: -4px;
  background: color-mix(in srgb, var(--studio-primary) 10%, var(--studio-surface));
}

.leads-table-host.leads-table-host--drop-active::after {
  content: "Datei hier ablegen zum Lead-Import";
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--studio-text);
  background: color-mix(in srgb, var(--studio-surface) 78%, transparent);
  border-radius: var(--studio-radius, 8px);
}

.inbox-table-host.inbox-table-host--drop-active {
  border-radius: var(--studio-radius, 8px);
  outline: 2px dashed var(--studio-primary);
  outline-offset: -4px;
  background: color-mix(in srgb, var(--studio-primary) 10%, var(--studio-surface));
}

.inbox-table-host.inbox-table-host--drop-active::after {
  content: "Datei hier ablegen fuer Kommunikation";
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--studio-text);
  background: color-mix(in srgb, var(--studio-surface) 78%, transparent);
  border-radius: var(--studio-radius, 8px);
}

.jobs-list-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.jobs-list-panel[hidden] {
  display: none !important;
}

.jobs-graph-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.jobs-graph-panel[hidden] {
  display: none !important;
}

.jobs-graph-toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.65rem;
  border-bottom: 1px solid var(--studio-border);
  flex-shrink: 0;
  background: var(--studio-surface-elevated);
}

.jobs-graph-host {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: var(--studio-bg);
}

/* Embedded 2D graph in jobs column 1 — override full-page hide rules */
body.jobs-active.jobs-graph-embed #jobs-graph-host #graph-2d,
body.jobs-graph-embed:not(.graph-detail-active) #jobs-graph-host #graph-2d,
body.leads-active.leads-graph-embed #leads-graph-host #graph-2d,
body.leads-graph-embed:not(.graph-detail-active) #leads-graph-host #graph-2d {
  visibility: visible !important;
  pointer-events: auto !important;
  position: absolute;
  inset: 0;
  top: 0;
  left: 0;
  right: auto;
  bottom: 0;
  width: 100% !important;
  height: 100% !important;
  z-index: 1;
  transition: none;
}

.jobs-split-handle,
.leads-split-handle,
.customers-split-handle,
.agent-split-handle {
  width: 6px;
  cursor: col-resize;
  background: var(--studio-border);
  transition: background 0.15s ease;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
  touch-action: none;
}

.jobs-split-handle::before,
.leads-split-handle::before,
.customers-split-handle::before,
.agent-split-handle::before {
  content: "";
  position: absolute;
  inset: 0 -4px;
}

.jobs-split-handle:hover,
.jobs-split-handle:focus-visible,
.jobs-split.is-resizing .jobs-split-handle[data-active="true"],
.leads-split-handle:hover,
.leads-split-handle:focus-visible,
.leads-split.is-resizing .leads-split-handle[data-active="true"],
.customers-split-handle:hover,
.customers-split-handle:focus-visible,
.customers-split.is-resizing .customers-split-handle[data-active="true"],
.capacity-planning-split-handle:hover,
.capacity-planning-split-handle:focus-visible,
.capacity-planning-split.is-resizing .capacity-planning-split-handle[data-active="true"],
.agent-split-handle:hover,
.agent-split-handle:focus-visible,
.agent-cockpit-split.is-resizing .agent-split-handle[data-active="true"] {
  background: var(--studio-primary);
}

/* Selected row highlight for three-column list/detail tables */
.jobs-table .jobs-row.is-selected,
.leads-table .leads-row.is-selected,
.customers-table .customers-row.is-selected,
.knowledge-sources-table .knowledge-sources-row.is-selected,
.abos-table .abos-row.is-selected {
  background: color-mix(in srgb, var(--studio-primary) 18%, transparent);
}

.jobs-table .jobs-row,
.leads-table .leads-row,
.customers-table .customers-row,
.knowledge-sources-table .knowledge-sources-row,
.abos-table .abos-row {
  cursor: pointer;
}

.knowledge-sources-preview {
  margin: 0;
  padding: 0.75rem 1rem 1rem;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 28rem;
  overflow: auto;
  font-family: ui-monospace, "Cascadia Code", "Segoe UI Mono", monospace;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--studio-text-muted);
}

.knowledge-sources-ingest-proposals {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.knowledge-sources-ingest-proposal {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--studio-border);
  border-radius: var(--studio-radius);
  background: var(--studio-surface-elevated);
}

.knowledge-sources-ingest-proposal.is-resolved {
  opacity: 0.75;
}

.knowledge-sources-ingest-proposal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.knowledge-sources-security-findings {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.knowledge-sources-security-finding {
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--studio-border);
  border-radius: var(--studio-radius);
  background: var(--studio-surface-elevated);
}

.knowledge-sources-security-finding.is-high,
.knowledge-sources-security-finding.is-critical {
  border-color: var(--studio-primary);
}

.knowledge-sources-security-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.65rem;
}

.knowledge-sources-security-constraints {
  margin-top: 0.35rem;
}

.knowledge-sources-security-badge {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.1rem 0.45rem;
  border-radius: var(--studio-radius);
  border: 1px solid var(--studio-border);
  background: var(--studio-surface-elevated);
  color: var(--studio-text);
  font-size: 0.78rem;
}

#knowledge-sources-list-panel.is-dragover {
  outline: 2px dashed var(--studio-primary);
  outline-offset: -4px;
}

.customers-address-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem 1rem;
}

.customers-address-grid .customers-field-zip {
  grid-column: 1;
}

.customers-address-grid .customers-field-city {
  grid-column: 2;
}

.customers-contacts-host {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-width: 0;
}

.parties-contacts-table-wrap {
  overflow-x: auto;
  max-width: 100%;
}

.parties-contacts-table .studio-input,
.parties-contacts-table .studio-select,
.parties-contacts-table .studio-textarea {
  width: 100%;
  min-width: 6rem;
}

.parties-contacts-table .studio-textarea {
  min-height: 2.5rem;
  resize: vertical;
}

.customers-contact-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem 0.75rem;
  padding: 0.75rem;
  border: 1px solid var(--studio-border);
  border-radius: var(--studio-radius);
  background: var(--studio-surface-elevated);
}

.customers-contact-card-actions {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.customers-contact-card .parties-contact-salutation-field {
  grid-column: 1 / -1;
}

.customers-contact-card .parties-contact-salutation-field .studio-hint {
  margin: 0.35rem 0 0;
}

.customers-analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 0.75rem;
}

.customers-analytics-card {
  padding: 0.85rem;
}

.customers-analytics-title {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--studio-text);
}

.customers-analytics-placeholder {
  height: 6rem;
  border: 1px dashed var(--studio-border);
  border-radius: var(--studio-radius);
  background: color-mix(in srgb, var(--studio-surface-elevated) 70%, transparent);
  margin-bottom: 0.5rem;
}

.leads-row-title {
  font-weight: 600;
}

.leads-detail-toolbar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.55rem;
}

.leads-detail-toolbar-actions-row {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.leads-detail-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.45rem;
}

/* Schließen steht als letzter Button in der Aktionszeile, nicht überlagernd. */
.leads-detail-toolbar-actions .detail-form-close {
  position: static;
  top: auto;
  right: auto;
}

.leads-detail-toolbar-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 0.75rem;
  min-width: 0;
}

.leads-detail-save-status[hidden] {
  display: none !important;
}

.leads-detail-toolbar-status {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex: 1 1 auto;
  min-width: 0;
}

.leads-detail-save-status {
  margin-left: auto;
  text-align: right;
  flex: 0 0 auto;
}

.leads-detail-save-status.saved {
  color: var(--studio-text-muted);
}

.leads-detail-save-status.saving {
  color: var(--studio-primary);
}

.leads-detail-save-status.error {
  color: var(--studio-danger, #ef5350);
}

.leads-detail-toolbar-main {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-width: 0;
  flex: 1 1 auto;
}

.leads-detail-customer {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--studio-text, var(--neu-text));
}

.leads-detail-crm-refs {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--studio-text-muted, var(--neu-text-muted));
}

.leads-detail-ark-status {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--studio-text-muted, var(--neu-text-muted));
}

.inbox-distribution-state {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.55rem;
  align-items: center;
  font-size: 0.875rem;
}

.inbox-analysis-layout {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.inbox-analysis-topline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.inbox-analysis-block {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.inbox-analysis-block ul {
  margin: 0;
  padding-left: 1.2rem;
}

.inbox-import-analysis-preview {
  margin-top: 0.75rem;
  padding: 0.75rem;
  border-radius: var(--studio-radius, 8px);
  border: 1px solid var(--studio-border);
  background: var(--studio-surface-elevated);
}

.inbox-risk-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--studio-border);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
}

.inbox-risk-badge[data-risk="low"] {
  color: var(--studio-primary);
  background: var(--studio-primary-soft);
  border-color: color-mix(in srgb, var(--studio-primary) 45%, var(--studio-border));
}

.inbox-risk-badge[data-risk="review"] {
  color: var(--studio-text);
  background: color-mix(in srgb, var(--studio-surface-elevated) 88%, transparent);
  border-color: color-mix(in srgb, var(--studio-text-muted) 35%, var(--studio-border));
}

.inbox-risk-badge[data-risk="block"] {
  color: var(--studio-danger);
  background: color-mix(in srgb, var(--studio-danger) 12%, var(--studio-surface));
  border-color: color-mix(in srgb, var(--studio-danger) 40%, var(--studio-border));
}

.inbox-proposal-list {
  display: grid;
  gap: 0.55rem;
}

.inbox-proposal-item {
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--studio-border);
  border-radius: var(--studio-radius, 8px);
  background: color-mix(in srgb, var(--studio-surface-elevated) 88%, transparent);
}

.inbox-proposal-item strong {
  display: inline-block;
  margin-bottom: 0.25rem;
}

.inbox-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.85rem 1.25rem;
  align-items: start;
}

.leads-detail-meta.jobs-detail-kpi-edit.inbox-detail-grid {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.85rem 1.25rem;
  align-items: start;
}

.inbox-detail-col {
  display: grid;
  gap: 0.65rem;
  min-width: 0;
  width: 100%;
}

.inbox-detail-col .studio-field,
.inbox-detail-col .studio-input,
.inbox-detail-col .studio-select,
.inbox-detail-col .inbox-customer-combi {
  width: 100%;
  max-width: none;
  min-width: 0;
  box-sizing: border-box;
}

@media (max-width: 900px) {
  .inbox-detail-grid,
  .leads-detail-meta.jobs-detail-kpi-edit.inbox-detail-grid {
    grid-template-columns: 1fr;
  }
}

.inbox-customer-combi {
  display: flex;
  align-items: stretch;
  gap: 0.45rem;
  min-width: 0;
}

.inbox-customer-combi-value {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  box-sizing: border-box;
  min-height: var(--studio-ui-min-height);
  padding: var(--studio-ui-padding-y) var(--studio-ui-padding-x);
  border: 1px solid color-mix(in srgb, var(--studio-border) 70%, transparent);
  border-radius: var(--studio-radius);
  background: color-mix(in srgb, var(--studio-surface) 55%, var(--studio-bg));
  color: var(--studio-text-muted);
  font: inherit;
  font-size: var(--studio-ui-font-size);
  opacity: 0.92;
  cursor: default;
  user-select: text;
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: none;
}

.inbox-customer-combi-value:not(.is-empty):not(:empty) {
  color: color-mix(in srgb, var(--studio-text) 72%, var(--studio-text-muted));
}

.inbox-customer-combi-value.is-unresolved:not(.is-empty):not(:empty),
.inbox-row-customer.is-unresolved {
  color: var(--studio-text-muted);
  font-style: italic;
}

.inbox-bulk-menu {
  position: relative;
  display: inline-flex;
}

.inbox-bulk-menu-panel {
  position: absolute;
  top: calc(100% + 0.35rem);
  right: 0;
  z-index: 40;
  min-width: 12rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.45rem;
  border: 1px solid var(--studio-border);
  border-radius: var(--studio-radius);
  background: var(--studio-surface-elevated);
  box-shadow: var(--studio-shadow-sm);
}

.inbox-bulk-menu-panel[hidden] {
  display: none !important;
}

.inbox-bulk-menu-item {
  width: 100%;
  justify-content: flex-start;
  text-align: left;
}

.inbox-bulk-picker-results {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: min(45vh, 280px);
  overflow: auto;
  margin-top: 0.35rem;
}

.inbox-bulk-picker-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  width: 100%;
  text-align: left;
}

.inbox-bulk-picker-row.is-selected {
  border-color: var(--studio-primary);
}

.inbox-bulk-ark-new-section {
  margin-top: 0.75rem;
}

.inbox-customer-combi-value:empty::before,
.inbox-customer-combi-value.is-empty::before {
  content: attr(data-placeholder);
  color: color-mix(in srgb, var(--studio-text-muted) 75%, transparent);
  font-style: italic;
}

.inbox-customer-combi-value:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--studio-border) 70%, transparent);
  box-shadow: none;
}

.inbox-customer-combi-search {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.4rem;
  padding-inline: 0.55rem;
}

.inbox-customer-combi-search svg {
  display: block;
}

.inbox-customer-picker-results {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: min(50vh, 360px);
  overflow: auto;
  margin-top: 0.75rem;
}

.inbox-customer-picker-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  width: 100%;
  text-align: left;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--studio-border);
  border-radius: var(--studio-radius);
  background: var(--studio-surface);
  color: var(--studio-text);
  cursor: pointer;
}

.inbox-customer-picker-row:hover,
.inbox-customer-picker-row:focus-visible {
  border-color: var(--studio-primary);
  outline: none;
}

.inbox-customer-picker-row strong {
  font-weight: 650;
}

.inbox-customer-picker-empty {
  margin: 0.75rem 0 0;
}

.leads-status-tag,
.leads-phase-badge {
  --leads-phase-fg: var(--studio-text);
  --leads-phase-bg: color-mix(in srgb, var(--studio-primary) 22%, transparent);
  --leads-phase-border: color-mix(in srgb, var(--studio-primary) 55%, transparent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--leads-phase-border);
  background: var(--leads-phase-bg);
  color: var(--leads-phase-fg);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.2;
  white-space: nowrap;
}

.leads-status-tag {
  font-size: 1rem;
  padding: 0.45rem 1.1rem;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--leads-phase-border) 40%, transparent);
}

.inbox-status-tag,
.inbox-qual-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid var(--studio-border);
  font-weight: 700;
  white-space: nowrap;
}

.inbox-status-tag {
  padding: 0.45rem 1.1rem;
  font-size: 1rem;
}

.inbox-qual-badge {
  padding: 0.2rem 0.55rem;
  font-size: 0.8rem;
}

.inbox-status-tag[data-status="new"] {
  color: var(--studio-primary);
  background: var(--studio-primary-soft);
  border-color: color-mix(in srgb, var(--studio-primary) 45%, var(--studio-border));
}

.inbox-status-tag[data-status="reviewing"] {
  color: var(--studio-text);
  background: color-mix(in srgb, var(--studio-surface-elevated) 88%, transparent);
  border-color: color-mix(in srgb, var(--studio-text-muted) 35%, var(--studio-border));
}

.inbox-status-tag[data-status="distributed"] {
  color: var(--studio-primary);
  background: color-mix(in srgb, var(--studio-primary) 12%, var(--studio-surface));
  border-color: color-mix(in srgb, var(--studio-primary) 38%, var(--studio-border));
}

.inbox-status-tag[data-status="archived"] {
  color: var(--studio-text-muted);
  background: color-mix(in srgb, var(--studio-surface-elevated) 82%, transparent);
  border-color: var(--studio-border);
}

.inbox-qual-badge[data-qualification="unknown"] {
  color: var(--studio-text);
  background: color-mix(in srgb, var(--studio-surface-elevated) 84%, transparent);
}

.inbox-qual-badge[data-qualification="inquiry"] {
  color: var(--studio-primary);
  background: var(--studio-primary-soft);
  border-color: color-mix(in srgb, var(--studio-primary) 45%, var(--studio-border));
}

.inbox-qual-badge[data-qualification="not_an_inquiry"] {
  color: var(--studio-danger);
  background: color-mix(in srgb, var(--studio-danger) 12%, var(--studio-surface));
  border-color: color-mix(in srgb, var(--studio-danger) 40%, var(--studio-border));
}

.inbox-areas-cell {
  vertical-align: middle;
}

.inbox-area-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  align-items: center;
}

.inbox-area-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.45rem;
  border-radius: var(--studio-radius);
  border: 1px solid var(--studio-border);
  background: var(--studio-surface-elevated);
  color: var(--studio-text-muted);
  font-size: 0.75rem;
  font-weight: 600;
}

.inbox-history-timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.inbox-history-item {
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--studio-border);
  border-radius: var(--studio-radius);
  background: var(--studio-surface-elevated);
}

.inbox-history-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-bottom: 0.2rem;
  font-size: 0.75rem;
  color: var(--studio-text-muted);
}

.inbox-history-summary {
  color: var(--studio-text);
  font-size: 0.875rem;
}

.leads-phase-badge {
  font-size: 0.8rem;
  padding: 0.2rem 0.55rem;
  font-weight: 600;
}

.leads-table {
  min-width: 1100px;
}

.leads-ref-cell {
  min-width: 5.5rem;
  max-width: 9rem;
}

.leads-ref-nr {
  font-weight: 600;
  font-size: 0.8125rem;
}

.leads-ref-title {
  font-size: 0.72rem;
  line-height: 1.25;
  margin-top: 0.1rem;
  white-space: normal;
}

.leads-info-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
  min-width: 10rem;
  max-width: 16rem;
}

.leads-info-summary {
  font-size: 0.78rem;
  line-height: 1.3;
  color: var(--studio-text-muted, var(--neu-text-muted));
  white-space: normal;
}

.leads-info-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--studio-border);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--studio-text-muted);
  background: var(--studio-surface);
}

.leads-info-badge[data-severity="ok"] {
  color: #d1fae5;
  border-color: rgba(52, 211, 153, 0.7);
  background: rgba(16, 185, 129, 0.22);
}

.leads-info-badge[data-severity="warn"] {
  color: #fef3c7;
  border-color: rgba(251, 191, 36, 0.75);
  background: rgba(245, 158, 11, 0.22);
}

.leads-info-badge[data-severity="block"] {
  color: #fecaca;
  border-color: rgba(248, 113, 113, 0.8);
  background: rgba(239, 68, 68, 0.22);
}

.leads-detail-processing-info {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin: 0;
  padding: 0.85rem 1rem;
  border: 1px solid var(--studio-border, var(--neu-border));
  border-radius: var(--studio-radius-lg, var(--studio-radius, 12px));
  background: var(--studio-surface-elevated, var(--studio-surface));
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--studio-text, var(--neu-text));
}

.leads-detail-processing-info[data-severity="warn"] {
  border-color: rgba(251, 191, 36, 0.55);
  background: color-mix(in srgb, rgba(245, 158, 11, 0.14) 70%, var(--studio-surface-elevated, var(--studio-surface)));
}

.leads-detail-processing-info[data-severity="block"] {
  border-color: rgba(248, 113, 113, 0.6);
  background: color-mix(in srgb, rgba(239, 68, 68, 0.14) 70%, var(--studio-surface-elevated, var(--studio-surface)));
}

.leads-detail-processing-info[data-severity="ok"] {
  border-color: rgba(52, 211, 153, 0.45);
  background: color-mix(in srgb, rgba(16, 185, 129, 0.12) 70%, var(--studio-surface-elevated, var(--studio-surface)));
}

.leads-detail-processing-info[hidden] {
  display: none !important;
}

.leads-detail-processing-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem 0.75rem;
}

.leads-detail-processing-head-main {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.45rem 0.65rem;
  flex: 1 1 12rem;
  min-width: 0;
}

.leads-detail-processing-summary {
  flex: 1 1 10rem;
  font-size: 0.95rem;
  font-weight: 650;
  line-height: 1.35;
  color: var(--studio-text, var(--neu-text));
}

.leads-processing-refresh-btn {
  flex: 0 0 auto;
  margin-left: auto;
  white-space: nowrap;
}

.leads-processing-refresh-btn.is-loading {
  opacity: 0.75;
  cursor: wait;
}

.lead-processing-agents-checks {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-top: 0.35rem;
}

.lead-processing-agent-check {
  gap: 0.55rem;
}

.leads-detail-processing-block {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.leads-detail-processing-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--studio-text-muted, var(--neu-text-muted));
}

.leads-detail-processing-list {
  margin: 0;
  padding-left: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  color: var(--studio-text, var(--neu-text));
}

.leads-detail-processing-list li {
  line-height: 1.4;
}

.leads-detail-toolbar .jobs-detail-toolbar-actions {
  margin-left: 0;
}

.leads-status-tag[data-phase="analysis"],
.leads-phase-badge[data-phase="analysis"] {
  --leads-phase-fg: #dbeafe;
  --leads-phase-bg: rgba(59, 130, 246, 0.28);
  --leads-phase-border: rgba(96, 165, 250, 0.75);
}

.leads-status-tag[data-phase="offer_instructions"],
.leads-phase-badge[data-phase="offer_instructions"] {
  --leads-phase-fg: #fef3c7;
  --leads-phase-bg: rgba(245, 158, 11, 0.28);
  --leads-phase-border: rgba(251, 191, 36, 0.8);
}

.leads-status-tag[data-phase="customer_feedback"],
.leads-phase-badge[data-phase="customer_feedback"] {
  --leads-phase-fg: #fce7f3;
  --leads-phase-bg: rgba(236, 72, 153, 0.26);
  --leads-phase-border: rgba(244, 114, 182, 0.75);
}

.leads-status-tag[data-phase="sales_request"],
.leads-phase-badge[data-phase="sales_request"] {
  --leads-phase-fg: #ede9fe;
  --leads-phase-bg: rgba(139, 92, 246, 0.28);
  --leads-phase-border: rgba(167, 139, 250, 0.8);
}

.leads-status-tag[data-phase="offer_sent"],
.leads-phase-badge[data-phase="offer_sent"] {
  --leads-phase-fg: #cffafe;
  --leads-phase-bg: rgba(6, 182, 212, 0.28);
  --leads-phase-border: rgba(34, 211, 238, 0.8);
}

.leads-status-tag[data-phase="commissioned"],
.leads-phase-badge[data-phase="commissioned"] {
  --leads-phase-fg: #d1fae5;
  --leads-phase-bg: rgba(16, 185, 129, 0.28);
  --leads-phase-border: rgba(52, 211, 153, 0.85);
}

.leads-text-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 0 0 0.85rem;
  padding: 0.95rem 1.05rem;
  border: 1px solid var(--studio-border);
  border-radius: var(--studio-radius);
  background: var(--studio-surface-elevated);
}

.leads-text-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.leads-text-card-head .jobs-detail-section-title {
  margin: 0;
}

.leads-text-card-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.leads-text-edit-btn {
  min-width: 2.25rem;
  min-height: 2.25rem;
  padding: 0.25rem 0.5rem;
  font-size: 1rem;
  line-height: 1;
}

.leads-text-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.leads-text-view {
  white-space: pre-wrap;
  margin: 0;
  padding: 0.15rem 0;
  color: var(--studio-text);
  line-height: 1.45;
}

.leads-text-editor {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.leads-text-editor[hidden] {
  display: none !important;
}

.leads-text-editor-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.leads-comment-item {
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--studio-border);
  border-radius: var(--studio-radius);
  background: var(--studio-surface);
}

.leads-comment-item p {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.45;
}

.leads-workflow {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.leads-workflow-step {
  padding: 0.75rem;
  border: 1px solid var(--studio-border);
}

.leads-workflow-step.is-active {
  border-color: var(--studio-primary);
}

.leads-workflow-step.is-completed {
  opacity: 0.92;
}

.leads-workflow-step-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.leads-workflow-step-head-main {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
}

.leads-workflow-step-head-main .jobs-detail-section-title {
  margin: 0;
}

.leads-agent-settings-btn {
  flex-shrink: 0;
}

/* Analysedatum als Metainfo rechts oben in der Lead-Analyse-Box. */
.leads-workflow-step-head-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.lead-analysis-date {
  white-space: nowrap;
}

/* Übersichtstabellen der angehängten Bubbles auf der Lead-Karte. */
.leads-attachments-table {
  width: 100%;
}

.leads-attachment-row {
  cursor: pointer;
}

.leads-attachment-row:hover,
.leads-attachment-row:focus-visible {
  background: var(--studio-surface-elevated);
  outline: none;
}

.leads-attachments-meta {
  flex-shrink: 0;
}

.leads-attachments-tools {
  flex: 0 1 auto;
  min-width: 0;
}

.leads-attachments-search {
  width: min(15rem, 40vw);
  min-width: 8rem;
}

/* Sprung-Affordance: Klick auf die Zeile öffnet die Meldung in Spalte 2. */
.leads-attachment-jump-col {
  width: 1.75rem;
}

.leads-attachment-jump {
  width: 1.75rem;
  text-align: right;
  color: var(--studio-text-muted);
  font-size: 1.1rem;
  line-height: 1;
}

.leads-attachment-row:hover .leads-attachment-jump,
.leads-attachment-row:focus-visible .leads-attachment-jump {
  color: var(--studio-primary);
}

/* Vorschau-Länge der Kommunikations-Einträge (Einstellung über das Zahnrad). */
.leads-attachments-host[data-preview-lines="none"] .leads-attachment-preview {
  display: none;
}

.leads-attachments-host[data-preview-lines="2"] .leads-attachment-preview {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.leads-communication-preview-options {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-top: 0.5rem;
}

.leads-communication-preview-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--studio-text);
  cursor: pointer;
}

.leads-workflow-step-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.leads-downstream-preview-card {
  max-width: min(720px, 96vw);
  max-height: min(88vh, 900px);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.leads-downstream-preview-head h2 {
  margin: 0 0 0.35rem;
}

.leads-downstream-preview-body {
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex: 1 1 auto;
}

.leads-downstream-phase {
  border: 1px solid var(--studio-border);
  border-radius: var(--studio-radius);
  background: var(--studio-surface);
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.leads-downstream-phase-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.leads-downstream-phase-head h3 {
  margin: 0;
  font-size: 1rem;
}

.leads-downstream-overwrite-badge {
  font-size: 0.75rem;
  color: var(--studio-text-muted);
  border: 1px solid var(--studio-border);
  border-radius: var(--studio-radius);
  padding: 0.1rem 0.4rem;
}

.leads-downstream-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

@media (max-width: 720px) {
  .leads-downstream-compare {
    grid-template-columns: 1fr;
  }
}

.leads-downstream-compare-col label {
  display: block;
  font-size: 0.8rem;
  color: var(--studio-text-muted);
  margin-bottom: 0.25rem;
}

.leads-downstream-compare-col pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  font-size: 0.85rem;
  line-height: 1.4;
  max-height: 12rem;
  overflow: auto;
  padding: 0.5rem;
  border-radius: var(--studio-radius);
  border: 1px solid var(--studio-border);
  background: var(--studio-bg);
  color: var(--studio-text);
}

.leads-downstream-preview-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.leads-offer-list {
  list-style: none;
  margin: 0.5rem 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.leads-offer-item {
  padding: 0.55rem 0.65rem;
}

.leads-offer-add {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
  gap: 0.5rem;
  align-items: end;
  margin-top: 0.5rem;
}

.leads-comments-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.leads-comment-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  margin-bottom: 0.2rem;
}

/* Angebotsanfrage-Konfigurator (sales_request) */
.lead-sales-config {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 0.85rem 0.9rem;
  margin-bottom: 0.85rem;
  border: 1px solid var(--studio-border);
  border-radius: var(--studio-radius);
  background: var(--studio-surface-elevated);
}

.lead-sales-config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 0.65rem;
}

.lead-sales-positions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.lead-sales-positions-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.lead-sales-positions-head .jobs-detail-section-title {
  margin: 0;
}

.lead-sales-positions-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.lead-sales-position-row {
  display: grid;
  grid-template-columns: minmax(12rem, 2fr) minmax(7.5rem, auto) minmax(8rem, 1.5fr) auto;
  gap: 0.5rem;
  align-items: center;
}

.lead-sales-position-hours {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.lead-sales-position-hours .studio-input {
  width: 5.5rem;
  min-width: 4.5rem;
}

.lead-sales-position-hours-label {
  font-size: 0.85rem;
  color: var(--studio-text-muted);
  white-space: nowrap;
}

.lead-sales-position-remove {
  min-width: 2.25rem;
  padding: 0.25rem 0.5rem;
}

.lead-sales-total {
  margin: 0.75rem 0 0;
  font-weight: 600;
  color: var(--studio-text);
}

.lead-sales-doc-field {
  margin-top: 0.25rem;
}

@media (max-width: 640px) {
  .lead-sales-position-row {
    grid-template-columns: 1fr;
  }
}

/* Strukturierte Lead-Analyse (Bericht, kein Freitext) */
.lead-analysis-host {
  margin-top: 0.25rem;
}

.lead-analysis-doc {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 0.85rem 0.9rem;
  border: 1px solid var(--studio-border);
  border-radius: var(--studio-radius);
  background: var(--studio-surface-elevated);
}

.lead-analysis-section {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.lead-analysis-section-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--studio-text);
}

.lead-analysis-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.lead-analysis-table th,
.lead-analysis-table td {
  padding: 0.45rem 0.55rem;
  border-bottom: 1px solid var(--studio-border);
  text-align: left;
  vertical-align: top;
}

.lead-analysis-table thead th {
  background: var(--studio-surface);
  color: var(--studio-text);
  font-weight: 700;
}

.lead-analysis-rating.is-strong {
  color: var(--studio-text);
}

.lead-analysis-rating.is-medium {
  color: var(--studio-text-muted);
}

.lead-import-modal-card {
  width: min(40rem, calc(100vw - 2rem));
  max-height: min(90vh, 52rem);
  overflow: auto;
}

.lead-import-customer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 0.75rem;
}

.lead-import-source {
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.lead-import-dropzone {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 5.5rem;
  padding: 0.85rem 1rem;
  text-align: center;
  border: 1px dashed var(--studio-border);
  border-radius: var(--studio-radius);
  background: var(--studio-surface);
  color: var(--studio-text-muted);
  cursor: pointer;
}

.lead-import-dropzone:hover,
.lead-import-dropzone:focus-visible {
  border-color: var(--studio-primary);
  color: var(--studio-text);
}

.lead-import-dropzone.dragover {
  border-color: var(--studio-primary);
  background: color-mix(in srgb, var(--studio-primary) 12%, var(--studio-surface));
  color: var(--studio-text);
}

.jobs-col-empty {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.35rem 0.5rem;
  padding: 0.45rem 0.65rem;
  text-align: center;
  flex: 0 0 auto;
  min-height: 0;
  border-bottom: 1px solid var(--studio-border);
  background: var(--studio-surface-elevated);
}

.jobs-col-empty-title {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--studio-text-muted);
}

.jobs-col-empty .studio-hint {
  margin: 0;
  font-size: 0.75rem;
}

.jobs-col-empty[hidden],
.jobs-detail-body[hidden],
.jobs-agent-body[hidden] {
  display: none !important;
}

.jobs-detail-body,
.jobs-agent-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  padding: 0.75rem;
  gap: 0.75rem;
}

.jobs-detail-body {
  overflow: auto;
}

.jobs-agent-body {
  overflow: hidden;
  gap: 0.55rem;
  padding: 0.65rem;
}

.jobs-detail-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  flex-shrink: 0;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--studio-border);
}

.jobs-detail-toolbar-main {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
  flex: 1 1 auto;
}

.jobs-detail-presence {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.jobs-detail-presence-assignee,
.jobs-detail-presence-viewers,
.jobs-detail-processing-hint {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.35;
}

.jobs-detail-processing-hint {
  color: var(--studio-primary);
}

.jobs-detail-processing-hint[hidden] {
  display: none !important;
}

.jobs-detail-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  flex-shrink: 0;
  align-items: center;
  margin-left: auto;
}

.leads-detail-toolbar.jobs-detail-toolbar {
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: stretch;
  justify-content: flex-start;
  gap: 0.55rem;
}

.leads-detail-toolbar .jobs-detail-toolbar-main {
  gap: 0.2rem;
  flex: 1 1 auto;
  min-width: 0;
}

.leads-detail-toolbar .jobs-detail-toolbar-actions {
  margin-left: 0;
}

/* Posteingang/Nachricht: Titel + Aktionen oben, Status/Meta darunter, Routing volle Breite */
.inbox-detail-toolbar.leads-detail-toolbar.jobs-detail-toolbar {
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: stretch;
  justify-content: flex-start;
  gap: 0.45rem;
}

.inbox-detail-toolbar-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.55rem 1rem;
  width: 100%;
  min-width: 0;
}

.inbox-detail-toolbar-row .jobs-detail-toolbar-actions {
  margin-left: auto;
  flex: 0 1 auto;
  justify-content: flex-end;
}

/* Richtung/Art der Kommunikation steht links in der Button-Zeile (wie im Job-Panel). */
.inbox-detail-source-hint {
  flex: 0 1 auto;
  min-width: 0;
  align-self: center;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.inbox-detail-title-field {
  width: 100%;
  min-width: 0;
}

.inbox-detail-meta-row {
  justify-content: flex-start;
  align-items: center;
  gap: 0.45rem 0.75rem;
}

.inbox-detail-meta-row .inbox-distribution-state {
  flex: 1 1 auto;
  min-width: 0;
}

/* Eng verwandte Kurzfelder paarweise in einer Zeile (Art/Status, Eingang/Fälligkeit) */
.inbox-detail-field-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
  min-width: 0;
}

@media (max-width: 900px) {
  .inbox-detail-field-pair {
    grid-template-columns: 1fr;
  }
}

/* Wissensquellen: Titel links (umbricht), Aktionen oben rechts, Meta/Tags darunter */
.knowledge-sources-detail-toolbar.leads-detail-toolbar.jobs-detail-toolbar {
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: stretch;
  justify-content: flex-start;
  gap: 0.45rem;
}

.knowledge-sources-detail-toolbar-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.55rem 1rem;
  width: 100%;
  min-width: 0;
}

.knowledge-sources-detail-toolbar-row .leads-detail-customer {
  flex: 1 1 12rem;
  min-width: 0;
  max-width: min(100%, 28rem);
  margin: 0;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.knowledge-sources-detail-toolbar-row .jobs-detail-toolbar-actions {
  margin-left: auto;
  flex: 0 1 auto;
  justify-content: flex-end;
}

.knowledge-sources-detail-meta-row {
  justify-content: flex-start;
  gap: 0.45rem 0.75rem;
}

.knowledge-sources-detail-meta-row .leads-detail-crm-refs {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
}

.jobs-detail-abgeben-status {
  margin: 0;
  font-size: 0.75rem;
}

.jobs-detail-title-block {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex-shrink: 0;
  margin: 0.15rem 0 0.35rem;
}

.jobs-detail-title-block .jobs-detail-title-field {
  margin: 0;
}

.jobs-detail-context {
  padding: 0.75rem;
  display: grid;
  gap: 0.65rem;
  flex-shrink: 0;
}

.jobs-detail-context .jobs-detail-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.jobs-detail-context-obsolete {
  margin: 0;
  color: var(--studio-danger, #e57373);
}

.jobs-detail-source-quote {
  max-height: 14rem;
  overflow: auto;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--studio-border);
  border-radius: var(--studio-radius);
  background: var(--studio-bg);
  color: var(--studio-text);
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.9rem;
  line-height: 1.45;
}

.jobs-detail-source-quote[hidden] {
  display: none !important;
}

.jobs-detail-source-quote-field {
  margin: 0;
}

.jobs-detail-kpi {
  padding: 0.75rem;
  display: grid;
  gap: 0.75rem;
  flex-shrink: 0;
}

.jobs-detail-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
  gap: 0.55rem 0.75rem;
  margin: 0;
}

.jobs-detail-kpi-item {
  min-width: 0;
}

.jobs-detail-kpi-item[hidden] {
  display: none !important;
}

.jobs-detail-kpi-item dt {
  margin: 0;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--studio-text-muted);
}

.jobs-detail-kpi-item dd {
  margin: 0.15rem 0 0;
  font-size: 0.88rem;
  color: var(--studio-text);
  word-break: break-word;
}

.jobs-detail-kpi-edit {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr));
  gap: 0.55rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--studio-border);
}

.jobs-detail-kpi-edit .studio-field {
  margin: 0;
}

.leads-detail-meta.jobs-detail-kpi-edit {
  grid-template-columns: minmax(14rem, 1fr) minmax(10rem, 14rem) minmax(8rem, 12rem);
  gap: 0.65rem 0.85rem;
  align-items: end;
}

.leads-detail-meta .leads-detail-meta-item--title {
  min-width: 0;
}

.leads-detail-meta .leads-detail-meta-item--title .studio-input {
  width: 100%;
  min-width: 0;
}

@media (max-width: 900px) {
  .leads-detail-meta.jobs-detail-kpi-edit {
    grid-template-columns: 1fr;
  }
}

.jobs-detail-ki-summary {
  padding: 0.75rem;
  flex-shrink: 0;
}

.jobs-detail-section-title {
  margin: 0 0 0.45rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--studio-text);
}

.jobs-detail-ki-summary-text {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--studio-text-muted);
  white-space: pre-wrap;
}

.jobs-detail-task {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  flex-shrink: 0;
}

.jobs-detail-section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.jobs-detail-section-head .jobs-detail-section-title {
  margin: 0;
}

.jobs-detail-editor-mount.user-note-editor-mount,
#jobs-detail-editor-mount {
  flex: 0 0 auto !important;
  min-height: 320px !important;
  height: 320px !important;
  padding: 0 !important;
  overflow: hidden;
  border: 1px solid var(--studio-border);
  border-radius: var(--studio-radius);
  background: var(--studio-surface);
}

#jobs-detail-editor-mount .toastui-editor-defaultUI {
  height: 320px !important;
  border: none;
  display: flex;
  flex-direction: column;
}

#jobs-detail-editor-mount .toastui-editor-toolbar,
#jobs-detail-editor-mount .toastui-editor-defaultUI-toolbar {
  flex: 0 0 auto;
}

#jobs-detail-editor-mount .toastui-editor-main {
  flex: 1 1 auto !important;
  min-height: 240px !important;
  height: auto !important;
  position: relative;
}

#jobs-detail-editor-mount .toastui-editor-main-container,
#jobs-detail-editor-mount .toastui-editor-ww-container,
#jobs-detail-editor-mount .toastui-editor-md-container {
  min-height: 240px !important;
  height: 100% !important;
}

#jobs-detail-editor-mount .toastui-editor-contents,
#jobs-detail-editor-mount .ProseMirror,
#jobs-detail-editor-mount .toastui-editor-ww-container .ProseMirror,
#jobs-detail-editor-mount .CodeMirror {
  min-height: 220px !important;
}

.jobs-analytics-host {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.jobs-analytics-host[hidden] {
  display: none !important;
}

.jobs-agent-body,
.job-agent-chat-shell {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  gap: 0.55rem;
}

.job-agent-lists {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
  flex-shrink: 0;
}

.job-agent-list-heading {
  margin: 0 0 0.3rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--studio-text-muted);
}

.job-agent-thread-list {
  display: grid;
  gap: 0.3rem;
}

.job-agent-thread-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  width: 100%;
  text-align: left;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--studio-border);
  border-radius: var(--studio-radius);
  background: var(--studio-surface-elevated);
  color: var(--studio-text);
  cursor: pointer;
}

.job-agent-thread-item.is-active {
  border-color: var(--studio-primary);
  box-shadow: inset 0 0 0 1px var(--studio-primary);
}

.job-agent-thread-item:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.job-agent-thread-title {
  font-size: 0.82rem;
  font-weight: 600;
}

.job-agent-thread-hint {
  margin: 0;
  font-size: 0.72rem;
}

.job-agent-transcript {
  flex: 1;
  min-height: 10rem;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.45rem;
  border: 1px solid var(--studio-border);
  border-radius: var(--studio-radius);
  background: var(--studio-bg);
}

.job-agent-bubble {
  max-width: 100%;
  padding: 0.55rem 0.65rem;
  border-radius: var(--studio-radius);
  border: 1px solid var(--studio-border);
  background: var(--studio-surface);
}

.job-agent-bubble--user {
  align-self: flex-end;
  background: color-mix(in srgb, var(--studio-primary) 16%, var(--studio-surface));
}

.job-agent-bubble--assistant {
  align-self: flex-start;
}

.job-agent-bubble-meta {
  margin: 0 0 0.25rem;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--studio-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.job-agent-bubble-text {
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--studio-text);
  word-break: break-word;
}

.job-agent-question-blocks {
  margin-top: 0.55rem;
  display: grid;
  gap: 0.65rem;
}

.job-agent-question-text {
  margin: 0;
  font-weight: 600;
  font-size: 0.85rem;
}

.job-agent-option-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.35rem 0;
}

.job-agent-option-chip.is-selected {
  border-color: var(--studio-primary);
  color: var(--studio-primary);
}

.job-agent-skill-steps {
  margin: 0.4rem 0 0;
  padding-left: 1.1rem;
  font-size: 0.82rem;
  color: var(--studio-text-muted);
}

.job-agent-skill-cards {
  display: grid;
  gap: 0.45rem;
  margin-top: 0.5rem;
}

.job-agent-skill-card {
  border: 1px solid var(--studio-border);
  border-radius: var(--studio-radius);
  background: var(--studio-surface);
  padding: 0.45rem 0.55rem;
}

.job-agent-skill-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.job-agent-skill-card-head code {
  font-size: 0.78rem;
  color: var(--studio-primary);
}

.job-agent-skill-card-args,
.job-agent-skill-card-note {
  margin: 0.25rem 0 0;
}

.job-agent-hybrid-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.75rem;
  padding: 0.45rem 0.75rem 0.2rem;
  border-bottom: 1px solid var(--studio-border);
  flex-shrink: 0;
}

.job-agent-hybrid-title {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--studio-text);
}

.job-agent-hybrid-hint {
  margin: 0;
  font-size: 0.72rem;
}

.job-agent-composer-bar {
  display: grid;
  gap: 0.4rem;
  flex-shrink: 0;
}

.job-agent-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.job-agent-empty-hint {
  margin: auto;
  text-align: center;
}

.job-agent-memories,
.job-agent-execution-log {
  font-size: 0.82rem;
  color: var(--studio-text-muted);
}

.job-agent-memories ul,
.job-agent-execution-log ul {
  margin: 0.35rem 0 0;
  padding-left: 1.1rem;
  display: grid;
  gap: 0.25rem;
}

.jobs-table-wrap {
  overflow: auto;
  border-radius: var(--neu-radius);
}

.jobs-table tbody tr {
  cursor: pointer;
}

.jobs-table tbody tr:hover {
  background: rgba(110, 150, 210, 0.08);
}

.jobs-row--pinned {
  background: rgba(110, 150, 210, 0.06);
}

.jobs-table {
  table-layout: auto;
  width: 100%;
}

.jobs-col-title {
  min-width: 10rem;
  max-width: 22rem;
  width: 22rem;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  vertical-align: top;
}

.jobs-title-text {
  display: block;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.jobs-col-assignee {
  min-width: 8rem;
}

.jobs-assignee-cell {
  cursor: pointer;
}

.jobs-assignee-cell:hover {
  color: var(--neu-accent);
}

.jobs-assignee-placeholder {
  color: var(--neu-text-muted);
  font-style: italic;
}

.jobs-assignee-picker {
  position: fixed;
  z-index: 100010;
  min-width: 240px;
  max-width: min(320px, 92vw);
  padding: 0.85rem;
  display: grid;
  gap: 0.75rem;
  box-shadow: var(--studio-shadow-sm, var(--neu-shadow));
}

.jobs-assignee-picker-title {
  font-size: 0.9rem;
  font-weight: 600;
}

.jobs-assignee-picker-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.jobs-detail-card {
  display: grid;
  gap: 1.25rem;
}

.jobs-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.jobs-detail-header-main {
  display: grid;
  gap: 0.45rem;
  flex: 1;
  min-width: 0;
}

.jobs-detail-header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
}

.jobs-detail-title-field {
  margin: 0;
}

.jobs-detail-save-status.is-saving {
  color: var(--studio-primary);
}

.jobs-detail-save-status.is-saved {
  color: var(--studio-text-muted);
}

.jobs-detail-save-status.is-error {
  color: var(--studio-danger, #e07070);
}

.jobs-detail-form {
  display: grid;
  gap: 1.25rem;
}

.jobs-detail-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.85rem 1.25rem;
}

.jobs-detail-meta-item {
  display: grid;
  gap: 0.35rem;
}

.jobs-detail-meta-item--readonly {
  align-content: start;
}

.jobs-detail-meta-label {
  font-size: 0.8rem;
  color: var(--neu-text-muted);
}

.jobs-detail-meta-value {
  font-weight: 500;
}

.jobs-detail-meta-item dt {
  font-size: 0.8rem;
  color: var(--neu-text-muted);
  margin-bottom: 0.2rem;
}

.jobs-detail-meta-item dd {
  font-weight: 500;
}

.jobs-detail-section h3 {
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
}

.jobs-detail-completion {
  display: grid;
  gap: 0.85rem;
}

.jobs-detail-completed-hint {
  margin: 0;
}

.jobs-detail-content-input {
  min-height: 8rem;
  resize: vertical;
}

.jobs-detail-content {
  white-space: pre-wrap;
  line-height: 1.5;
}

.jobs-detail-attachments {
  list-style: none;
  display: grid;
  gap: 0.35rem;
  margin-top: 0.65rem;
}

.jobs-detail-attachment-link {
  color: var(--studio-primary);
  text-decoration: none;
}

.jobs-detail-attachment-link:hover {
  text-decoration: underline;
}

.jobs-detail-dropzone {
  margin-top: 0.35rem;
  border: 1px dashed var(--studio-border);
  border-radius: var(--studio-radius);
  padding: 1.25rem 1rem;
  text-align: center;
  color: var(--studio-text-muted);
  background: var(--studio-surface);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.jobs-detail-dropzone:hover,
.jobs-detail-dropzone:focus-visible {
  border-color: var(--studio-primary);
  color: var(--studio-text);
  outline: none;
}

.jobs-detail-dropzone.dragover {
  border-color: var(--studio-primary);
  color: var(--studio-text);
  background: var(--studio-surface-elevated);
}

.jobs-detail-dropzone.is-uploading {
  pointer-events: none;
  opacity: 0.7;
}

.job-panel {
  right: var(--right-rail-width);
  width: var(--job-panel-width);
}

.job-panel.detail-host-panel {
  right: auto;
  width: 100% !important;
}

.job-panel-meta {
  display: grid;
  gap: 0.75rem;
  padding: 0.75rem 1rem 0;
}

.job-panel-meta-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.job-panel-abgeben {
  margin: 0.75rem 1rem 0;
  flex-shrink: 0;
}

.job-panel-abgeben-body {
  padding: 0.75rem 1rem;
}

.job-panel-abgeben-title {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.job-panel-abgeben.is-completed #job-abgeben-status {
  color: var(--studio-primary);
}

.job-comments-timeline {
  list-style: none;
  margin: 0.75rem 0 1rem;
  padding: 0 0 0 1.25rem;
  border-left: 2px solid var(--studio-border);
  display: grid;
  gap: 1rem;
}

.job-comment-item {
  position: relative;
  padding-left: 0.5rem;
}

.job-comment-item::before {
  content: "";
  position: absolute;
  left: -1.38rem;
  top: 0.45rem;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--studio-primary);
  border: 2px solid var(--studio-surface);
}

.job-comment-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.job-comment-meta {
  font-size: 0.82rem;
  color: var(--studio-text-muted);
  margin-bottom: 0.35rem;
}

.job-comment-body {
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.job-comment-actions {
  display: flex;
  gap: 0.25rem;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.job-comment-item:hover .job-comment-actions,
.job-comment-item:focus-within .job-comment-actions {
  opacity: 1;
}

.job-comment-compose {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--studio-border);
}

.job-comment-compose-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.5rem;
}

.job-comment-edit-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.job-comment-item.is-deleted .job-comment-body {
  font-style: italic;
}

.job-panel-attachments {
  padding: 0.75rem 1rem 1rem;
  border-top: 1px solid var(--neu-border);
}

.job-panel-attachments-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.job-panel-attachments-header h3 {
  font-size: 0.95rem;
  font-weight: 600;
}

.job-attachments-list ul {
  list-style: none;
  display: grid;
  gap: 0.35rem;
}

#error-tracking-page {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: none;
  background: var(--studio-bg);
  color: var(--studio-text);
  padding: 5.5rem 1.25rem 1.25rem;
  box-sizing: border-box;
}

#error-tracking-page.open {
  display: flex;
  flex-direction: column;
}

.agent-dashboard-shell {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.error-tracking-shell {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.agent-dashboard-header-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.error-tracking-header-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.agent-dashboard-content-area {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  flex: 1;
  min-height: 0;
}

.error-tracking-content-area {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  flex: 1;
  min-height: 0;
}

.agent-cockpit-table-wrap {
  overflow: auto;
  border-radius: var(--neu-radius);
  background: var(--neu-bg);
  box-shadow: var(--neu-inset-shadow);
}

.agent-cockpit-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.agent-cockpit-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  text-align: left;
  padding: 0.75rem 0.9rem;
  font-weight: 600;
  color: var(--neu-text-muted);
  background: var(--neu-bg);
  border-bottom: 1px solid color-mix(in srgb, var(--neu-dark) 18%, transparent);
  white-space: nowrap;
}

.agent-cockpit-table tbody td {
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid color-mix(in srgb, var(--neu-dark) 10%, transparent);
  vertical-align: middle;
}

.agent-cockpit-row {
  cursor: pointer;
  transition: background 0.15s ease;
}

.agent-cockpit-row:hover,
.agent-cockpit-row:focus-visible {
  background: color-mix(in srgb, var(--neu-accent-soft) 35%, var(--neu-bg));
  outline: none;
}

.agent-cockpit-row.is-selected {
  background: color-mix(in srgb, var(--neu-accent-soft) 55%, var(--neu-bg));
}

.agent-cockpit-kind {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

.agent-cockpit-kind--global {
  background: color-mix(in srgb, var(--neu-accent) 18%, var(--neu-bg));
  color: var(--neu-accent);
}

.agent-cockpit-kind--ark {
  background: color-mix(in srgb, var(--neu-dark) 12%, var(--neu-bg));
  color: var(--neu-text-muted);
}

.agent-cockpit-layout {
  display: grid;
  grid-template-columns: minmax(200px, 260px) minmax(0, 1fr);
  gap: 1rem;
  flex: 1;
  min-height: 0;
}

.agent-cockpit-nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.75rem;
  border-radius: var(--neu-radius);
  background: var(--neu-bg);
  box-shadow: var(--neu-inset-shadow);
  overflow: auto;
  min-height: 0;
}

.agent-cockpit-nav-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  width: 100%;
  text-align: left;
  padding: 0.65rem 0.75rem;
  border: none;
  border-radius: var(--neu-radius-sm);
  background: transparent;
  color: var(--neu-text);
  cursor: pointer;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.agent-cockpit-nav-btn:hover,
.agent-cockpit-nav-btn:focus-visible {
  background: color-mix(in srgb, var(--neu-light) 40%, var(--neu-bg));
  outline: none;
}

.agent-cockpit-nav-btn.active {
  background: var(--neu-bg);
  box-shadow: var(--neu-extrude-shadow);
}

.agent-cockpit-nav-btn-title {
  font-weight: 600;
  font-size: 0.9rem;
}

.agent-cockpit-nav-btn-meta {
  font-size: 0.78rem;
  color: var(--neu-text-muted);
}

.agent-cockpit-detail {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-height: 0;
  overflow: auto;
  padding: 0.25rem 0.15rem 0.25rem 0;
}

.agent-cockpit-detail-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.agent-cockpit-detail-header h2 {
  margin: 0;
  font-size: 1.25rem;
}

.agent-cockpit-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.65rem;
}

.agent-cockpit-meta-item {
  padding: 0.65rem 0.75rem;
  border-radius: var(--neu-radius-sm);
  background: var(--neu-bg);
  box-shadow: var(--neu-inset-shadow);
}

.agent-cockpit-meta-item dt {
  margin: 0;
  font-size: 0.75rem;
  color: var(--neu-text-muted);
}

.agent-cockpit-meta-item dd {
  margin: 0.2rem 0 0;
  font-size: 0.9rem;
  font-weight: 600;
}

.agent-cockpit-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1rem;
  border-radius: var(--neu-radius);
  background: var(--neu-bg);
  box-shadow: var(--neu-inset-shadow);
}

.agent-cockpit-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 0.35rem;
}

.agent-cockpit-empty {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--neu-text-muted);
}

@media (max-width: 900px) {
  .agent-cockpit-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .agent-cockpit-nav {
    max-height: 220px;
  }

  .agent-cockpit-table thead {
    display: none;
  }

  .agent-cockpit-table tbody tr {
    display: grid;
    gap: 0.35rem;
    padding: 0.75rem 0;
  }

  .agent-cockpit-table tbody td {
    display: block;
    border: none;
    padding: 0.15rem 0.9rem;
  }

  .agent-cockpit-table tbody td::before {
    content: attr(data-label);
    display: inline-block;
    min-width: 7.5rem;
    margin-right: 0.5rem;
    color: var(--neu-text-muted);
    font-size: 0.78rem;
    font-weight: 600;
  }
}

/* Admin workspace (Systemeinstellungen + Pflege) — same shell pattern as Jobs */

body.admin-workspace-active #ark-select,
body.system-settings-active #ark-select {
  visibility: hidden;
  pointer-events: none;
  width: 0;
  min-width: 0;
  padding: 0;
  margin: 0;
  border: none;
  opacity: 0;
}

body.admin-workspace-active #graph-split,
body.system-settings-active #graph-split,
body.admin-workspace-active #graph-2d,
body.system-settings-active #graph-2d,
body.admin-workspace-active #hud,
body.system-settings-active #hud,
body.admin-workspace-active #toolbar,
body.system-settings-active #toolbar,
body.admin-workspace-active #ark-chat-panel,
body.system-settings-active #ark-chat-panel,
body.admin-workspace-active #chat-fab,
body.system-settings-active #chat-fab,
body.admin-workspace-active #search-center-container,
body.system-settings-active #search-center-container,
body.admin-workspace-active #graph-header-stack,
body.system-settings-active #graph-header-stack,
body.admin-workspace-active #stats-chip,
body.system-settings-active #stats-chip,
body.admin-workspace-active #agent-dock-bar,
body.system-settings-active #agent-dock-bar,
body.admin-workspace-active #sequence-timeline,
body.system-settings-active #sequence-timeline {
  visibility: hidden;
  pointer-events: none;
}

#admin-workspace-page,
#system-settings-page {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: none;
  background: var(--neu-bg);
  color: var(--neu-text);
  padding: 0.85rem 0.75rem 0.75rem;
  box-sizing: border-box;
}

#admin-workspace-page.open,
#system-settings-page.open {
  display: flex;
  flex-direction: column;
}

.system-settings-shell {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.system-settings-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

.system-settings-header h1 {
  margin: 0 0 0.25rem;
  font-size: 1.15rem;
  color: var(--neu-text);
}

.system-settings-header-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.system-settings-layout {
  display: grid;
  grid-template-columns: minmax(180px, 220px) minmax(0, 1fr);
  flex: 1;
  min-height: 0;
}

.system-settings-nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1rem 0.75rem;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  overflow-y: auto;
}

.system-settings-nav-btn {
  text-align: left;
  padding: 0.65rem 0.85rem;
  border: none;
  border-radius: var(--neu-radius-sm);
  background: var(--neu-bg);
  color: var(--neu-text-muted);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  box-shadow: var(--neu-extrude-shadow);
  transition: box-shadow 160ms ease, color 160ms ease;
}

.system-settings-nav-btn:hover {
  color: var(--neu-text);
}

.system-settings-nav-btn.active {
  color: var(--neu-text);
  box-shadow: var(--neu-inset-shadow);
}

.system-settings-nav-btn:focus-visible {
  outline: none;
  box-shadow: var(--neu-extrude-shadow), var(--neu-focus-ring);
}

.system-settings-nav-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-top: 0.35rem;
}

.system-settings-nav-group-label {
  padding: 0.35rem 0.85rem 0.15rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--neu-text-muted);
}

.system-settings-nav-btn-child {
  margin-left: 0.55rem;
  padding-left: 0.75rem;
  font-size: 0.82rem;
}

.system-settings-content {
  overflow-y: auto;
  padding: 1rem 1.25rem 1.5rem;
  min-height: 0;
}

.system-settings-section {
  display: none;
  max-width: 1100px;
}

.system-settings-section.active {
  display: block;
}

.system-settings-section-catalog {
  max-width: none;
  height: 100%;
  min-height: 0;
}

.system-settings-section-catalog.active {
  display: flex;
  flex-direction: column;
}

.system-settings-section h2 {
  font-size: 1rem;
  margin: 0 0 0.35rem;
  color: var(--neu-text);
}

.system-settings-section h3 {
  font-size: 0.88rem;
  margin: 1.25rem 0 0.5rem;
  color: var(--neu-text);
}

.system-settings-section .settings-hint {
  font-size: 11px;
  color: var(--neu-text-muted);
  margin-bottom: 0.85rem;
  line-height: 1.4;
}

.system-node-type-row,
.system-connection-rule-row,
.system-pair-rule-row {
  margin-bottom: 0;
  border: none;
  border-radius: 0;
  padding: 0;
  background: transparent;
  box-shadow: none;
  display: table-row;
}

.system-node-type-count {
  margin: -0.35rem 0 0.65rem;
  font-weight: 600;
  color: var(--neu-text);
}

.system-node-type-table-wrap {
  overflow-x: auto;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--neu-radius-sm);
}

.system-node-type-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

.system-node-type-table th,
.system-node-type-table td {
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  vertical-align: middle;
  text-align: left;
}

.system-node-type-table thead th {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--neu-text-muted);
  background: rgba(255, 255, 255, 0.03);
  white-space: nowrap;
}

.system-node-type-table tbody tr:last-child td {
  border-bottom: none;
}

.system-node-type-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.system-node-type-key-cell code {
  font-size: 0.72rem;
  color: var(--neu-text-muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.system-node-type-color-cell {
  width: 4.5rem;
}

.system-node-type-table input[type="text"] {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.system-node-type-table input[type="color"] {
  width: 2.5rem;
  height: 2rem;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  display: block;
}

.system-connection-rule-row,
.system-pair-rule-row {
  margin-bottom: 0.55rem;
  border: none;
  border-radius: var(--neu-radius-sm);
  padding: 0.55rem 0.75rem 0.65rem;
  background: var(--neu-bg);
  box-shadow: var(--neu-inset-shadow);
  display: grid;
  gap: 0.45rem;
}

@media (min-width: 720px) {
  .system-connection-rule-row,
  .system-pair-rule-row {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    align-items: end;
  }
}

.system-node-type-row label,
.system-connection-rule-row label,
.system-pair-rule-row label {
  display: grid;
  gap: 0.2rem;
  font-size: 0.74rem;
  color: var(--neu-text-muted);
}

.system-connection-rule-row input,
.system-connection-rule-row select,
.system-pair-rule-row input,
.system-pair-rule-row select {
  width: 100%;
  box-sizing: border-box;
  padding: 0.45rem 0.55rem;
  border-radius: var(--neu-radius-sm);
  border: none;
  background: var(--neu-bg);
  color: var(--neu-text);
  box-shadow: var(--neu-inset-shadow);
  font: inherit;
  font-size: 0.8125rem;
}

#system-node-type-list {
  display: block;
}

#system-connection-rules-list,
#system-pair-rules-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: 0.5rem;
}

/* Lead catalog master-detail */

.system-catalog-split {
  display: grid;
  grid-template-columns: minmax(200px, 280px) minmax(0, 1fr);
  gap: 0.85rem;
  flex: 1;
  min-height: min(70vh, 640px);
  align-items: stretch;
}

.system-catalog-list-rail {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-height: 0;
  padding: 0.75rem;
  border-radius: var(--neu-radius);
  background: var(--neu-bg);
  box-shadow: var(--neu-inset-shadow);
  overflow: hidden;
}

.system-catalog-list-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.system-catalog-list-toolbar h2 {
  margin: 0;
  font-size: 0.95rem;
}

.system-catalog-list-toolbar .studio-btn,
.system-catalog-list-toolbar .neu-btn {
  flex-shrink: 0;
  white-space: nowrap;
  margin-top: 0;
}

.system-catalog-list-hint {
  margin-bottom: 0.35rem !important;
}

.system-catalog-item-list {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  overflow-y: auto;
  min-height: 0;
  flex: 1;
  padding-right: 0.15rem;
}

.system-catalog-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.55rem 0.7rem;
  border: none;
  border-radius: var(--neu-radius-sm);
  background: transparent;
  color: var(--neu-text);
  font: inherit;
  font-size: 0.84rem;
  cursor: pointer;
  box-shadow: none;
}

.system-catalog-item:hover,
.system-catalog-item:focus-visible {
  background: color-mix(in srgb, var(--neu-light) 35%, var(--neu-bg));
  outline: none;
}

.system-catalog-item.active {
  background: var(--neu-bg);
  box-shadow: var(--neu-extrude-shadow);
  font-weight: 600;
}

.system-catalog-detail {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: auto;
  padding: 0.85rem 1rem 1rem;
  border-radius: var(--neu-radius);
  background: var(--neu-bg);
  box-shadow: var(--neu-inset-shadow);
}

.system-catalog-empty {
  margin: 1.5rem 0;
  text-align: center;
}

.system-catalog-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.system-catalog-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem 0.85rem;
  align-items: start;
}

.system-catalog-form-grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.system-catalog-form-full {
  grid-column: 1 / -1;
}

.system-catalog-form .studio-field {
  display: grid;
  gap: 0.25rem;
  font-size: 0.74rem;
  color: var(--neu-text-muted);
}

.system-catalog-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 0.25rem;
  padding-top: 0.85rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.system-offer-template-services {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.35rem;
}

.system-offer-template-services label,
.system-catalog-check {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.8125rem;
  color: var(--neu-text);
}

.system-offer-template-services input[type="checkbox"] {
  width: auto;
  box-shadow: none;
  padding: 0;
}

.system-dock-overview {
  margin-bottom: 1rem;
  overflow-x: auto;
}

.system-dock-overview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.system-dock-overview-table th,
.system-dock-overview-table td {
  padding: 0.45rem 0.55rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  vertical-align: top;
  text-align: left;
}

.system-dock-overview-table th {
  color: var(--neu-text-muted);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.system-dock-overview-table .dock-cell {
  min-width: 140px;
}

.system-dock-overview-table .dock-relation {
  display: block;
  font-weight: 600;
  color: var(--neu-text);
  margin-bottom: 0.15rem;
}

.system-dock-overview-table .dock-targets {
  color: var(--neu-text-muted);
  line-height: 1.35;
}

#ss-add-dock-rule,
#ss-add-pair-rule {
  margin-top: 0.65rem;
}

.system-pair-rule-row .system-rule-remove,
.system-connection-rule-row .system-rule-remove {
  align-self: end;
  min-width: 2.25rem;
  padding: 0.35rem 0.5rem;
}

@media (max-width: 900px) {
  .system-catalog-split {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(280px, 1fr);
    min-height: 0;
  }

  .system-catalog-list-rail {
    max-height: 240px;
  }

  .system-catalog-form-grid-2 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .system-settings-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .system-settings-nav {
    flex-direction: row;
    flex-wrap: wrap;
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  }

  .system-settings-nav-btn {
    flex: 1 1 calc(50% - 0.35rem);
  }

  .system-settings-nav-group {
    flex: 1 1 100%;
  }

  .system-settings-nav-btn-child {
    margin-left: 0;
    flex: 1 1 calc(50% - 0.35rem);
  }
}

/* Document manager */

.document-manager-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 0.25rem;
}

.document-manager-header h3 {
  margin: 0;
}

.document-manager-table-wrap {
  margin-top: 1rem;
  overflow-x: auto;
}

.document-manager-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 12px;
}

.document-manager-table th,
.document-manager-table td {
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  vertical-align: middle;
}

.document-manager-table th {
  color: var(--neu-text-muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.document-manager-table td {
  color: var(--neu-text);
}

.document-manager-table .col-actions {
  text-align: right;
  white-space: nowrap;
}

.document-manager-table .empty-row td {
  text-align: center;
  color: var(--neu-text-muted);
  padding: 1.5rem 0.65rem;
}

.doc-table-tag {
  display: inline-block;
  margin: 0 4px 4px 0;
  padding: 1px 7px;
  border-radius: 999px;
  border: none;
  background: var(--neu-bg);
  box-shadow: var(--neu-inset-shadow);
  color: var(--neu-text-muted);
  font-size: 10px;
}

.doc-manager-action-btn {
  margin-left: 4px;
  min-height: 32px;
  padding: 0.25rem 0.45rem;
  font-size: 11px;
  line-height: 1.2;
  min-width: auto;
}

.doc-manager-action-btn.neu-btn-danger {
  color: #ff8a9a;
}

#ai-upload-modal .neu-modal-card {
  width: min(600px, calc(100vw - 2rem));
}

#ai-upload-modal .ai-upload-field textarea {
  min-height: 140px;
}

#staging-detail-modal .staging-detail-content textarea {
  min-height: 100px;
}

/* Staging */

.staging-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

#staging-dropzone {
  margin-top: 1rem;
  border: none;
  border-radius: var(--neu-radius-sm);
  padding: 1.5rem;
  text-align: center;
  color: var(--neu-text-muted);
  cursor: pointer;
  background: var(--neu-bg);
  box-shadow: var(--neu-inset-shadow);
  transition: box-shadow 160ms ease, color 160ms ease;
}

#staging-dropzone.dragover {
  box-shadow: var(--neu-inset-shadow), var(--neu-focus-ring);
  color: var(--neu-text);
}

.staging-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 1rem;
  align-items: center;
}

.staging-toolbar select,
.staging-toolbar .neu-input {
  width: auto;
  min-width: 140px;
}

.staging-toolbar input[type="checkbox"] {
  accent-color: var(--neu-accent);
}

.staging-table-wrap {
  margin-top: 0.75rem;
  overflow-x: auto;
}

.staging-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.staging-table th,
.staging-table td {
  padding: 0.5rem 0.55rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  vertical-align: middle;
}

.staging-table th {
  color: var(--neu-text-muted);
  font-size: 11px;
  text-transform: uppercase;
}

.staging-table tr[data-item-id] {
  cursor: pointer;
}

.staging-table tr[data-item-id]:hover {
  background: rgba(255, 255, 255, 0.04);
}

.staging-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
}

.staging-status-ready { color: #8fdfa8; background: rgba(72, 199, 116, 0.15); }
.staging-status-needs_review { color: #ffe082; background: rgba(255, 193, 7, 0.15); }
.staging-status-error { color: #ffb8c4; background: rgba(255, 80, 100, 0.15); }
.staging-status-analyzing,
.staging-status-uploading { color: #b8d8ff; background: rgba(100, 180, 255, 0.15); }

.staging-batch-id {
  font-family: monospace;
  font-size: 10px;
  color: var(--neu-text-muted);
}

/* AI upload status */

#ai-upload-loading {
  display: none;
  margin-top: 1rem;
  text-align: center;
  color: var(--neu-accent);
  font-size: 13px;
}

#ai-upload-loading.visible {
  display: block;
}

#ai-upload-status {
  display: none;
  margin-top: 0.85rem;
  padding: 0.55rem 0.65rem;
  border-radius: var(--neu-radius-sm);
  font-size: 12px;
  line-height: 1.4;
  background: var(--neu-bg);
  box-shadow: var(--neu-inset-shadow);
}

#ai-upload-status.visible {
  display: block;
}

#ai-upload-status.error {
  color: #ffb4b8;
}

#ai-upload-status.info {
  color: #ffe082;
}

/* Agent studio (menu modal) */

#agent-studio-modal {
  z-index: 100016;
}

#agent-studio-modal .field-hint {
  font-size: 0.78rem;
  color: var(--neu-text-muted);
  margin: 0.2rem 0 0.45rem;
  line-height: 1.35;
}

#agent-studio-modal .agent-instructions-wrap {
  position: relative;
}

#agent-studio-modal .agent-instructions-actions {
  display: flex;
  gap: 0.45rem;
  margin-top: 0.45rem;
}

#agent-studio-modal .agent-input-type-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

#agent-studio-modal .agent-input-type-card {
  border: none;
  border-radius: var(--neu-radius-sm);
  padding: 0.65rem 0.75rem;
  background: var(--neu-bg);
  box-shadow: var(--neu-inset-shadow);
  cursor: pointer;
  transition: box-shadow 160ms ease;
}

#agent-studio-modal .agent-input-type-card.selected {
  box-shadow: var(--neu-inset-shadow), var(--neu-focus-ring);
}

#agent-studio-modal .agent-input-type-card input {
  margin-right: 0.35rem;
}

#agent-studio-modal .agent-input-type-preview {
  height: 42px;
  border-radius: var(--neu-radius-sm);
  background: var(--neu-bg);
  margin-bottom: 0.45rem;
  box-shadow: var(--neu-inset-shadow);
}

#agent-studio-modal .agent-knowledge-dropzone {
  border: none;
  border-radius: var(--neu-radius-sm);
  padding: 0.85rem;
  background: var(--neu-bg);
  box-shadow: var(--neu-inset-shadow);
  text-align: center;
}

#agent-studio-modal .agent-knowledge-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.55rem;
}

#agent-studio-modal .agent-knowledge-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  background: var(--neu-bg);
  box-shadow: var(--neu-extrude-shadow);
  font-size: 0.8rem;
  color: var(--neu-text-muted);
}

#agent-studio-modal .agent-knowledge-chip button {
  border: none;
  background: transparent;
  color: #ff8a80;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

#agent-studio-modal .agent-model-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

#agent-studio-modal .agent-model-row select {
  min-width: 220px;
  width: auto;
}

#agent-studio-modal select.neu-input {
  width: 100%;
}

#agent-studio-modal .agent-temperature-wrap {
  margin-top: 0.35rem;
}

#agent-studio-modal .agent-temperature-value {
  display: inline-block;
  min-width: 2.2rem;
  text-align: center;
  padding: 0.1rem 0.35rem;
  border-radius: 6px;
  border: none;
  background: var(--neu-bg);
  box-shadow: var(--neu-inset-shadow);
  font-size: 0.82rem;
  margin-bottom: 0.15rem;
}

#agent-studio-modal .agent-temperature-band {
  display: block;
  font-size: 0.78rem;
  color: var(--neu-text-muted);
  margin-bottom: 0.25rem;
}

#agent-studio-modal .agent-temperature-zones,
#agent-studio-modal .agent-temperature-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--neu-text-muted);
  margin-top: 0.25rem;
}

#agent-studio-modal .agent-labels-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.35rem;
}

#agent-studio-modal .agent-label-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: var(--neu-bg);
  box-shadow: var(--neu-extrude-shadow);
  font-size: 0.78rem;
}

#agent-studio-modal .agent-label-chip button {
  border: none;
  background: transparent;
  color: #ff8a80;
  cursor: pointer;
}

#agent-studio-modal .agent-form-schema {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-bottom: 0.45rem;
}

#agent-studio-modal .agent-form-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 0.45rem;
  align-items: end;
}

#agent-studio-modal .modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

#agent-studio-modal .modal-footer {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

#agent-studio-modal .agent-tools-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

#agent-studio-modal .agent-tool-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 1.75rem;
}

#agent-studio-modal .agent-tool-check {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex: 1;
  min-width: 0;
  margin-bottom: 0;
  font-size: 0.82rem;
  color: var(--neu-text);
  cursor: pointer;
}

#agent-studio-modal .agent-tool-check input[type="checkbox"] {
  width: auto;
  min-width: 0;
  flex-shrink: 0;
  margin: 0;
  padding: 0;
  accent-color: var(--neu-accent);
}

#agent-studio-modal .agent-tool-name {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8rem;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#agent-studio-modal .agent-tool-info {
  flex-shrink: 0;
  width: 1.35rem;
  height: 1.35rem;
  border: none;
  border-radius: 50%;
  background: var(--neu-bg);
  color: var(--neu-text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  font-style: italic;
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1;
  cursor: help;
  box-shadow: var(--neu-extrude-shadow);
  position: relative;
}

#agent-studio-modal .agent-tool-info:hover,
#agent-studio-modal .agent-tool-info:focus-visible {
  color: var(--neu-accent);
  box-shadow: var(--neu-focus-ring), var(--neu-extrude-shadow);
}

#agent-studio-modal .agent-tool-info::after {
  content: attr(data-tooltip);
  position: absolute;
  right: 0;
  bottom: calc(100% + 0.45rem);
  z-index: 20;
  width: max-content;
  max-width: min(18rem, 70vw);
  padding: 0.45rem 0.6rem;
  border-radius: var(--neu-radius-sm);
  background: var(--neu-bg);
  color: var(--neu-text);
  font-size: 0.75rem;
  font-style: normal;
  font-weight: 400;
  font-family: inherit;
  line-height: 1.4;
  text-align: left;
  white-space: normal;
  box-shadow: var(--neu-float-shadow);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity 140ms ease, transform 140ms ease, visibility 140ms ease;
}

#agent-studio-modal .agent-tool-info:hover::after,
#agent-studio-modal .agent-tool-info:focus-visible::after {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

#agent-studio-modal .modal-close {
  border: none;
  background: var(--neu-bg);
  color: var(--neu-text-muted);
  border-radius: var(--neu-radius-sm);
  width: 36px;
  height: 36px;
  cursor: pointer;
  box-shadow: var(--neu-extrude-shadow);
  font-size: 1rem;
  line-height: 1;
}

#agent-studio-modal .modal-close:hover {
  color: var(--neu-text);
}

#agent-studio-modal .modal-close:active {
  box-shadow: var(--neu-inset-shadow);
}

#agent-studio-modal .field {
  margin-bottom: 0.75rem;
}

#agent-studio-modal .field label {
  display: block;
  font-size: 12px;
  color: var(--neu-text-muted);
  margin-bottom: 0.35rem;
}

#agent-studio-modal input[type="range"] {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 8px;
  border-radius: 999px;
  background: var(--neu-bg);
  box-shadow: var(--neu-inset-shadow);
}

#agent-studio-modal input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--neu-bg);
  border: none;
  box-shadow: var(--neu-extrude-shadow);
  cursor: pointer;
}

/* Agent dock bar */

#agent-dock-bar {
  position: fixed;
  top: var(--agent-dock-top, 88px);
  left: 16px;
  z-index: 100000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  max-height: calc(100vh - var(--agent-dock-top, 88px) - 120px);
  overflow-y: auto;
  pointer-events: none;
}

#agent-dock-bar > * {
  pointer-events: auto;
}

.agent-dock-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.agent-dock-tile,
.agent-dock-slot {
  position: relative;
  width: 52px;
  min-height: 52px;
  border: none;
  border-radius: var(--neu-radius-sm);
  background: var(--neu-bg);
  color: var(--neu-text);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 4px;
  cursor: pointer;
  transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.agent-dock-tile:not(.is-configured) {
  opacity: 0.72;
}

.agent-dock-icon {
  font-size: 1.15rem;
  line-height: 1;
}

.agent-dock-label {
  font-size: 0.55rem;
  line-height: 1.1;
  text-align: center;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--neu-text-muted);
}

.agent-dock-led {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--neu-accent);
  box-shadow: 0 0 6px var(--neu-accent-soft);
}

/* Corporate knowledge library (bühnenfest) */

#graph-2d.ck-graph-file-dragover {
  outline: 2px dashed var(--studio-primary, #348fe2);
  outline-offset: -8px;
}

.agent-dock-template-list,
.agent-dock-node-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.agent-dock-template-item,
.agent-dock-node-item,
.agent-dock-menu-btn {
  width: 100%;
  text-align: left;
  justify-content: flex-start;
}

.agent-dock-template-item {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
}

.agent-dock-menu-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Agent-dock modals (add / activate / menu) */

.agent-dock-modal .modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.85rem;
}

.agent-dock-modal .modal-header h2 {
  margin: 0;
  flex: 1;
  min-width: 0;
}

.agent-dock-modal .modal-close {
  flex: 0 0 auto;
  margin-left: auto;
  border: none;
  background: var(--neu-bg);
  color: var(--neu-text-muted);
  border-radius: var(--neu-radius-sm);
  width: 36px;
  height: 36px;
  cursor: pointer;
  box-shadow: var(--neu-extrude-shadow);
  font-size: 1rem;
  line-height: 1;
}

.agent-dock-modal .modal-close:hover {
  color: var(--neu-text);
}

.agent-dock-modal .modal-close:active {
  box-shadow: var(--neu-inset-shadow);
}

.agent-dock-modal .modal-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.25rem;
  padding-top: 0.85rem;
}

#ark-chat-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: var(--right-rail-width);
  z-index: 100;
  display: flex;
  flex-direction: column;
  background: var(--neu-bg);
  border-left: 1px solid rgba(255, 255, 255, 0.04);
  box-shadow: var(--neu-float-shadow);
  overflow: visible;
  transition: width 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: auto;
}

body.graph-detail-active.chat-panel-open #ark-chat-panel {
  pointer-events: auto;
  visibility: visible;
}

/* Ein KI-Chat als Spalte 3 (Jobs-/Leads-Split) */
body.jobs-active #ark-chat-panel.ai-chat-column-mode,
body.leads-active #ark-chat-panel.ai-chat-column-mode,
body.customers-active #ark-chat-panel.ai-chat-column-mode,
body.parties-active #ark-chat-panel.ai-chat-column-mode,
body.knowledge-sources-active #ark-chat-panel.ai-chat-column-mode,
body.pze-active #ark-chat-panel.ai-chat-column-mode,
body.abos-active #ark-chat-panel.ai-chat-column-mode,
body.document-editor-active #ark-chat-panel.ai-chat-column-mode,
body.ai-chat-in-column #ark-chat-panel.ai-chat-column-mode {
  position: relative !important;
  inset: auto !important;
  top: auto !important;
  right: auto !important;
  bottom: auto !important;
  left: auto !important;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  z-index: 1;
  visibility: visible !important;
  pointer-events: auto !important;
  display: flex !important;
  border-left: none;
  box-shadow: none;
  background: var(--studio-surface);
}

body.jobs-active #ark-chat-panel.ai-chat-column-mode .chat-rail-tab,
body.leads-active #ark-chat-panel.ai-chat-column-mode .chat-rail-tab,
body.knowledge-sources-active #ark-chat-panel.ai-chat-column-mode .chat-rail-tab,
body.abos-active #ark-chat-panel.ai-chat-column-mode .chat-rail-tab,
body.document-editor-active #ark-chat-panel.ai-chat-column-mode .chat-rail-tab,
body.ai-chat-in-column #ark-chat-panel.ai-chat-column-mode .chat-rail-tab,
body.jobs-active #ark-chat-panel.ai-chat-column-mode #chat-collapse,
body.leads-active #ark-chat-panel.ai-chat-column-mode #chat-collapse,
body.knowledge-sources-active #ark-chat-panel.ai-chat-column-mode #chat-collapse,
body.abos-active #ark-chat-panel.ai-chat-column-mode #chat-collapse,
body.document-editor-active #ark-chat-panel.ai-chat-column-mode #chat-collapse,
body.ai-chat-in-column #ark-chat-panel.ai-chat-column-mode #chat-collapse {
  display: none !important;
}

body.jobs-active #chat-fab,
body.leads-active #chat-fab,
body.knowledge-sources-active #chat-fab,
body.abos-active #chat-fab,
body.document-editor-active #chat-fab {
  visibility: hidden !important;
  pointer-events: none !important;
}

.jobs-ai-chat-host,
.leads-ai-chat-host,
.dashboard-ai-chat-host,
.knowledge-sources-ai-chat-host,
.document-ai-chat-host,
#graph-ai-chat-host,
#dashboard-ai-chat-host {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

.chat-rail-resize {
  position: absolute;
  top: 0;
  left: -3px;
  width: 6px;
  height: 100%;
  cursor: col-resize;
  z-index: 5;
  background: transparent;
}

.chat-rail-resize:hover,
.chat-rail-resize[data-active="true"] {
  background: var(--studio-primary);
  opacity: 0.45;
}

#ark-chat-panel.ai-chat-column-mode .chat-rail-resize {
  display: none !important;
}

#ark-chat-panel[hidden] {
  width: 0 !important;
  display: none !important;
  pointer-events: none;
}

#ark-chat-panel.chat-collapsed {
  width: 0;
  border-left: none;
  box-shadow: none;
  background: transparent;
  pointer-events: none;
  z-index: 100010;
}

#ark-chat-panel.chat-collapsed .chat-panel-body {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

#ark-chat-panel.chat-collapsed .chat-rail-tab {
  pointer-events: auto;
}

.chat-panel-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: opacity 0.2s ease;
}

.chat-interface-switcher {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.4rem;
  padding: 0.65rem 0.85rem 0.35rem;
  flex-shrink: 0;
}

.chat-interface-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  width: 100%;
  min-width: 0;
  text-align: left;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--studio-border);
  border-radius: var(--studio-radius);
  background: var(--studio-surface-elevated);
  color: var(--studio-text);
  font: inherit;
  cursor: pointer;
}

.chat-interface-item.is-active {
  border-color: var(--studio-primary);
  box-shadow: inset 0 0 0 1px var(--studio-primary);
}

.chat-interface-item:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.chat-interface-title {
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.25;
}

.chat-interface-hint {
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.25;
}

.chat-sources-count {
  display: inline-flex;
  min-width: 1.1rem;
  justify-content: center;
  margin-left: 0.25rem;
  padding: 0 0.3rem;
  border-radius: var(--studio-radius);
  background: color-mix(in srgb, var(--studio-primary) 22%, var(--studio-bg));
  color: var(--studio-primary);
  font-size: 10px;
}

.chat-sources-count:empty {
  display: none;
}

.chat-sources-panel {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.chat-sources-panel[hidden] {
  display: none !important;
}

.chat-sources-empty {
  text-align: center;
  padding: 1.5rem 0.5rem;
}

.chat-sources-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.chat-sources-fold {
  margin-top: 0.65rem;
  padding-top: 0.45rem;
  border-top: 1px solid var(--studio-border, rgba(255, 255, 255, 0.08));
}

.chat-sources-fold-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.15rem 0;
  border: 0;
  background: transparent;
  color: var(--studio-text-muted, inherit);
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}

.chat-sources-fold-caret {
  display: inline-block;
  width: 0.75rem;
  text-align: center;
}

.chat-sources-fold-count {
  font-weight: 500;
  opacity: 0.8;
}

.chat-sources-fold-body {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-top: 0.4rem;
}

.chat-sources-fold-body[hidden] {
  display: none !important;
}

.chat-sources-fold-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.45rem;
}

.chat-sources-fold-row.is-muted {
  opacity: 0.82;
}

.chat-sources-fold-caption {
  width: 100%;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--studio-text-muted, inherit);
}

.chat-sources-fold-chip {
  display: inline-flex;
  max-width: 16rem;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.5rem;
  border: 1px solid var(--studio-border, rgba(255, 255, 255, 0.12));
  border-radius: 999px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 0.72rem;
  cursor: pointer;
}

.chat-sources-fold-chip-ref {
  font-weight: 700;
}

.chat-sources-fold-chip-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-source-card {
  width: 100%;
  text-align: left;
  border: none;
  border-radius: var(--neu-radius-sm);
  padding: 0.65rem 0.75rem;
  background: var(--neu-bg);
  box-shadow: var(--neu-extrude-shadow);
  cursor: pointer;
  color: inherit;
  font: inherit;
}

.chat-source-card:hover,
.chat-source-card.active {
  box-shadow: var(--neu-inset-shadow);
}

.chat-source-card-header {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.35rem;
}

.chat-source-card-ref {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--neu-text-muted) 18%, var(--neu-bg));
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.chat-source-card-title {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
}

.chat-source-card-meta {
  font-size: 11px;
  color: var(--neu-text-muted);
  margin-bottom: 0.35rem;
}

.chat-source-card-excerpt {
  font-size: 12px;
  line-height: 1.45;
  color: var(--neu-text);
}

.chat-source-excerpt-body--clamp {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.chat-source-excerpt-body--expanded {
  display: block;
  overflow: visible;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-source-excerpt-toggle {
  margin-top: 0.35rem;
  padding: 0;
  border: none;
  background: none;
  color: var(--neu-accent);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}

.chat-source-excerpt-toggle:hover {
  text-decoration: underline;
}

.chat-source-popover-excerpt .chat-source-excerpt-body--clamp {
  -webkit-line-clamp: 6;
}

.chat-panel-body.chat-view-sources .chat-messages,
.chat-panel-body.chat-view-sources .chat-panel-footer,
.chat-panel-body.chat-view-sources .chat-agents-bar,
.chat-panel-body.chat-view-sources .chat-compact-banner {
  display: none !important;
}

/* Learning ohne Job: nur Learning-Inhalt (wird im Nachrichtenbereich gerendert) */
.chat-panel-body.chat-view-learning:not(.chat-job-mode) .chat-panel-footer,
.chat-panel-body.chat-view-learning:not(.chat-job-mode) .chat-compact-banner,
.chat-panel-body.chat-view-learning:not(.chat-job-mode) .chat-agents-bar {
  display: none !important;
}

/* Job-Hybrid: freier Chat bleibt sichtbar; Agent-Leiste trägt Plan/Skills/Learning */

.chat-bubble-content .chat-cite-pill.active {
  background: color-mix(in srgb, var(--neu-accent) 28%, var(--neu-bg));
  color: var(--neu-accent);
}

.chat-rail-tab {
  position: absolute;
  top: 42%;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  width: 2.35rem;
  padding: 0.65rem 0.35rem;
  border: none;
  border-radius: var(--neu-radius-sm) 0 0 var(--neu-radius-sm);
  color: var(--neu-accent);
  background: var(--neu-bg);
  cursor: pointer;
  transition: color 0.15s ease, transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-rail-tab:hover {
  color: var(--neu-text);
}

.chat-rail-tab-icon {
  flex-shrink: 0;
}

.chat-rail-tab-label {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--neu-text-muted);
}

.chat-rail-tab-chevron::before {
  content: "‹";
  font-size: 14px;
  line-height: 1;
  color: var(--neu-text-muted);
}

#ark-chat-panel.chat-collapsed .chat-rail-tab {
  position: fixed;
  right: 0;
  top: 42%;
  transform: translateY(-50%);
  border-radius: var(--neu-radius-sm) 0 0 var(--neu-radius-sm);
}

#ark-chat-panel.chat-collapsed .chat-rail-tab-chevron::before {
  content: "›";
}

#ark-chat-panel:not(.chat-collapsed) .chat-rail-tab {
  left: 0;
  transform: translate(-100%, -50%);
}

.chat-panel-header-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

#chat-fab {
  position: fixed;
  right: var(--chat-fab-right, 1.35rem);
  bottom: calc(var(--graph-tooling-dock-offset, 0px) + var(--chat-fab-gap, 1.35rem));
  z-index: 100010;
  width: 3.35rem;
  height: 3.35rem;
  padding: 0;
  border: none;
  border-radius: 50%;
  color: var(--neu-accent);
  background: var(--neu-bg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--neu-extrude-shadow);
  transition:
    right 0.28s cubic-bezier(0.4, 0, 0.2, 1),
    bottom 0.28s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.18s ease,
    color 0.15s ease,
    box-shadow 0.15s ease;
}

#chat-fab:hover {
  color: var(--neu-text);
  transform: translateY(-2px);
}

#chat-fab:active {
  transform: translateY(0);
  box-shadow: var(--neu-inset-shadow);
}

#chat-fab[hidden] {
  display: none !important;
}

.chat-fab-icon {
  display: block;
}

.chat-panel-header {
  flex-shrink: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem 0.65rem;
  border-bottom: 1px solid var(--studio-border);
}

.chat-panel-title-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.65rem;
  min-width: 0;
}

.chat-panel-title-wrap .chat-panel-status {
  flex-basis: 100%;
  margin-top: 0;
}

.chat-panel-title-wrap .job-agent-status-badge[hidden] {
  display: none !important;
}

.chat-panel-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--studio-text);
  line-height: 1.3;
  margin: 0;
}

.chat-historical-banner {
  margin: 0 0 0.15rem;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--studio-border);
  border-radius: var(--studio-radius);
  background: var(--studio-surface-elevated);
  color: var(--studio-text-muted);
}

#ark-chat-panel.chat-historical-mode .chat-panel-footer,
#ark-chat-panel.chat-historical-mode .chat-agents-bar,
#ark-chat-panel.chat-historical-mode .chat-compact-banner {
  display: none;
}

.chat-panel-status {
  margin-top: 0.2rem;
  font-size: 11px;
}

.chat-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  overscroll-behavior: contain;
}

.chat-empty {
  margin: auto 0;
  text-align: center;
  padding: 1rem 0.5rem;
}

.chat-bubble {
  max-width: 92%;
  padding: 0.65rem 0.85rem;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.5;
  word-break: break-word;
  color: var(--chat-bubble-fg, #1a2332);
  box-shadow: none;
}

.chat-bubble--user {
  align-self: flex-end;
  color: var(--chat-bubble-fg, #1a2332);
  background: var(--chat-bubble-user-bg, #cfe8f8);
  border: 1px solid color-mix(in srgb, var(--studio-primary, #348fe2) 28%, transparent);
  box-shadow: none;
}

.chat-bubble--assistant {
  align-self: flex-start;
  color: var(--chat-bubble-fg, #1a2332);
  background: var(--chat-bubble-assistant-bg, #f6d9b8);
  border: 1px solid color-mix(in srgb, #e09a4a 32%, transparent);
  box-shadow: none;
}

.chat-bubble--agent-report .chat-bubble-kind-label {
  margin-bottom: 0.35rem;
  font-size: 0.75rem;
  color: color-mix(in srgb, var(--chat-bubble-fg, #1a2332) 62%, transparent);
}

.chat-bubble-content {
  color: var(--chat-bubble-fg, #1a2332);
}

.chat-lead-transfer-bar {
  flex-direction: column;
  align-items: stretch;
  gap: 0.5rem;
}

.chat-lead-transfer-preview {
  margin: 0;
  padding: 0.45rem 0.55rem;
  white-space: pre-wrap;
  font: inherit;
  font-size: 12px;
  line-height: 1.4;
  border: 1px solid var(--studio-border, var(--neu-border));
  border-radius: var(--studio-radius, var(--neu-radius-sm));
  background: var(--studio-bg, var(--neu-bg));
  color: var(--studio-text, var(--neu-text));
  max-height: 12rem;
  overflow: auto;
}

#lead-transfer-skill-modal .studio-field {
  margin-bottom: 0.65rem;
}

#lead-transfer-skill-modal .lead-transfer-skill-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 0.5rem;
}

.chat-streaming-cursor {
  display: inline-block;
  width: 0.45rem;
  height: 1em;
  margin-left: 2px;
  vertical-align: text-bottom;
  background: var(--neu-accent);
  opacity: 0.75;
  animation: chat-cursor-blink 1s step-end infinite;
}

@keyframes chat-cursor-blink {
  50% { opacity: 0; }
}

.chat-panel-footer {
  flex-shrink: 0;
  padding: 0 1rem 0.85rem;
}

.chat-composer {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.55rem 0.6rem 0.5rem;
  border-radius: var(--neu-radius);
  min-width: 0;
}

.chat-composer-text {
  width: 100%;
  min-height: 4.25rem;
  max-height: 12rem;
  resize: vertical;
  border: none;
  background: transparent;
  color: var(--neu-text);
  font: inherit;
  font-size: 13px;
  line-height: 1.45;
  padding: 0.15rem 0.25rem 0;
  box-shadow: none;
}

.chat-composer-text::placeholder {
  color: var(--neu-text-muted);
}

.chat-composer-text:focus {
  outline: none;
}

.chat-composer-toolbar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.25rem;
  padding-top: 0.15rem;
  position: relative;
}

.chat-composer-toolbar-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
  min-width: 0;
}

.chat-composer-toolbar-start {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  position: relative;
  min-width: 0;
  flex: 1 1 auto;
}

.chat-composer-toolbar-end {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.45rem;
  flex: 0 0 auto;
  margin-left: auto;
}

.chat-composer-usage-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}

.chat-composer-usage-row .chat-context-usage-btn {
  flex-shrink: 0;
}

.chat-mode-picker,
.chat-model-picker {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.2rem 0.35rem;
  border: none;
  border-radius: var(--neu-radius-sm);
  background: transparent;
  color: var(--neu-text-muted);
  font: inherit;
  font-size: 12px;
  line-height: 1.2;
  cursor: pointer;
  max-width: min(140px, 48%);
  min-width: 0;
}

.chat-mode-picker:hover:not(:disabled),
.chat-model-picker:hover:not(:disabled) {
  color: var(--neu-text);
  background: rgba(255, 255, 255, 0.03);
}

.chat-mode-menu {
  position: absolute;
  left: 0;
  bottom: calc(100% + 6px);
  z-index: 21;
  min-width: min(260px, 72vw);
  max-height: min(280px, 40vh);
  margin: 0;
  padding: 0.35rem;
  list-style: none;
  overflow: auto;
  border: 1px solid var(--studio-border, var(--neu-border));
  border-radius: var(--studio-radius, var(--neu-radius-sm));
  background: var(--studio-surface-elevated, var(--neu-surface));
  box-shadow: var(--studio-shadow-sm, none);
}

.chat-mode-menu[hidden] {
  display: none !important;
}

.chat-mode-menu-item {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.45rem 0.55rem;
  border-radius: var(--studio-radius, 6px);
  cursor: pointer;
  color: var(--studio-text, var(--neu-text));
}

.chat-mode-menu-item:hover,
.chat-mode-menu-item:focus-visible,
.chat-mode-menu-item.selected {
  background: rgba(59, 130, 246, 0.12);
  outline: none;
}

.chat-mode-menu-item strong {
  font-size: 12px;
  font-weight: 600;
}

.chat-mode-picker:disabled,
.chat-model-picker:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.chat-model-picker #chat-model-label,
.chat-model-picker .chat-model-picker-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-model-chevron {
  flex-shrink: 0;
  font-size: 11px;
  opacity: 0.75;
  line-height: 1;
}

.chat-model-menu {
  position: absolute;
  left: 0;
  bottom: calc(100% + 6px);
  z-index: 20;
  min-width: min(280px, 72vw);
  max-height: min(360px, 48vh);
  overflow: hidden;
  margin: 0;
  padding: 0;
  list-style: none;
  border-radius: var(--neu-radius-sm);
  background: var(--neu-bg);
  box-shadow: var(--neu-float-shadow);
}

.chat-model-menu-panel {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.45rem;
  max-height: min(360px, 48vh);
}

.chat-model-menu[hidden] {
  display: none !important;
}

.chat-model-search {
  width: 100%;
  font-size: 12px;
}

.chat-model-auto-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  width: 100%;
  text-align: left;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--neu-border, rgba(255, 255, 255, 0.08));
  border-radius: var(--neu-radius-sm);
  background: transparent;
  color: var(--neu-text);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.chat-model-auto-row:hover,
.chat-model-auto-row:focus-visible,
.chat-model-auto-row.selected {
  border-color: var(--neu-accent);
  outline: none;
}

.chat-model-auto-title {
  font-weight: 600;
}

.chat-model-auto-desc {
  font-size: 11px;
  line-height: 1.35;
}

.chat-model-groups {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.chat-model-group-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--neu-text-muted);
  padding: 0.15rem 0.35rem;
}

.chat-model-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  text-align: left;
  padding: 0.45rem 0.7rem;
  border: none;
  background: transparent;
  color: var(--neu-text);
  font: inherit;
  font-size: 12px;
  line-height: 1.35;
  cursor: pointer;
}

.chat-model-item-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.chat-model-cost-badge {
  flex-shrink: 0;
  font-size: 10px;
  color: var(--neu-text-muted);
}

.chat-usage-bar {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  line-height: 1.3;
  padding: 0 0.15rem;
}

.chat-model-menu-item:hover,
.chat-model-menu-item:focus-visible {
  background: rgba(255, 255, 255, 0.04);
  outline: none;
}

.chat-model-menu-item.selected {
  color: var(--neu-accent);
}

.chat-model-menu-item:disabled {
  opacity: 0.5;
  cursor: default;
}

.chat-send-round {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--neu-extrude-shadow);
}

.chat-send-round:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.chat-send-round span {
  transform: translateY(-1px);
}

/* —— Chat-Diktierfunktion —— */
.chat-dictate-wrap {
  position: relative;
  flex-shrink: 0;
  pointer-events: auto;
}

.chat-dictate-round {
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--neu-surface, var(--studio-surface-elevated));
  color: var(--neu-text, var(--studio-text));
  cursor: pointer;
  pointer-events: auto;
  box-shadow: var(--neu-extrude-shadow, var(--studio-shadow-sm));
  transition: background 0.15s ease, color 0.15s ease;
}

.chat-dictate-round:hover:not(:disabled) {
  background: var(--neu-surface-hover, var(--studio-surface));
  color: var(--neu-text, var(--studio-text));
}

.chat-dictate-round:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.chat-dictate-round.is-recording {
  background: var(--studio-primary, var(--neu-accent));
  color: #fff;
}

.chat-dictate-icon {
  display: block;
}

.chat-dictate-tooltip {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 25;
  padding: 0.4rem 0.55rem;
  border-radius: var(--studio-radius, var(--neu-radius-sm));
  border: 1px solid var(--studio-border, var(--neu-border));
  background: var(--studio-surface-elevated, var(--neu-bg));
  color: var(--studio-text-muted, var(--neu-text-muted));
  font-size: 11px;
  line-height: 1.35;
  white-space: nowrap;
  box-shadow: var(--studio-shadow-sm, var(--neu-float-shadow));
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.chat-dictate-wrap:hover .chat-dictate-tooltip,
.chat-dictate-round:focus-visible + .chat-dictate-tooltip {
  opacity: 1;
  transform: translateY(0);
}

.chat-dictate-tooltip kbd {
  display: inline-block;
  padding: 0.05rem 0.3rem;
  margin: 0 0.05rem;
  border-radius: 4px;
  border: 1px solid var(--studio-border, var(--neu-border));
  background: var(--studio-surface, var(--neu-surface));
  color: var(--studio-text, var(--neu-text));
  font: inherit;
  font-size: 10px;
  line-height: 1.3;
}

.chat-dictation-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.5rem;
  padding: 0.35rem 0.25rem 0.15rem;
  position: relative;
  z-index: 3;
  pointer-events: auto;
}

.chat-dictation-bar[hidden] {
  display: none !important;
}

.chat-dictation-waveform {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 2px;
  min-width: 0;
  height: 28px;
  overflow: hidden;
}

.chat-dictation-wave-bar {
  flex-shrink: 0;
  width: 3px;
  height: 4px;
  border-radius: 2px;
  background: var(--studio-text-muted, var(--neu-text-muted));
  transition: height 0.08s ease, opacity 0.08s ease;
}

.chat-dictation-timer {
  flex-shrink: 0;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--studio-text-muted, var(--neu-text-muted));
  min-width: 2.5rem;
  text-align: right;
}

.chat-dictation-action {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--studio-text-muted, var(--neu-text-muted));
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  position: relative;
  z-index: 4;
  pointer-events: auto;
}

.chat-dictation-action:hover {
  color: var(--studio-text, var(--neu-text));
  background: rgba(255, 255, 255, 0.04);
}

.chat-dictation-action--confirm {
  color: var(--studio-text, var(--neu-text));
}

.chat-dictation-spinner {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--studio-border, var(--neu-border));
  border-top-color: var(--studio-text-muted, var(--neu-text-muted));
  animation: chat-dictation-spin 0.75s linear infinite;
}

.chat-dictation-spinner[hidden] {
  display: none !important;
}

@keyframes chat-dictation-spin {
  to { transform: rotate(360deg); }
}

.chat-composer--dictating .chat-composer-toolbar .chat-mode-picker,
.chat-composer--dictating .chat-composer-toolbar .chat-model-picker {
  opacity: 0.45;
  pointer-events: none;
}

.chat-composer--transcribing .chat-composer-toolbar .chat-mode-picker,
.chat-composer--transcribing .chat-composer-toolbar .chat-model-picker,
.chat-composer--transcribing .chat-composer-toolbar .chat-send-round {
  opacity: 0.45;
  pointer-events: none;
}

.chat-footnote,
.chat-cite-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.35rem;
  height: 1.35rem;
  margin: 0 0.12rem;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: color-mix(in srgb, var(--neu-text-muted) 18%, var(--neu-bg));
  color: var(--neu-text);
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  vertical-align: super;
  cursor: pointer;
  box-shadow: none;
  transition: background 0.15s ease, transform 0.12s ease;
}

.chat-cite-pill:hover,
.chat-footnote:hover {
  background: color-mix(in srgb, var(--neu-accent) 22%, var(--neu-bg));
  color: var(--neu-text);
  transform: translateY(-1px);
}

.chat-cite-pill:focus-visible,
.chat-footnote:focus-visible {
  outline: none;
  box-shadow: var(--neu-focus-ring);
}

.chat-source-popover {
  position: fixed;
  z-index: 100010;
  width: min(320px, calc(100vw - 2rem));
  max-height: min(280px, 50vh);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.75rem 0.85rem;
  pointer-events: auto;
}

.chat-source-popover[hidden] {
  display: none !important;
}

.chat-source-popover-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.chat-source-popover-type {
  margin-top: 0.15rem;
  font-size: 11px;
}

.chat-source-popover-excerpt {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  font-size: 12px;
  line-height: 1.45;
  color: var(--neu-text);
  white-space: pre-wrap;
  word-break: break-word;
  padding: 0.45rem 0.5rem;
  border-radius: var(--neu-radius-sm);
  box-shadow: var(--neu-inset-shadow);
}

.chat-source-highlight {
  background: color-mix(in srgb, var(--studio-primary, #4a9eff) 35%, transparent);
  border-radius: 2px;
  padding: 0 0.1em;
  color: inherit;
}

.chat-source-popover-passages {
  margin: 0;
  padding-left: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  max-height: min(220px, 40vh);
  overflow-y: auto;
  font-size: 12px;
  line-height: 1.45;
  color: var(--neu-text);
}

.chat-source-popover-passages:empty {
  display: none;
}

.chat-source-popover-passages li::marker {
  color: var(--neu-text-muted);
}

.chat-source-popover-link {
  align-self: flex-start;
  border: none;
  background: transparent;
  color: var(--neu-accent);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 0.15rem 0;
  text-decoration: none;
}

.chat-source-popover-link:hover {
  text-decoration: underline;
}

.chat-source-popover-open {
  align-self: stretch;
  justify-content: center;
}

.neu-btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 12px;
  min-height: 32px;
}

#node-detail-modal .node-detail-body {
  max-height: min(60vh, 520px);
  overflow-y: auto;
}

#node-detail-modal .node-detail-footer {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.capacity-nav-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  width: 100%;
  text-align: left;
}

.capacity-nav-item.active {
  border-color: var(--studio-primary);
}

.capacity-overview-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

.capacity-overview-stats dt {
  color: var(--studio-text-muted);
  font-size: 0.85rem;
}

.capacity-overview-stats dd {
  font-size: 1.35rem;
  font-weight: 600;
  margin: 0.25rem 0 0;
}

.capacity-catalog-header,
.capacity-form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.capacity-slot-list {
  margin: 0.75rem 0 0;
  padding-left: 1.25rem;
}

#node-editor-modal .modal-body {
  max-height: min(78vh, 720px);
  overflow-y: auto;
}

.agent-dock-modal .modal-body {
  min-width: 0;
}

