/**
 * Konfigurations-Assistent (Chat-Panel) — global für alle Komponenten-Seiten.
 */

.assistant-panel {
  position: sticky;
  top: 1rem;
  align-self: start;
  max-height: calc(100dvh - 2rem);
}

.assistant-shell {
  display: flex;
  flex-direction: column;
  height: min(720px, calc(100dvh - 2rem));
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e5e5e5);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}

.assistant-header {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #eee;
  flex-shrink: 0;
}

.assistant-header strong {
  display: block;
}

#assistant-status,
.assistant-header span {
  color: var(--muted, #6b7280);
}

.assistant-restart {
  margin-left: auto;
  border: none;
  background: #f3f4f6;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
}

.assistant-restart:hover {
  background: #e5e7eb;
}

.assistant-thread {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  background: #f7f7f8;
  min-height: 0;
}

.assistant-messages {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 100%;
}

.msg-row {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
}

.msg-row.user {
  flex-direction: row-reverse;
}

.msg-bubble {
  max-width: 92%;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-md);
  line-height: 1.45;
  background: #fff;
  border: 1px solid #e8e8ed;
}

.msg-row.user .msg-bubble {
  background: #e6f5f5;
  border-color: #cce8e8;
}

.msg-bubble--awaiting {
  background: #fefce8;
  border-color: #fde68a;
}

html[data-theme="dark"] .msg-bubble--awaiting {
  background: #422006;
  border-color: #ca8a04;
  color: #fef9c3;
}

.msg-lead {
  margin: 0 0 0.25rem;
  line-height: 1.45;
}

.msg-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  flex-shrink: 0;
}

.msg-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.5rem;
}

.msg-actions button,
.msg-inline input,
.msg-inline select {
  font: inherit;
}

.msg-actions button {
  border: 1px solid #d1d5db;
  background: #fff;
  padding: 0.4rem 0.75rem;
  cursor: pointer;
}

.msg-actions button:hover:not(:disabled) {
  border-color: var(--accent, #009493);
  color: var(--accent, #009493);
}

.msg-actions button:disabled {
  opacity: 0.55;
  cursor: default;
}

.assistant-kg-actions {
  margin-top: 0.65rem;
}

.assistant-kg-badge {
  font-weight: 600;
  border: 1px solid var(--accent, #009493) !important;
  color: #007a79;
  background: #ecfdfd !important;
}

.assistant-kg-badge:hover:not(:disabled) {
  background: var(--accent, #009493) !important;
  color: #fff !important;
}

.assistant-kg-badge--ghost {
  border-color: #d1d5db !important;
  background: #fff !important;
  color: #4b5563 !important;
  font-weight: 500;
}

.msg-inline {
  margin-top: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.msg-inline--stack {
  flex-direction: column;
  align-items: stretch;
}

.msg-field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  width: 100%;
}

.msg-field-label {
  font-size: 12px;
  color: #4b5563;
}

.msg-img-picker {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

@media (min-width: 420px) {
  .msg-img-picker {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.msg-img-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.35rem;
  padding: 0.35rem;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  text-align: center;
  line-height: 1.25;
}

.msg-img-card img {
  width: 100%;
  height: auto;
  border-radius: 6px;
  background: #f9fafb;
}

.msg-img-card:hover {
  border-color: var(--accent, #009493);
}

.msg-img-card.is-selected {
  border-color: var(--accent, #009493);
  box-shadow: 0 0 0 2px rgba(0, 148, 147, 0.25);
}

.msg-img-card:disabled {
  opacity: 0.65;
  cursor: default;
}

.msg-ref-drawing {
  display: block;
  max-width: 100%;
  margin-top: 0.5rem;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
}

.msg-inline input,
.msg-inline select {
  padding: 0.45rem 0.55rem;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  min-width: 120px;
}

.msg-inline button {
  border: none;
  background: var(--accent, #009493);
  color: #fff;
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  cursor: pointer;
}

.msg-typing {
  display: flex;
  gap: 4px;
  padding: 0.5rem 0.75rem;
}

.msg-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #9ca3af;
  animation: assistant-dot 1s infinite ease-in-out;
}

.msg-typing span:nth-child(2) {
  animation-delay: 0.15s;
}

.msg-typing span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes assistant-dot {
  0%,
  80%,
  100% {
    opacity: 0.3;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

@media (max-width: 900px) {
  .assistant-panel {
    position: static;
    max-height: none;
  }

  .assistant-shell {
    height: min(640px, 70dvh);
  }
}
       