.chat-view {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.chat-view__messages {
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 8px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chat-view__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 8px;
  color: var(--island-text-muted);
  font-size: 11px;
  padding: 32px 0;
}

.chat-view__empty-icon {
  font-size: 24px;
  opacity: 0.4;
}

.chat-view__history-limit {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 8px 8px;
  color: var(--island-text-muted);
  font-size: 10px;
  line-height: 1.35;
  text-align: center;
  opacity: 0.78;
  flex-shrink: 0;
}

.chat-view__subagent-history {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  margin-bottom: 6px;
  border: 1px solid var(--island-border);
  border-radius: 8px;
  background: var(--island-card);
}

.chat-view__subagent-back {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--island-border);
  border-radius: 6px;
  background: transparent;
  color: var(--island-text-secondary);
  cursor: pointer;
}

.chat-view__subagent-back:hover {
  background: var(--island-card-hover);
  color: var(--island-text);
}

.chat-view__subagent-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  flex: 1;
}

.chat-view__subagent-title {
  color: var(--island-text);
  font-size: 11px;
  font-weight: 600;
}

.chat-view__subagent-subtitle {
  overflow: hidden;
  color: var(--island-text-muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-view__subagent-badge {
  flex-shrink: 0;
  color: var(--island-text-muted);
  font-size: 9px;
  text-transform: uppercase;
}

.chat-view__scroll-btn {
  position: absolute;
  bottom: 80px;
  right: 16px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--island-border);
  background: var(--island-card);
  backdrop-filter: blur(8px);
  color: var(--island-text-secondary);
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: all 0.15s ease-out;
}

.chat-view__scroll-btn:hover {
  background: var(--island-card-hover);
  color: var(--island-text);
}

.chat-view__send-error {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-top: 1px solid rgba(239, 68, 68, 0.22);
  background: rgba(239, 68, 68, 0.08);
  color: #ef4444;
  font-size: 11px;
}

.chat-view__send-error span {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-view__send-error button {
  flex-shrink: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 11px;
}

/* Error state banner */
.chat-view__error-banner {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 12px;
  margin: 8px 16px;
  border-radius: 8px;
  background: rgba(255, 69, 58, 0.08);
  border: 1px solid rgba(255, 69, 58, 0.25);
}

.chat-view__error-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.chat-view__error-title {
  font-size: 12px;
  font-weight: 600;
  color: #ff453a;
}

.chat-view__error-message {
  font-size: 11px;
  color: var(--island-text);
  word-break: break-word;
}

.chat-view__error-hint {
  font-size: 10px;
  color: var(--island-text-muted);
  margin-top: 2px;
}

.chat-view__error-jump {
  flex-shrink: 0;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--island-border);
  background: var(--island-subtle, rgba(255, 255, 255, 0.05));
  color: var(--island-text-secondary);
  font-size: 10px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease-out;
}

.chat-view__error-jump:hover {
  background: var(--island-border);
  color: var(--island-text);
}
