.ddchat-panel {
  position: relative;
  width: min(420px, 100%);
  pointer-events: auto;
  border: 1px solid var(--dock-border, #e5e7eb);
  border-radius: 0.85rem;
  background: var(--dock-bg, #ffffff);
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.1), 0 2px 6px rgba(15, 23, 42, 0.04);
  overflow: hidden;
}

.ddchat-panel[hidden] {
  display: none;
}

.ddchat-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.ddchat-body {
  display: grid;
  gap: 0.7rem;
  padding: 0.75rem;
  background: var(--dock-bg, #ffffff);
}

.ddchat-thread {
  display: grid;
  gap: 0.55rem;
  max-height: 220px;
  overflow-y: auto;
  padding: 0.15rem;
}

.ddchat-entry {
  display: grid;
  gap: 0.3rem;
}

.ddchat-entry--user {
  justify-items: end;
}

.ddchat-entry--assistant {
  justify-items: start;
}

.ddchat-message {
  max-width: 82%;
  margin: 0;
  padding: 0.62rem 0.72rem;
  border-radius: 0.7rem;
  font-size: 0.78rem;
  line-height: 1.35;
  white-space: pre-line;
}

.ddchat-message--assistant {
  justify-self: start;
  border: 1px solid var(--dock-border, #e5e7eb);
  background: var(--dock-surface, #f8fafc);
  color: var(--dock-text, #0f172a);
}

.ddchat-source {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  margin-right: 0.35rem;
  border-radius: 999px;
  font-family: 'Material Symbols Outlined';
  font-size: 0.72rem;
  font-weight: normal;
  line-height: 1;
  vertical-align: -0.12rem;
}

.ddchat-source--tool {
  background: rgba(5, 150, 105, 0.12);
  color: var(--dock-primary, #059669);
}

.ddchat-source--llm {
  background: rgba(37, 99, 235, 0.12);
  color: #2563eb;
}

.ddchat-message--typing {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--dock-muted-strong, #475569);
}

.ddchat-typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 0.18rem;
}

.ddchat-typing-dots span {
  width: 0.32rem;
  height: 0.32rem;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.35;
  animation: ddchat-typing-dot 1s ease-in-out infinite;
}

.ddchat-typing-dots span:nth-child(2) {
  animation-delay: 0.14s;
}

.ddchat-typing-dots span:nth-child(3) {
  animation-delay: 0.28s;
}

.ddchat-message--user {
  justify-self: end;
  background: var(--dock-primary, #059669);
  color: #ffffff;
}

.ddchat-prompts {
  display: grid;
  gap: 0.45rem;
  padding-top: 0.1rem;
}

.ddchat-prompts-title {
  margin: 0;
  color: var(--dock-muted, #64748b);
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1;
  text-transform: uppercase;
}

.ddchat-prompts-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.ddchat-prompt-groups {
  display: grid;
  gap: 0.35rem;
}

.ddchat-prompt-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.ddchat-prompt-group[hidden] {
  display: none;
}

.ddchat-prompt {
  min-height: 1.85rem;
  border: 1px solid var(--dock-border, #e5e7eb);
  border-radius: 0.5rem;
  background: var(--dock-bg, #ffffff);
  color: var(--dock-muted-strong, #475569);
  padding: 0.35rem 0.55rem;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.15;
  cursor: pointer;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.ddchat-prompt:hover,
.ddchat-prompt:focus-visible {
  border-color: var(--dock-primary-soft, #10b981);
  background: var(--dock-primary-pale, #ecfdf5);
  color: var(--dock-primary, #059669);
  outline: none;
}

.ddchat-prompt--back {
  border-color: rgba(5, 150, 105, 0.2);
  background: var(--dock-primary-pale, #ecfdf5);
  color: var(--dock-primary, #059669);
}

.ddchat-prompt:disabled {
  cursor: wait;
  opacity: 0.6;
}

.ddchat-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  max-width: 82%;
  margin-top: 0.7rem;
}

.ddchat-action {
  text-align: left;
}

.ddchat-message-html {
  display: inline-block;
  white-space: normal;
}

.ddchat-result-list {
  margin: 0;
  padding-left: 1rem;
}

.ddchat-result-list li + li {
  margin-top: 0.22rem;
}

.ddchat-result-link {
  color: var(--dock-primary, #059669);
  font-weight: 700;
  text-decoration: none;
}

.ddchat-result-link:hover,
.ddchat-result-link:focus-visible {
  text-decoration: underline;
  outline: none;
}

.ddchat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.45rem;
  align-items: end;
}

.ddchat-input {
  width: 100%;
  min-height: 2.5rem;
  max-height: 7rem;
  resize: vertical;
  border: 1px solid var(--dock-border, #e5e7eb);
  border-radius: 0.6rem;
  background: var(--dock-surface, #f8fafc);
  color: var(--dock-text, #0f172a);
  padding: 0.62rem 0.7rem;
  font: inherit;
  font-size: 0.82rem;
  line-height: 1.35;
}

.ddchat-input:focus {
  outline: none;
  border-color: var(--dock-primary-soft, #10b981);
  background: var(--dock-bg, #ffffff);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.ddchat-send {
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid var(--dock-primary, #059669);
  border-radius: 0.6rem;
  background: var(--dock-primary, #059669);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.18s ease, border-color 0.18s ease;
}

.ddchat-send:hover {
  background: #047857;
  border-color: #047857;
}

.ddchat-send:disabled {
  cursor: wait;
  opacity: 0.65;
}

.ddchat-send .material-symbols-outlined {
  font-size: 1.05rem;
}

@media (max-width: 991.98px) {
  .ddchat-panel {
    width: 100%;
  }
}

@keyframes ddchat-typing-dot {
  0%,
  80%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }

  40% {
    opacity: 1;
    transform: translateY(-2px);
  }
}
