.chat-panel {
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.fibo-stage {
  display: block;
}

.fibo-stage .fibo-bubble {
  display: none !important;
}

.messages {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
  padding: 22px 18px;
  background: #ffffff;
}

.message-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  width: 100%;
  max-width: 100%;
}

.message-row.assistant {
  align-self: stretch;
  justify-content: flex-start;
}

.message-row.user {
  align-self: stretch;
  justify-content: flex-end;
}

.message-row.system {
  align-self: center;
  justify-content: center;
}

.message-row.assistant > .message-avatar {
  display: block !important;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center;
  flex: 0 0 auto;
  background: #fff8ee;
  border: 1px solid var(--line);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

.message-bubble {
  width: fit-content;
  max-width: min(680px, calc(100% - 58px));
  padding: 11px 14px;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--text);
  box-shadow: 0 6px 16px rgba(22, 33, 45, 0.04);
}

.message-row.assistant .message-bubble {
  border-bottom-left-radius: 4px;
}

.message-row.user .message-bubble {
  max-width: min(680px, 82%);
  color: #ffffff;
  border-color: #0f766e;
  background: #0f766e;
  border-bottom-right-radius: 4px;
}

.message-row.system .message-bubble {
  max-width: min(620px, 92%);
  color: var(--muted);
  background: #f8fafc;
  border-radius: 999px;
  text-align: center;
  box-shadow: none;
}

.message-row.temporary .message-bubble {
  color: var(--muted);
}

.composer {
  background: #ffffff;
}

@media (max-width: 800px) {
  .chat-panel {
    min-height: min(680px, calc(100vh - 20px));
  }

  .messages {
    padding: 14px;
  }

  .message-row.assistant > .message-avatar {
    width: 36px;
    height: 36px;
  }

  .message-bubble {
    max-width: calc(100% - 48px);
    padding: 10px 12px;
  }

  .message-row.user .message-bubble {
    max-width: 86%;
  }
}
